[SciPy-User] firwin behavior

Warren Weckesser warren.weckesser@enthought....
Sat Aug 13 13:12:00 CDT 2011


On Thu, Aug 11, 2011 at 6:36 AM, Jeff Alstott <jeffalstott@gmail.com> wrote:

> Wow. The passing of the DC frequency is exactly the issue, and that default
> behavior is clearly shown in the documentation. I see now that given a band,
> the default behavior is band-stop, whereas I would expect it to be
> band-pass. So, that fixed it.
>
> What I don't understand, however, is *why* that would be default behavior.
> More importantly, even if that is the default behavior, the name of the
> pass_zero flag does not readily help a dumb user like me grok the
> functionality. Has there been any thought to renaming it?
>



See here for the evolution of the firwin API:
    http://projects.scipy.org/scipy/ticket/902

Warren



>
> Thanks!
>
>
> On Wed, Aug 10, 2011 at 4:39 PM, Warren Weckesser <
> warren.weckesser@enthought.com> wrote:
>
>> On Wed, Aug 10, 2011 at 8:14 AM, Jeff Alstott <jeffalstott@gmail.com>
>> wrote:
>> > firwin is producing unreasonable filters for me, and I'm not sure if I'm
>> > misusing the code or if there is a bug. Like so:
>> >
>> > In [5]: from scipy.signal import firwin
>> >
>> > In [6]: ny = 500
>> >
>> > In [7]: f21f80= firwin(21, [1/ny, 80/ny]); plot(f21f80);
>> > savefig('FIR21_filter80.png')
>> >
>> > Produces the attached file.
>> >
>> > In contrast, Matlab:
>> >
>> > Trial>> ny = 500
>> >
>> > ny =
>> >
>> >    500
>> >
>> > Trial>> [f20f80] = fir1(20, [1/ny, 80/ny]); figure; plot(f20f80)
>> >
>> > Produces the other attached file. Quite different! The filter produced
>> by
>> > the scipy function, if used with lfilter (or if taken to Matlab to use
>> as a
>> > filter), produces a nonsense filtering, with many high frequency
>> artifacts.
>> >
>> > Any thoughts? This is in python3, if that matters.
>>
>>
>> By default, firwin creates a filter that passes DC (i.e. the zero
>> frequency).  To get a filter like the one produced by matlab, add the
>> keyword argument pass_zero=False.
>>
>> Warren
>>
>>
>> >
>> > Thanks!
>> >
>> >
>> >
>> > _______________________________________________
>> > SciPy-User mailing list
>> > SciPy-User@scipy.org
>> > http://mail.scipy.org/mailman/listinfo/scipy-user
>> >
>> >
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20110813/7836d02b/attachment.html 


More information about the SciPy-User mailing list