raphaelvallat/yasa

How do you normalize sleep spindles?

apoorva6262 opened this issue · 5 comments

@raphaelvallat ,

How do you normalize sleep spindles in yasa? I read in one paper " each time-point is scaled by the number of data points contributing to that mean". Is there a way to do that on yasa or is there another method ?

Thanks!

Hi @apoorva6262,

I am not sure I understand the quote from the paper either. Can you please add more context? Do you wish to normalize the amplitude of the spindles?

Thanks
Raphael

Yeah , the latter- to normalize amplitudes of spindles .

Also, is there a way to detect/measure K- complexes?

@apoorva6262

Also, is there a way to detect/measure K- complexes?

A K-complex is very much like a slow wave that occurs in isolation during N2 sleep, so you can tweak the yasa.sw_detect function to only apply it on N2 sleep (using the hypno and include arguments), and then if needed do some postprocessing to remove slow-waves that occur in clusters.

Yeah , the latter- to normalize amplitudes of spindles .

Hmm, so you can z-score the amplitude of the spindles after the detection. Something like:

from scipy.stats import zscore
sp = yasa.spindles_detection(...)
df_spindles = sp.summary()
df_spindles["Amplitude_Z"] = zscore(df_spindles["Amplitude"])

Although it is probably more appropriate to do the z-scoring on a per-channel / per-stage basis (using pandas.Groupy.transform for example)

Hope this helps
Raphael

Thanks! that's helpful.