Skip to content
Romesh Abeysuriya edited this page May 10, 2015 · 5 revisions

The minimal data required to use the fitting routine is a vector of frequencies and a vector of powers for the power spectral density. This is shown in fit_single.m.

For state tracking, the .mat data files are initially created using mcmc.import_raw_eeg. This computes a set of power spectra and performs artifact detection using mcmc.get_tfs. The code in mcmc.get_tfs operates on single electrodes, and mcmc.import_raw_eeg is able to iterate over multiple electrodes. This also means that a structural change will be required to perform artifact rejection using data from multiple electrodes, but this may be better implemented in a new function.

These .mat files are loaded for fitting using mcmc.load_subject_data. This function detects sleep onset and truncates the start of the recordings, and also supports selecting only a subset of the electrodes.

Contaminated 4s spectra are automatically excluded by get_tfs and are therefore not seen by later stages of processing - in fact, the 4s spectra are created in get_tfs but are only used internally and never returned. However, the 30s spectra are always produced, unless there are more than 26 consecutive rejected 4s spectra. The number of clean spectra contributing to each 30s spectrum is recorded in the nspec variable. It is up to the fitting wrapper e.g., fit_cluster.m to decide how to handle these spectra.

If there ever is a run of more than 30s of contaminated 4s spectra, a sensible strategy would probably be to return an array of NaNs as the spectrum. When the MCMC routine is then run, it will return NaN for chisq, the same as if the parameters were not allowed. As before, it would be up to the fit wrapper e.g. fit_cluster.m to decide what to do if an NaN spectrum is encountered.

Clone this wiki locally