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

VARMA, MOHITH MUKUND mohith96 at connect.hku.hk
Wed Feb 20 19:44:50 PST 2019

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



Thanks in advance for your help!


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20190221/60ec2799/attachment.html>

More information about the eeglablist mailing list