# [SciPy-User] Signal to noise ratio

josef.pktd@gmai... josef.pktd@gmai...
Wed Feb 24 10:30:33 CST 2010

```On Wed, Feb 24, 2010 at 10:47 AM, Ivo Maljevic <ivo.maljevic@gmail.com> wrote:
> Josef,
> Just to add, while one can define the "statistical SNR" as something else
> (that is, ratio E[s]/sigma_noise), what would be its used for? Astronomical
> optics?

I never use it, so I don't know.

>
> On the other hand, it doesn't really matter how it is defined in
> scipy.stats. Calculation of SNR is usually a bit more involved (you need to
> find the actual signal mean, and the noise variance), and I guess whoever
> needs to calculate the power based SNR will not call that function by
> mistake.

I was only referring to the original question that used
scipy.stats.signaltonoise

It only has a meaning if the level is well defined. If I demean the
observations first, then signaltonoise is infinite. If the level is my
annual salary, then stats.signaltonoise is essentially the inverse of
the coefficient of variation, stats.variation.

I'm just looking up definitions, not arguing about the appropriate
definitions and it's usefulness in different fields.

Cheers,

Josef

>
> Ivo
>
> On 24 February 2010 10:23, <josef.pktd@gmail.com> wrote:
>>
>> On Wed, Feb 24, 2010 at 10:16 AM, Ivo Maljevic <ivo.maljevic@gmail.com>
>> wrote:
>> > One would think that you can always rely on wikipedia when it comes to
>> > math
>> > and engineering, but it seems that is not tha case.
>> > Josef, In the page you referenced, the SNR, or signal to noise ratio, is
>> > defined as the ratio between the signal and noise powers. Consequently,
>> > in
>> > terms of signals and standard deviations, it is defined as a ratio of
>> > the
>> > average signal power and the noise variance (NOT its squre root, or
>> > standard
>> > deviation). Or:
>> >
>> > SNR = P_s / sigma^2
>> >
>> > where P_s is the average signal power, and the noise variance is used to
>> > measure the noise power. The assumption here is that the noise is a zero
>> > mean process, otherwise variance and power wouldn't be the same thing.
>>
>> Note: I linked to #Statistical_definition not the top of the wikipedia
>> page
>> and I checked the source in scipy.stats:
>>    Calculates the signal-to-noise ratio, defined as the ratio between the
>> mean
>>    and the standard deviation.
>>
>>    m = np.mean(a, axis)
>>    sd = samplestd(a, axis)
>>    return np.where(sd == 0, 0, m/sd)
>>
>> I didn't know about the different definitions until I read the
>> Wikipedia page, but that's what's currently in scipy.stats
>>
>> Josef
>>
>> >
>> > Nils, your question is way too generic for anyone to help you directly.
>> > I
>> > can only point to you that your signal to noise ratio is quite low:
>> >
>> >>>> 10*math.log10(0.0447)
>> > -13.496924768680636
>> >
>> > Maybe your signal is to narrow compared to the overal band you are
>> > working
>> > with (or you have DS spread spectrum signal?).
>> > Anyway, you will need to figure out which filter you want to use (e.g.,
>> > butterworth for maximally flat characteristic in the passband, etc).
>> >
>> >
>> > On 24 February 2010 09:33, <josef.pktd@gmail.com> wrote:
>> >>
>> >> On Wed, Feb 24, 2010 at 8:12 AM, Nils Wagner
>> >> <nwagner@iam.uni-stuttgart.de> 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 ?
>> >>
>> >> It's just mean over standard deviation
>> >>
>> >> http://en.wikipedia.org/wiki/Signal-to-noise_ratio#Statistical_definition
>> >>
>> >> I never use it, but the interpretation will depend on what your
>> >> level/mean/expected_value means.
>> >>
>> >> >
>> >> > How can I filter out high frequencies using scipy ?
>> >> > How can I eliminate noise from the signal ?
>> >>
>> >> (I'm no help here) There are many prefabricated filters in
>> >> scipy.signal, but I only use lfilter.
>> >>
>> >> Josef
>> >>
>> >> >
>> >> > Nils
>> >> > _______________________________________________
>> >> > 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
>> >
>> >
>> _______________________________________________
>> 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
>
>
```

More information about the SciPy-User mailing list