Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about SNR definition #2832

Closed
ZoeChen96 opened this issue May 12, 2024 · 7 comments
Closed

Question about SNR definition #2832

ZoeChen96 opened this issue May 12, 2024 · 7 comments
Labels
qualitymetrics Related to qualitymetrics module question General question regarding SI

Comments

@ZoeChen96
Copy link

ZoeChen96 commented May 12, 2024

Hello,

I am reading your papers of SpikeInterface and SpikeForest and have a question about SNR definition. I have a MEArec dataset , where the noise is 10uVrms and the spike amplitude from 40uV to 300uV. How can I calculate the SNR range for the dataset?

I see there is a definition in SpikeForest paper:
image

where it mentions that a filter should applied and then the average amplitude divided by the estimated std, which is calculated as (MAD/0.6745).

Can I just use the amplitude divided by noise std value (as I already know from MEArec) to calculate the SNR range? For example in the aforementioned MEArec dataset, the SNR range would be (4-30), which is (0.60dB-1,48dB)
Why is the weird filter needed?

@samuelgarcia
Copy link
Member

Hi.
For spikeforest I do not remember @magland could answer this.

For spikeinterface, you can use the compute_quality_metrics(analyzer, metrics_names=["snr"])

Internally,it devides the peak amplitude on the max channel by the noise with the formula you mention (MAD/0.6745).

@zm711 zm711 added question General question regarding SI qualitymetrics Related to qualitymetrics module labels May 13, 2024
@magland
Copy link
Member

magland commented May 13, 2024

That is just one example of a filter one could use. We just wanted to be detailed in reporting what was actually done. SNR doesn't need to be estimated in that way. You could use your own filter.

@ZoeChen96
Copy link
Author

Hi Magland and Samuel, thanks for the reply! I have two more follow-up questions:

  1. Can I calculate SNR without filtering? I think we do the filtering, the SNR will increase, as noise is filtered more than signal.
  2. What is the 'peak amplitude'? Is it a peak to peak value, or just single-end (for example the waveform is from -100 to 10, then the signal amplitude is 100 or 110?
    Thanks a lot!

@samuelgarcia
Copy link
Member

  1. Can I calculate SNR without filtering? I think we do the filtering, the SNR will increase, as noise is filtered more than signal.

On a full band signal the noise level has really a different interpretation! But the amplitude of the peak should be similar.
So the final result should change.

  1. What is the 'peak amplitude'? Is it a peak to peak value, or just single-end (for example the waveform is from -100 to 10, then the signal amplitude is 100 or 110?

In spikeinterface this is single end. So 100.
Alessio was planning to add an option to have both cases but never did it.

@ZoeChen96
Copy link
Author

ZoeChen96 commented May 14, 2024

On a full band signal the noise level has really a different interpretation! But the amplitude of the peak should be similar. So the final result should change.

Yes. this is also what I think. That means the filters chosen will influence the SNR calculation.
So can we do SNR calculation without filtering, to ensure the noise is not suppressed? Or, do you suggest to do a filtering before calculating SNR?

@magland
Copy link
Member

magland commented May 14, 2024

@ZoeChen96 You need to at least do a high-pass filter (to remove low frequencies)... otherwise the signal maximum (peak amplitude) will be meaningless and the std dev calculation will also not be correct. Whatever you decide for a filter, you should report it.

@ZoeChen96
Copy link
Author

Hi Magland, thanks for the reply! That's clear now. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
qualitymetrics Related to qualitymetrics module question General question regarding SI
Projects
None yet
Development

No branches or pull requests

4 participants