YASA: Analysis of polysomnography recordings.
Project description
YASA (Yet Another Spindle Algorithm) is a command-line sleep analysis toolbox in Python. The main functions of YASA are:
Automatic sleep staging of polysomnography data (see eLife article).
Event detection: sleep spindles, slow-waves and rapid eye movements, on single or multi-channel EEG data.
Artefact rejection, on single or multi-channel EEG data.
Spectral analyses: bandpower, phase-amplitude coupling, 1/f slope, and more!
Hypnogram analysis: sleep statistics, stage transitions, visualization, and manipulation.
For more details, try the tutorials or read the FAQ.
Installation
User installation
YASA can be easily installed using pip, conda, or uv:
uv pip install yasa
pip install --upgrade yasa
conda install -c conda-forge yasa
Some features require optional dependencies. Install them with extras:
pip install "yasa[full]" # all optional dependencies
Development
To build and install from source, clone this repository and install in editable mode with uv
git clone https://github.com/raphaelvallat/yasa.git
cd yasa
uv pip install --group=test --editable .
# test the package
pytest --verbose
For common questions about prerequisites, data formats, and how to load EEG data, see the FAQ.
How do I get started with YASA?
The best starting point is the tutorials section of the documentation, which includes a quickstart guide and step-by-step walkthroughs of the most common workflows.
Additional worked examples are available as Jupyter notebooks on GitHub. Note that some notebooks may not reflect the latest API.
Gallery
Below some plots demonstrating the functionalities of YASA. For step-by-step examples, see the tutorials or the Jupyter notebooks.
The top plot show an overlay of the detected spindles on real EEG data. The middle left panel shows a time-frequency representation of the whole-night recording (spectrogram), plotted with the hypnogram (sleep stages) on top. The middle right panel shows the sleep stage probability transition matrix, calculated across the entire night. The bottom row shows, from left to right: a topographic plot, the average template of all detected slow-waves across the entire night stratified by channels, and a phase-amplitude coupling comodulogram.
Development
YASA was created and is maintained by Raphael Vallat. Contributions are more than welcome! See the contributing guide for guidelines.
To see the code or report a bug, please visit the GitHub repository.
Note that this program is provided with NO WARRANTY OF ANY KIND.
Citation
To cite YASA, please use the eLife publication:
Vallat, Raphael, and Matthew P. Walker. “An open-source, high-performance tool for automated sleep staging.” Elife 10 (2021). doi: https://doi.org/10.7554/eLife.70092
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yasa-0.7.0.tar.gz.
File metadata
- Download URL: yasa-0.7.0.tar.gz
- Upload date:
- Size: 33.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a0106a06a76ddac1a1483fa2ca5cb3a604d9d233055b2fac0992d8db04bd4f4
|
|
| MD5 |
266c56ed3aaede8ddd4e52d51ffa8c14
|
|
| BLAKE2b-256 |
4cbc1ab0b436b7e6666833488f700ef54526e59f8c310c7b32ced5b2d8ff957c
|
File details
Details for the file yasa-0.7.0-py3-none-any.whl.
File metadata
- Download URL: yasa-0.7.0-py3-none-any.whl
- Upload date:
- Size: 33.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
114d9cab3dd8237847657b45540aa5df1edd27eea0bd590b8154a6fb2426b0c9
|
|
| MD5 |
36285e1c63a7d772977b0287011562b4
|
|
| BLAKE2b-256 |
3e52a3f484d89ff7e9a580e1a6f27e4a382f943060b6a897d7a7935a3144f9fc
|