# [SciPy-User] Signal to noise ratio

Ivo Maljevic ivo.maljevic@gmail....
Wed Feb 24 09:47:00 CST 2010

```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?

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.

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.
>
> 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
>
> Josef
>
> >
> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...