Skip to content

Compatibility issue with SciPy 1.0 #164

Description

@jcwinkler

The following snippet

import control as ctrl
G = ctrl.tf(1, [1, 1])
t, y = ctrl.step_response(G)

executed under Python 3.5.4 with SciPy 1.0, NumPy 1.13.3 and python-control 0.7 and SlyCot NOT installed fails to run.

After investigation it turns out that the problem arrises in the file statesp.py, function _convertToStateSpace line 641: python-control tries to solve the problem using SlyCot. Since SlyCot is not found, it falls back to the ImportError handling in which the SciPy's lti is called:

            lti_sys = lti(squeeze(sys.num), squeeze(sys.den))
            return StateSpace(lti_sys.A, lti_sys.B, lti_sys.C, lti_sys.D,
                              sys.dt)

In SciyPy versions PRIOR to 1.0 the lti_sys object had the attributes A, B, C, D. However, in SciPy 1.0 these attributes have been removed. Hence, the code fails to execute.

Possible workaround would be (runs using SciPy 0.19 and 1.0):

            from scipy.signal import tf2ss
            A, B, C, D = tf2ss(squeeze(sys.num), squeeze(sys.den))
            return StateSpace(A, B, C, D, sys.dt)

What do you think? Since many Windows user do not have Slycot available by default it would be nice to get this fixed.

Jan

Activity

  1. roryyorke commented on Nov 15, 2017

    @roryyorke
    Contributor

    This Scipy change is documented in the scipy 1.0 release notes (look for "scipy.signal.lti" in the linked section).

    As I recall, we've been getting deprecation warnings about this for a while, so I suppose it's hardly a surprise.

    It looks like 05d6bc5 (HEAD as of this writing) still has this bug.

    I can't easily test the fix: I can't get conda to find Scipy 1.0.

  2. murrayrm commented on Dec 23, 2017

    @murrayrm
    Member

    This fix has been implemented in PR #170. Changes were required in both statesp.py and xferfcn.py. In addition, there were some changes in the way that scalar types showed up that required some additional changes. See PR #170 comments for details.

  3. self-assigned this
    on Dec 23, 2017
  4. added this to the 0.8.0 milestone on Dec 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions