[Scipy-tickets] [SciPy] #1448: signal.abcd_normalize doesn't handle missing arrays as expected

SciPy Trac scipy-tickets@scipy....
Thu May 26 22:33:43 CDT 2011


#1448: signal.abcd_normalize doesn't handle missing arrays as expected
------------------------------+---------------------------------------------
 Reporter:  warren.weckesser  |       Owner:  somebody
     Type:  defect            |      Status:  new     
 Priority:  normal            |   Milestone:  0.10.0  
Component:  scipy.signal      |     Version:  0.9.0   
 Keywords:  abcd_normalize    |  
------------------------------+---------------------------------------------
 The function scipy.signal.abcd_normalize has the signature

     def abcd_normalize(A=None, B=None, C=None, D=None):

 and after reading the source, it appears that one intent of the function
 is to create an appropriately sized array of zeros for any array that is
 not give, if the size of the missing array can be inferred from the
 others.  However, this feature is broken:
 {{{
 In [21]: a = [[1.0, 2.0], [3.0, 4.0]]

 In [22]: b = [[-1.0], [5.0]]

 In [23]: c = [[4.0, 5.0]]

 In [24]: d = [[2.5]]

 In [25]: abcd_normalize(A=a, B=b, C=c)   # Expect fourth array to be
 [[0.0]]
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)

 /Users/warren/<ipython console> in <module>()

 /Users/warren/local_tmp/lib/python2.7/site-
 packages/scipy/signal/ltisys.pyc in abcd_normalize(A, B, C, D)
     120         raise ValueError("C and D must have the same number of
 rows.")
     121     if ND != NB:
 --> 122         raise ValueError("B and D must have the same number of
 columns.")
     123
     124     return A, B, C, D

 ValueError: B and D must have the same number of columns.

 In [26]: abcd_normalize(A=a, B=b, D=d)   # Expect third array to be [[0.0,
 0.0]]
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)

 /Users/warren/<ipython console> in <module>()

 /Users/warren/local_tmp/lib/python2.7/site-
 packages/scipy/signal/ltisys.pyc in abcd_normalize(A, B, C, D)
     116         raise ValueError("A and B must have the same number of
 rows.")
     117     if NA != NC:
 --> 118         raise ValueError("A and C must have the same number of
 columns.")
     119     if MD != MC:
     120         raise ValueError("C and D must have the same number of
 rows.")

 ValueError: A and C must have the same number of columns.

 In [27]: abcd_normalize(A=a, C=c, D=d)   # Expect second array to be
 [[0.0], [0.0]]
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)

 /Users/warren/<ipython console> in <module>()

 /Users/warren/local_tmp/lib/python2.7/site-
 packages/scipy/signal/ltisys.pyc in abcd_normalize(A, B, C, D)
     114         raise ValueError("A must be square.")
     115     if MA != MB:
 --> 116         raise ValueError("A and B must have the same number of
 rows.")
     117     if NA != NC:
     118         raise ValueError("A and C must have the same number of
 columns.")

 ValueError: A and B must have the same number of rows.

 In [28]: abcd_normalize(B=b, C=c, D=d)   # Expect first array to be [[0.0,
 0.0], [0.0, 0.0]]
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)

 /Users/warren/<ipython console> in <module>()

 /Users/warren/local_tmp/lib/python2.7/site-
 packages/scipy/signal/ltisys.pyc in abcd_normalize(A, B, C, D)
     112
     113     if MA != NA:
 --> 114         raise ValueError("A must be square.")
     115     if MA != MB:
     116         raise ValueError("A and B must have the same number of
 rows.")

 ValueError: A must be square.
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1448>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list