SNR in calculation in `add_noise_evoked` might be incorrect
See original GitHub issueI’m trying to see how the data is scaled to achieve a given SNR in add_noise_evoked
in mne-python/mne/simulation/evoked.py, but do not really get it.
The SNR in this function is defined as the standard SNR in dB, which is:
SNR = 10 * log10 [ var(signal) / var(noise) ]
The piece of code that should do this is:
tmp = 10 * np.log10(np.mean((evoked.data[:, tmask] ** 2).ravel()) / np.mean((noise.data ** 2).ravel()))
noise.data = 10 ** ((tmp - float(snr)) / 20) * noise.data
However, I am think that it should be instead:
tmp = np.log10(np.mean((evoked.data[:, tmask] ** 2).ravel()) / np.mean((noise.data ** 2).ravel()))
noise.data = 10 ** (tmp - float(snr) / 10) * noise.data
Is this a bug, or am I missing something?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
snr - Incorrect signal-to-noise ratio estimation
In this case the OP has a signal, and alone and is incorrectly using ... How can I find SNR, PEAQ, and ODG...
Read more >SNR calculation wrong by 3 dB? - Custom IC Design
My calculation of SNR over a 100kHz bandwidth gives: rms of signal = 0.707V, and rms of noise = sqrt(4*kT*R*100k) = 12.87uV.
Read more >signal-to-noise ratio (S/N or SNR) - TechTarget
Signal-to-noise ratio measures the strength of a desired signal relative to background noise. Learn to calculate it and the disturbances that can cause...
Read more >Signal-to-Noise (SNR) and Uncertainty Estimates
As simple as this may sound, error estimate is quite complicated. ... If the region contains more than one peak, the SNR calculated...
Read more >Signal-to-noise ratio - Wikipedia
SNR is defined as the ratio of signal power to the noise power, often expressed in decibels. A ratio higher than 1:1 (greater...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Should I go ahead and fix this?
lol 😃
yes please just add a test but don’t update what’s new
thx