Extracting manually identified events for further analysis

Hello Brainstorm,

My research focus is on sleep spindles and I've been visually identifying sleep spindles in my nap data using 15 EEG, 2 EOG, and 3 EMG channels (second figure below). The identified spindles were marked as events using the Brainstorm markers as shown below.

The goal of my research is to characterize the following sleep spindle parameters: duration, frequency, amplitude, degree of symmetry and density. In order for me to characterise these parameters I would need to somehow isolate only the already-identified spindles and their corresponding stage 2 sleep epochs.

Specifically, I now need a way to extract both stage 2 sleep epochs (also marked as separate events; 30-sec epochs) and identified sleep spindles (separate events; coloured in black) from the EEG (across all channels and over the entire duration of the recording) for further analysis. Preferably I would like if the extracted data could be viewed as a continuous recording.

It would be great if this kind of extraction is possible but if it's not I welcome any other thoughts that you might have.

I mention the below post that I've written a few days ago to give more background of what my research interests are.

Is your question how to combine the two types of events so that Brainstorm creates a new category of events that correspond to spindles occurring during Stage 2 segments?

Once you have marked all the events as SleepSpindle and Stage2 in your raw file, proceed to import them, as in the Epoching tutorial

  • Select both events they will have the [ext] indicator as they are extended events. You may want to create a separate folder for each.

Once imported, select all the instances of your events and use the process **Standardize > Concatenate time.

:warning: When the epoch are imported the event that was used is removed from the recording. Thus, to keep the information of the event that was used to create the epoch, duplicate the event group before import in database. If this is not done, once the epochs are concatenated, the division between epochs is not obvious.

@Sylvain Yes I was looking for a way to combine two events (which in this case were sleep spindles and stage2 sleep) to generate a new category of events that contains both spindles and stage2 epochs.
After trialling it out it seems that the method provided by @Raymundo.Cassani is capable of achieving this purpose - thank you for your input.

I now would like your thoughts on the below.
Here I list the 5 parameters (diagram shown below) that I am interested in from the sleep spindles and how I am planning on extracting the parameters. I would like to ask for your ideas/suggestions on how to make the below process efficient and streamlined.

Definition = the time taken for the start and the end of the sleep spindle.
Proposed Extraction method = use event export which will contain the duration of all identified sleep spindles in the forms of events (as shown below).

Definition = the frequency of a single sleep spindle (number of oscillations per unit time)
Proposed Extraction method = manually count (visually count) the cycle number and divide this by duration. (i.e. cycle number / duration).
I can see that this method will be quite laborious and was wondering if you have any better ideas?

Definition = maximum peak-to-peak amplitude of a single sleep spindle.
Proposed Extraction method = highlight the sleep spindle from the raw recording and manually note down the minimum and maximum voltage values and calculate the peak-to-peak amplitude.
If you have any better ideas please let me know.

Degree of symmetry
Definition = location of the maximum peak-to-peak amplitude relative to the length of the spindle.
Proposed Extraction method = use process "find max amplitude > latency at the peak" on the epoched sleep spindles to calculate the timing at the peak and divide this by the duration calculated above.

Definition = number of spindles per minute.
Proposed Extraction method = compile all stage 2 epochs by extracting method proposed by Raymundo, calculate the duration of the entire stage 2 into minutes, and divide the number of spindles by the number of minutes of stage 2 sleep.

Any thoughts or comments on how to best extract these 5 parameters would be highly appreciated!

A good plan would be read the data from each of the imported spindle instances (trials), and compute the features for each one of the instances.

Just the duration of the imported trial.

What about removing the DC component from the epoch, count the number of zero-crossings, divide the count by two and divide over the duration.

Once the data is imported, find the difference between the maximum and minimum values. You may want to detrend the data.

This is straight forward as the previous metric was the peak-to-peak amplitude, and the duration is known.

Sounds good.