# [SciPy-User] Signal to noise ratio

Ivo Maljevic ivo.maljevic@gmail....
Thu Mar 4 13:20:20 CST 2010

```Arieal,
I just did a quick search and found the same thing I told you on Matlab site
(i.e., narrowband filter):

http://www.mathworks.com/access/helpdesk/help/toolbox/signal/f4-1046.html

While it may be interesting to play with cuttoff frequencies and filter
order, it is quite useless from a practical point of view. To use a tool,
you need to understand what it does and what are its limitations. What you
are trying to do with the filter is almost the same as if you are trying to
find the mean value of the signal (hence the almost flat line). You
definitely do not need butterworth filter for that, just find the mean value
of the signal for such type of operation.

As for your order question, it basically determines how many past samples
are you using in the filtering operation. Maybe you can read this:

http://en.wikipedia.org/wiki/Digital_filter#Difference_equation

Cheers,
Ivo

On 4 March 2010 13:47, Ariel Rokem <arokem@berkeley.edu> wrote:

> Interesting. It does work with lower filter order. In fact, there is a
> range of values of filter order for which I get the warning, but also some
> result. This results looks slightly flatter than the result with filter
> order set to 6, but is not completely flat. What does the filter order do,
> intuitively?
>
> Thanks - Ariel
>
> On Thu, Mar 4, 2010 at 9:24 AM, Warren Weckesser <
> warren.weckesser@enthought.com> wrote:
>
>> Ariel Rokem wrote:
>> > Hi Warren,
>> >
>> > thanks for this example!
>> >
>> > I am getting the following error:
>> >
>> >
>> Library/Frameworks/Python.framework/Versions/6.0.0/lib/python2.6/site-packages/scipy/signal/filter_design.py:224:
>> > BadCoefficients: Badly conditionned filter coefficients (numerator):
>> > the results may be meaningless
>> >   "results may be meaningless", BadCoefficients)
>> >
>> > For any attempt to filter a low-pass below 12 Hz in this example (so -
>> > I don't get the plot you got - instead I get a flat line on the bottom
>> > subplot). Do you (or anyone?) have any idea why that is?
>> >
>>
>> Nils Wagner reported the same behavior a week or so ago, and I see the
>> same behavior now ("BadCoefficients" and a flat line in the last plot).
>> Try lowering the order of the Butterworth filter to order=6.
>>
>> Warren
>>
>>
>> > Cheers,
>> >
>> > Ariel
>> >
>> > On Wed, Feb 24, 2010 at 7:51 AM, Warren Weckesser
>> > <warren.weckesser@enthought.com
>> > <mailto:warren.weckesser@enthought.com>> wrote:
>> >
>> >     Nils Wagner wrote:
>> >     > Hi all,
>> >     >
>> >     > I have two questions concerning signal processing
>> >     >
>> >     > I have used scipy.stats.signaltonoise to compute the
>> >     > signal-to-noise ratio.
>> >     > The value is 0.0447.
>> >     > How can I judge it ?
>> >     >
>> >     > How can I filter out high frequencies using scipy ?
>> >     >
>> >
>> >     I posted an example low-pass filtering using 'butter' and
>> >     'lfilter' from
>> >     scipy.signal here:
>> >
>> >
>> http://mail.scipy.org/pipermail/scipy-user/2010-January/024032.html
>> >
>> >     Warren
>> >
>> >     > How can I eliminate noise from the signal ?
>> >     >
>> >     > Nils
>> >     > _______________________________________________
>> >     > SciPy-User mailing list
>> >     > SciPy-User@scipy.org <mailto:SciPy-User@scipy.org>
>> >     > http://mail.scipy.org/mailman/listinfo/scipy-user
>> >     >
>> >
>> >     _______________________________________________
>> >     SciPy-User mailing list
>> >     SciPy-User@scipy.org <mailto:SciPy-User@scipy.org>
>> >     http://mail.scipy.org/mailman/listinfo/scipy-user
>> >
>> >
>> >
>> >
>> > --
>> > Ariel Rokem
>> > Helen Wills Neuroscience Institute
>> > University of California, Berkeley
>> > http://argentum.ucbso.berkeley.edu/ariel
>> > ------------------------------------------------------------------------
>> >
>> > _______________________________________________
>> > 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
>>
>
>
>
> --
> Ariel Rokem
> Helen Wills Neuroscience Institute
> University of California, Berkeley
> http://argentum.ucbso.berkeley.edu/ariel
>
> _______________________________________________
> 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/20100304/e6ad6aca/attachment.html
```

More information about the SciPy-User mailing list