[Eeglablist] Root mean square (rmsave) to calculate sleep spindle power from the EEG dataset

Arnaud Delorme arno at ucsd.edu
Fri Feb 22 09:44:08 PST 2019


Dear Mo,

The function rmsave will not compute a moving average.
Try downloading the following plugin to detect spindles and place it in the EEGLAB plugin folder

https://github.com/arnodelorme/detectevent

When plotting the data, you can decide to plot event durations (menu Display > Plot event duration)

Best wishes,

Arno

> On Feb 20, 2019, at 7:44 PM, VARMA, MOHITH MUKUND <mohith96 at connect.hku.hk> wrote:
> 
> Dear all,
> 
> I am trying to extract the sleep spindle power from my nap EEG datasets and I am trying to adopt the methodology adopted by Antony and colleagues (2018) in the Current Biology paper on sleep spindle refractoriness. Their method of detecting spindles in the raw EEG data and the subsequent power analysis involves computing the root mean square (RMS) at each time point on a specific channel using a moving window of +/- 0.2 sec. I am using the rmsave function on EEGLAB to compute the RMS at each time point on a channel, however I am not able to implement the moving window criteria into my RMS calculation. Your help in debugging this problem is very much appreciated. Following is the code snippet:
> 
> EEG = pop_biosig(['ub' subject 'scored.edf']);
>         
> EEG.setname = [subject '_bsd'];
>         
> EEG  = pop_basicfilter( EEG,  1:8 , 'Boundary', 'boundary', 'Cutoff', [ 11 16], 'Design', 'butter', 'Filter', 'bandpass', 'Order',  2 ); %filter the dataset within 11-16 Hz
>         
> averms = rmsave(EEG.data, 400); %calculate RMS score for each channel
>         
> trans = transpose(averms);
> 
> After I have calculated the RMS scores for each channel separately, I want to calculate the spindle threshold criteria by multiplying the standard deviation of the entire channel signal (in RMS) to 1.5. I think I did this part correctly. However, in order to detect a sleep spindle I have a criteria which is that any RMS score that is above the threshold consecutively for 0.5 to 3 seconds will be considered as a spindle. I am having difficulty in implementing the IF condition for this part along with calculating the onset and offset for each detected spindle. Following is the remainder code that I have come up with so far:
> 
> threshold = std(trans).* 1.5;
>         
> for s=1:trans(: , 1)
> 
> if s > threshold & %time condition for RMS scores being 0.5 to 3 seconds
> 
> %here the variable to store each spindle without replacing the previous detected one.
> 
> %onset and offset time for the spindle along with its mean frequency and positive/negative peaks
> 
> end;
> 
> end;
> 
> Thanks in advance for your help!
> 
> Regards,
> 
> -- 
> Mohith M. Varma (Mo)
> Graduate Research Assistant
> 
> Social & Cognitive Neuroscience Laboratory
> Department of Psychology
> Faculty of Social Sciences
> The University of Hong Kong
> Tel: (+852) 52622875
> Email: mohith96 at connect.hku.hk
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu




More information about the eeglablist mailing list