[SciPy-User] [SciPy-user] help about lfilter ????

josef.pktd@gmai... josef.pktd@gmai...
Thu Jan 28 19:20:36 CST 2010


On Thu, Jan 28, 2010 at 8:14 PM, David Cournapeau <cournape@gmail.com> wrote:
> On Fri, Jan 29, 2010 at 10:10 AM,  <josef.pktd@gmail.com> wrote:
>> On Thu, Jan 28, 2010 at 7:51 PM, persia <m.abdollahi@gmail.com> wrote:
>>>
>>> lfilter is the linear filtering function in the scipy.signal module. can
>>> someone tell me what is wrong with this function please ?
>>>
>>> I used this function in the following way and it gave me that error !! :
>>>
>>> In [204]:
>>> lfilter(array([1,2,3]),array([-4,5,6]),array([9,8,7,6,5,4,3,2,1]),zi=array([0,0]))
>>> ---------------------------------------------------------------------------
>>> <type 'exceptions.ValueError'>            Traceback (most recent call last)
>>>
>>>
>>>
>>> <type 'exceptions.ValueError'>: linear_filter not available for this type
>>>
>>>
>>> why is it so ??!!!! what is wrong with this "type " ? what is it meant by
>>> this type anyway ?! i tried with the same arguments in matlab with the
>>> corresponding function and it worked !!
>>> and if i multiply the second argument vector say by .4, this will happen :
>>>
>>> lfilter(array([1,2,3]),.4*array([-4,5,6]),array([9,8,7,6,5,4,3,2,1]),zi=array([0,0]))
>>>
>>>
>>> (array([   -5.625     ,   -23.28125   ,   -68.7890625 ,  -148.40820312,
>>>        -312.44384766,  -633.16711426, -1276.37466431, -2557.71900177,
>>>       -5120.46074867]),
>>>  array([-10242.1544385 ,  -7682.56612301]))
>>>
>>>
>>> see ? no problem then ?!! isnt this wierd ? please help !
>>
>> it looks like lfilter doesn't like integers
>
> Yes - the error message could be improved at least.
>
> Integers are not supported as is because the difference equation
> requires division (for IIR). I wonder whether it would make sense to
> automatically convert to floating point if everything is integer.

Yes, I would think so, if it doesn't work or doesn't make sense with
integers than automatic conversion is the best in these cases, e.g.
fftconvolve, np.mean, ...

Josef

>
> cheers,
>
> David
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>


More information about the SciPy-User mailing list