sleepeegpy is a high-level package built on top of MNE-python, yasa, PyPREP and specparam (fooof) for preprocessing, analysis, and visualization of sleep EEG data.
The repository also includes a Jupyter notebook that demonstrates how to use this package and provides a ready-made workflow for common use cases.
- Python Version: Ensure you have Python version >3.9 and <3.12 installed.
- Create a Python Virtual Environment: Create a Python virtual environment. For more information you can refer to python venv, virtualenv or conda.
- Activate the Environment
- Install sleepeegpy:
pip install sleepeegpy
- Download notebooks: Download this repository zip folder, you will need only the notebooks folder.
- Navigate to the Pipeline Notebooks folder and run Jupyter.
jupyter notebook
- Open the complete_pipeline notebook using Jupyter Notebook within the activated environment and follow the instructions.
For overnight, high-density (256 channels) EEG recordings downsampled to 250 Hz expect at least 64 GB RAM expenditure for cleaning, spectral analyses, and event detection.
odie = pooch.create(
path=pooch.os_cache("sleepeegpy_dataset"),
base_url="doi:10.5281/zenodo.10362189",
)
odie.load_registry_from_doi()
bad_channels = odie.fetch("nap_bad_channels.txt")
annotations = odie.fetch("nap_annotations.txt")
path_to_eeg = odie.fetch("nap_resampled_raw.fif", progressbar=True)
hypnogram_path = odie.fetch("nap_staging.txt", progressbar=True)
- Belonosov, G., Falach, R., Schmidig, J.F., Aderka, M., Zhelezniakov, V., Shani-Hershkovich, R., Bar, E., Nir, Y. "SleepEEGpy: a Python-based software “wrapper” package to organize preprocessing, analysis, and visualization of sleep EEG data." bioRxiv (2023). doi: https://doi.org/10.1101/2023.12.17.572046
Installation error on macOS - `libomp` not found
If you encounter the following error when installing sleepeegpy
on macOS:
ERROR: Could not find a version that satisfies the requirement libomp (from versions: none)
ERROR: No matching distribution found for libomp
You can resolve this by running:
brew install cmake libomp
pip install lightgbm
pip install sleepeegpy