PyPI - Version License Codecov PyPI - Downloads Ruff
https://raw.githubusercontent.com/raphaelvallat/yasa/refs/tags/v0.6.5/docs/pictures/yasa_logo.png

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 using the Hypnogram class.

For more details, try the Tutorials or read the FAQ.


Installation#

YASA is a Python 3 package and is currently tested for Python 3.10+.

Dependencies#

The core dependencies of YASA are:

Some features require optional dependencies (SleepECG, TensorPAC, PyRiemann, ipywidgets).

User installation#

YASA can be easily installed using pip, conda, or uv:

uv pip install yasa             # core install
uv pip install "yasa[full]"    # with all optional dependencies
pip install --upgrade yasa             # core install
pip install --upgrade "yasa[full]"    # with all optional dependencies
conda install -c conda-forge yasa

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, 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.



Development#

YASA was created and is maintained by Raphael Vallat. Contributions are more than welcome! See the Contribute to YASA page 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: