Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signal.ss2tf doesn't handle zero-order state-space models #5760

Closed
arvoelke opened this issue Jan 25, 2016 · 0 comments
Closed

signal.ss2tf doesn't handle zero-order state-space models #5760

arvoelke opened this issue Jan 25, 2016 · 0 comments
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.signal
Milestone

Comments

@arvoelke
Copy link

Take a scalar (zero-order) transfer function and map it to state-space:

tf = (2, 1)
ss = scipy.signal.tf2ss(*tf)
print ss

We get just a pass-through, as expected:

(array([], dtype=float64), array([], dtype=float64), array([], dtype=float64), array([ 2.]))

However, if we now try to map this back to a transfer function, we get an error due to the oddly shaped A, B, C matrices.

tf_check = scipy.signal.ss2tf(*ss)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-6-4db87808b9b6> in <module>()
      5 print ss
      6 
----> 7 scipy.signal.ss2tf(*ss)

c:\users\aaron\appdata\local\enthought\canopy\user\lib\site-packages\scipy\signal\ltisys.pyc in ss2tf(A, B, C, D, input)
    272 
    273     # Check consistency and make them all rank-2 arrays
--> 274     A, B, C, D = abcd_normalize(A, B, C, D)
    275 
    276     nout, nin = D.shape

c:\users\aaron\appdata\local\enthought\canopy\user\lib\site-packages\scipy\signal\ltisys.pyc in abcd_normalize(A, B, C, D)
    206 
    207     A, B, C, D = map(_none_to_empty_2d, (A, B, C, D))
--> 208     A = _restore(A, (p, p))
    209     B = _restore(B, (p, q))
    210     C = _restore(C, (r, p))

c:\users\aaron\appdata\local\enthought\canopy\user\lib\site-packages\scipy\signal\ltisys.pyc in _restore(M, shape)
    163     else:
    164         if M.shape != shape:
--> 165             raise ValueError("The input arrays have incompatible shapes.")
    166         return M
    167 

ValueError: The input arrays have incompatible shapes.
@rgommers rgommers added defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.signal labels Jan 31, 2016
@rgommers rgommers added this to the 0.18.0 milestone Feb 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.signal
Projects
None yet
Development

No branches or pull requests

2 participants