Spindle-Detector-Method
This repository contains the spindle detector method used in Kramer MA, Stoyell SM, Chinappen D, Ostrowski LM, Spencer ER, Morgan AK, Emerton BC, Jing J, Westover MB, Eden UT, Stickgold R, Manoach DS, Chu CJ Focal Sleep Spindle Deficits Reveal Focal Thalamocortical Dysfunction and Predict Cognitive Deficits in Sleep Activated Developmental Epilepsy. The Journal of Neuroscience 41, no. 8 (February 24, 2021): 1816–29.
Versions
-
The branch
master
contains the most up-to-date, working version of the spinlde detector. -
For the original method applied in 2021 publication, see this branch
j-neurosci-2021-publication-code
.
Basic use
The latent state (LS) detector runs in two steps:
spindle_prob = LSM_spindle_probabilities(d, hdr);
spindle_det = LSM_spindle_detections(spindle_prob);
where
d
= the data, [channels x time points]
hdr
= structure that must have:
hdr.info.sfreq
= sampling frequency (Hz).
hdr.info.ch_names
= cell of channel names.
Step (1) is slow, step (2) is fast.
Advanced use
For narrowband analysis, include a third input to LSM_spindle_probabilities
:
spindle_prob = LSM_spindle_probabilities(data, hdr, options)
where
options.StartFrequency
= low frequency for narrowband analysis [Hz].
options.StopFrequency
= high frequency for narrowband analysis [Hz].
Both options must be specified. For example, to focus analysis on 9-12 Hz,
options = []
options.StartFrequency = 9;
options.StopFrequency = 12;
spindle_prob = LSM_spindle_probabilities(data, hdr, options)
To visualize spindles
LSM_spindle_visualizer(data, hdr, spindle_det, channel)
Are your data in microvolts?
)
When the code warns (If the code produces the warning:
Are your data in microvolts? If not, set options.MinPeakProminence
Then consider adding a third input to LSM_spindle_probabilities
:
spindle_prob = LSM_spindle_probabilities(data, hdr, options)
where options.MinPeakProminence
is a number indicating how much the peak must "stand out" to be identified. See here.
The code will run, but results might be meaningless.