yasa icon indicating copy to clipboard operation
yasa copied to clipboard

Spindle amplitude is calculated on raw instead of bandpassed data

Open bstucky opened this issue 8 months ago • 1 comments

In the documentation of the spindles_detect function it states that the peak-to-peak amplitude of the (detrended) spindle is calculated in the raw data (in µV).

We were wondering if it would not make more sense to calculate the peak-to-peak amplitude in the bandpassed (spindle range) data?

In our data we found that we get very high amplitudes from YASA, where the mean or median spindle amplitude is considerably higher than the observed spindle amplitudes in the general population ( https://www.nature.com/articles/ncomms15930 ). This might be due to effects like the amplitude of a co-occurring slow wave overlaying the spindle amplitude in the raw data.

In any case, it would be great to have the option for the amplitude to be calculated on the bandbassed data.

Thank you very much for your help and for creating the easy to use YASA toolbox.

bstucky avatar Apr 29 '25 07:04 bstucky

Hi @bstucky,

The documentation is not entirely correct. The amplitude is calculated on the 1-30Hz bandpass-filtered and detrended spindle:

https://github.com/raphaelvallat/yasa/blob/f76f63541ae1dc10e645cdb9be9fa4b0f5eadda5/src/yasa/detection.py#L953-L956

I think we can easily add a new column with the amplitude in the sigma-filtered data, e.g. AmplitudeFiltered.

I'll try to add this in the next release. Thanks

raphaelvallat avatar May 02 '25 14:05 raphaelvallat