Offline EEG state space analysis (non-GUI version)
(For GUI version that supports online and offline analysis, see this repository)
Input files:
1) .smrx files (Spike2 file format)
2) or alternatively binary files (eg. mat files)
- A spectrum from the raw EEG signal is calculated using the Multitaper method. The resolution can be as low as 2 seconds per epoch (default).
- 3 dataframes will be saved. The multitaper spectrum, a smoothed version of the spectrum (nonlinear smoothing using a median filter to better preserve transitions), and a normalized spectrum (lowest quantile power in each bin is subtracted)
- 3 dataframes will be saved. The multitaper spectrum, a smoothed version of the spectrum (nonlinear smoothing using a median filter to better preserve transitions), and a normalized spectrum (lowest quantile power in each bin is subtracted)
- The data is then transformed into a low dimensional space using an LDA previously trained on data from multiple B6Jv animals
- Alternatively temporary state labels from a neural network can be generated and used to train a new LDA
- Alternatively temporary state labels from a neural network can be generated and used to train a new LDA
- A density based method of clustering is applied in low dimensional space to a subset of data. 4 states can be assigned (HTwake, LTwake, SWS, REM)
- These labels can be propagated to the rest of the recording using the K-Nearest neighbors algorithm
- Finally, outliers can be detected in the recording using DBSCAN and highlighted in the state dataframe before it gets saved
Installation instructions:
- Activate the appropriate Anaconda environment (Python version 3.8)
- You can install the latest version of setuptools using pip:
pip install --upgrade setuptools
- You can also install build using pip:
pip install --upgrade build
- Navigate to Project directory and run:
python -m build
- You can install dependencies by running:
pip install ./dist/oessa-0.0.1.tar.gz