1

I have an intensity v/s velocity spectrum and my aim is to find the RMS noise in the spectrum excluding the channels where the peak is present.

So, after some research, I came to know that RMS noise is the same as the standard deviation of the spectrum and the signal-to-noise ratio of the signal is the average of the signal divided by the same standard deviation. Can anybody please tell me if I am wrong here?

This is how I coded it in python

def Average(data):
    return sum(data) / len(data)
average = Average(data)
print("Average of the list =", average)
standardDev = data.std()
print('The standard deviation is',standardDev)
SNR = average/standardDev
print('SNR = ',SNR)

My original data points are:

x-axis(velocity) :

 [-5.99999993e+04 -4.99999993e+04 -3.99999993e+04 -2.99999993e+04
 -1.99999993e+04 -9.99999934e+03  6.65010004e-04  1.00000007e+04
  2.00000007e+04  3.00000007e+04  4.00000007e+04  5.00000007e+04
  6.00000007e+04  7.00000007e+04  8.00000007e+04  9.00000007e+04
  1.00000001e+05  1.10000001e+05  1.20000001e+05  1.30000001e+05
  1.40000001e+05]

y-axis (data):

 [ 0.00056511 -0.00098584 -0.00325616 -0.00101042  0.00168894 -0.00097406
 -0.00134408  0.00128847 -0.00111633 -0.00151621  0.00299326  0.00916455
  0.00960554  0.00317363  0.00311124 -0.00080881  0.00215932  0.00596419
 -0.00192256 -0.00190138 -0.00013216]

If I want to measure the standard deviation excluding the channels where the line is present, should I exclude values from y[10] to y[14] and then calculate the standard deviation?

Lidia
  • 27
  • 5

1 Answers1

1
  1. Yes, since you are to determine some properties of the noise, you should exclude the points that do not constitute the noise. If these are points number 10 to 14 - exclude them.
  2. Then you compute the average of the remaining y-values (intensity). However, from your data and the fitting function, a * exp(-(x-c)**2 / w), one might infer that the theoretical value of this mean value is just zero. If so, the average is only a means of validating your experiment / theory ("we've obtained almost zero, as expected) and use 0 as the true average value. Then, the noise level would amount to the square root of the second moment, E(Y^2).
  3. You should compare the stddev from your code with the square root of the second moment, they should be similar to each other, so similar, that it should not matter which of them you'll chose as the noise value.
  4. The part with SNR, signal to noise ratio, is wrong in your derivation. The signal is the signal, that is - it is the amplitude of the Gaussian obtained from the fit. You divide it by the noise level (either the square root of the second moment, or stddev). To my eye, you should obtain a value between 2 and about 10.
  5. Finally, remember that this is a public forum and that some people read it and may be puzzled by the question & answer: both are based on the previous question Fitting data to a gaussian profile which should've been referred to in the question itself.
  6. If this is a university assignment and you work on real experimental data, remember the purpose. Imagine yourself as a scientist who is to convince others that this a real signal, say, from the Aliens, not just an erratic result of the Mother Nature tossing dice at random. That's the primary purpose of the signal to noise ratio.
zkoza
  • 2,644
  • 3
  • 16
  • 24
  • Thank you for addressing my question. The value of SNR I obtained is around 4.6, which is in agreement with your prediction. May I ask why we are taking the amplitude of the Gaussian obtained from the fit and not the highest point from the raw data? – Lidia Apr 18 '21 at 03:36
  • 1
    1. Draw a Gaussian. Then take 5 points on it at random. A chance that by taking that largest value you'll obtain the peak of the Gaussian is quite slim. For this reason the value from the fit is better. – zkoza Apr 18 '21 at 11:42
  • 1
    2. All data are "biased"/"sc...ewd" (I don't know a proper English word for it) by the noise, which may be also called measurment uncertainty. By taking the value from the fit, you smooth this effect out. Another example: if there is no signal and you see only the noise, the fit will give you y = 0 or y = "very small value" - which is a very good prediction for the signal (which is absent). – zkoza Apr 18 '21 at 11:45
  • Could you please give any hint on this question? It would be a great help. https://stackoverflow.com/questions/67682810/mean-spectra-over-multiple-pixels-from-datacube – Lidia May 25 '21 at 06:53