Skip to main content

Package to analyze EEG-scored sleep

Project description

Python scripts to analyze sleep-scored EEG files

Overview

EEG-based murine sleep studies use waveform signature to define three behavioral states--wake, rapid eye movement (REM) sleep, and non-REM (NREM) sleep. These recordings are long (typically 6-48 hours) and broken down into short epochs (usually 4-10 seconds). Either automatic or manual scoring is required to label each epoch as wake, NREM, or REM (and this package does not assist with this scoring).

These scripts will read in scored EEG files and output key metrics into Excel. These metrics inlcude:

  • Total time in wake, NREM, or REM sleep of user-specified bin size (default = 2 hours)
  • Total number of wake, NREM, and REM sleep bouts of user-specified bin size (default = 12 hours)
  • Average length of wake, NREM, and REM sleep bouts of user-specified bin size (default = 12 hours)
  • Wake bout distribution, or a frequency of wake bouts by their duration. This binning can be specified by user; default is power of 2 (16 seconds - 2048 seconds).
  • Spectral analysis (to be completed)

This code was originally built in MATLAB, which was first used to analyze results in Perron IJ et al..

If you use this analysis package, please cite this repo.

Detailed installation istructions for first time users

For users comfortable with python/anaconda, skip to last step

  1. Download and install anaconda, if you have not done so already.

  2. On your local machine, open anaconda shell. If you see (base), that means python is active in root environment.

  3. Non-first time users skip to step 4.. First time users should create new virtual environment:

conda create --name env3

In this example, env3 is the virutal environment name; it can be named whatever you prefer.

  1. Activate virutal environment:

conda activate env3

The terminal should now show (env3) instead of (base) if this worked correctly.

  1. Install eeg-sleep-analysis package:

pip install eeg-sleep-analysis

Detailed user instructions

  1. In terminal, navigate to your preferred directory. To list directory routes:

ls -la (for mac/linux)

dir (for windows)

To change directory:

cd (for mac/linux/windows)

  1. Type the command to launch the GUI

python -m EEGAnalysis

  1. For a new experiment, create a config.txt file. This will be created in your current directory. You must open and edit this config file with correct file directories and experiment details.

  2. In the GUI, navigate to the correct config.txt file.

  3. Create a new conditions.csv. If the config.txt file is setup properly, this should be generated automatically and correctly. However, it is highly recommended to double check conditions.csv before running analysis.

  4. In the GUI, navigate to the correct conditions.csv file.

  5. Run the analysis. Results will be output into the specified directory in the config.txt file.

Contact information

Please direct any questions or suggestions to ijperron@gmail.com

Acknowledgements

Thank you to the members of the University of Pennsylvania Center for Sleep and Circadian Neurobiology, especially Drs. Allan Pack and Sigrid Veasey. Thank you to Cameron Jones for his help to debug this program.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eeg-sleep-analysis-1.2.10.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eeg_sleep_analysis-1.2.10-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file eeg-sleep-analysis-1.2.10.tar.gz.

File metadata

  • Download URL: eeg-sleep-analysis-1.2.10.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for eeg-sleep-analysis-1.2.10.tar.gz
Algorithm Hash digest
SHA256 0ed225cb4ff84d7465686a22b628aaaab2b05bf27b1da58a986382c2ed2ba971
MD5 5566e9010521f1930f9e2fe7957fd23e
BLAKE2b-256 50a74f3da2a722a71c75099bb2a1889eab6351e833f36f75b03ad10ea2d0b6bf

See more details on using hashes here.

File details

Details for the file eeg_sleep_analysis-1.2.10-py3-none-any.whl.

File metadata

  • Download URL: eeg_sleep_analysis-1.2.10-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for eeg_sleep_analysis-1.2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 9e8abfe2400fcaaac186e5f72235f0bfba5a58a3e90186723b61f34ca7f8877f
MD5 38f47bd907913310d7a91540451c63ae
BLAKE2b-256 7ae6e24b03d24b9532da01f23ee16b81084e19be1555a4367074594ad65ec214

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page