[SciPy-dev] typo in signal.kaiserord()

Travis Oliphant oliphant.travis at ieee.org
Tue Jan 24 17:00:51 EST 2006


iCy-fLaME wrote:

>kaiserord(ripple, width) in filter_design.py,
>
>----------------------------------------------------------
>beta = select([A>50, A>21],
>              [0.1102*(A-8.7), 0.5842*(A-21)**(0.4) + 0.07866*(A-21)],
>              0.0)
>----------------------------------------------------------
>
>=> 0.7866 should be 0.7886 instead
>
>  
>
Good catch...

>=====================================
>
>Also in my system at lest it complain about pi, ceil and select are not defined.
>        from scipy import select
>        from scipy import ceil
>        from scipy import pi
>will fix that.
>
>  
>
select was indeed missing in the transition to numpy but that should be 
all (pi is imported and ceil should be obtained from numpy.core.umath).

>but then:
>----------------------------------------------------------
>  
>
>>>>A = 20
>>>>beta = select([A>50, A>21], [0.1102*(A-8.7), 0.5842*(A-21)**(0.4)
>>>>        
>>>>
>+ 0.07886*(A-21)], 0.0)
>
>ValueError: negative number cannot be raised to a fractional power
>----------------------------------------------------------
>
>Looks like the else part is not performed correctly
>
>I fixed it with:
>----------------------------------------------------------
>    if A> 50:
>    	beta = 0.1102 * (A-8.7)
>    elif A>= 21:
>    	beta = (0.5842 * (A-21))**0.4 + 0.07886 * (A-21)
>    else:
>    	beta = 0
>----------------------------------------------------------
>
>  
>
Thanks again.  The select usage was intended to support array inputs and 
array outputs, but it doesn't work as advertised anyway and is 
documented only for scalar inputs, and so I used your simpler code.

-Travis




More information about the SciPy-Dev mailing list