Skip to content

Releases: raphaelvallat/yasa

YASA v0.7.0

08 Mar 20:03
90c11cf

Choose a tag to compare

v0.7.0 — March 2026

This is the first major release of YASA in two years 🎉 !

This release introduces a new object-oriented hypnogram API, new functionalities, and several bugfixes. This version requires Python 3.10+ and is fully compatible with pandas 3.x and numpy 2.x.

New: Object-oriented Hypnogram class

Warning

Breaking changes — action required

This release introduces the yasa.Hypnogram class as the new standard for representing hypnograms throughout YASA. Several functions and classes that previously returned plain NumPy arrays now return a yasa.Hypnogram instead, which will break existing code that expects an array. Key examples:

  • SleepStaging.predict() now returns a Hypnogram instead of a string array. To recover the underlying array use .hypno (string labels) or .as_int() (integer-encoded).
  • yasa.plot_hypnogram() now requires a Hypnogram as input.

See the migration guide for step-by-step instructions, and the Working with Hypnograms tutorial for a full introduction to the new API.

New functions

  • yasa.fetch_sample: download and cache sample YASA data files. (PR #192), special thanks to @remrama for implementing this!

API changes

  • SleepStaging.predict() now returns a Hypnogram instead of a string NumPy array. Stage probabilities are stored in .proba and can be plotted with .plot_hypnodensity().
  • yasa.plot_hypnogram() now requires a Hypnogram instance as input (previously accepted a plain array).
  • Detection functions (spindles_detect, sw_detect, rem_detect) now log an explicit warning when sf or ch_names are ignored because an MNE object was passed. (PR #207)
  • spindles_detect output now includes an AmplitudeFiltered column reporting the spindle amplitude measured on the filtered signal. (issue #216)

Bugfixes

  • Fixed slow-wave slope calculation: the slope numerator was incorrectly using the positive half-wave amplitude instead of the negative half-wave amplitude. (PR #220)
  • Fixed multiple compatibility issues with pandas 3.x and numpy 2.x in yasa.compare_detection, yasa.Hypnogram, and yasa.SleepStaging.
  • Fixed multiple broken or outdated links in documentation and docstrings.

Dependencies

  • Python ≥ 3.10 is now required (dropped Python 3.9, which reached end-of-life in October 2025; added Python 3.13).
  • Bumped minimum versions: numpy >= 1.22.4, scipy >= 1.8.1, pandas >= 2.1.1.
  • Non-essential dependencies are now optional
  • Bumped minimum lspopt version. (PR #195)

Documentation

Packaging & tooling

  • Modern packaging: migrated to src/ layout, pyproject.toml-only configuration, numpy 2 compatibility. (PR #187)
  • Switched to uv as the recommended package manager; development dependencies moved to [dependency-groups] (PEP 735).
  • Added ruff linting and formatting to the CI pipeline.
  • New test-dependency-combinations CI job: runs the test suite against minimum-supported and latest versions of numpy, scipy, pandas, MNE, and numba.

Merged PRs

New Contributors

Full Changelog: v0.6.5...v0.7.0

0.6.5

04 Jul 19:02
0e4689d

Choose a tag to compare

Highlights of this release are:

  • PR 130: Add new yasa.EpochByEpochAgreement and yasa.SleepStatsAgreement modules for evaluating the agreement between two scorers (e.g. human vs YASA), either at the epoch-by-epoch level or at the level of summary sleep statistics. This is an experimental feature. Remaining tasks to complete the Evaluation pipeline are described in #166. Huge kudos to @remrama for this incredible new module!
  • PR 171: Fix deprecated scipy.integrate.simps.

What's Changed

New Contributors

Full Changelog: v0.6.4...v0.6.5

v0.6.4

13 Jan 14:06
6b37c63

Choose a tag to compare

Minor release with one bugfix and several other improvements:

  • Fix MNE plot_topomap deprecation (#119)
  • Pass relative_prominence parameters in :py:func:yasa.rem_detect (#151)
  • Rename yasa.simulate_hypno function to yasa.simulate_hypnogram
  • Add Hypnogram class in public API. Hypnogram will become the default method for manipulating hypnograms in YASA starting from v0.7.
  • Requires mne>=1.3, numpy>=1.18.1, numba>=0.57.1

v0.6.3

14 Dec 01:46

Choose a tag to compare

This is a minor release with one bugfix and one new function. Big shoutout to @remrama for his huge help on this new version!

Bugfix

Solved a bug in the spindles detection which resulted in no spindle being detected on some systems. See #107 and #115.

New functions

Added the yasa.simulate_hypno function to generate a simulated hypnogram, primarily for testing purposes and tutorials. The hypnogram is simulated as a Markov sequence based on sleep stage transition probabilities. Transition probabilities can be user-defined or will default to those published in Metzner et al., 2021, Commun Biol (see Figure 5b). See #109 and #110

Improvements

  • Added the ax keyword-argument to yasa.plot_hypnogram and removed figsize. Now select figure aesthetics (e.g., size, dpi) by opening a matplotlib.axes.Axes instance and passing to ax. See PR #108
  • yasa.plot_hypnogram now draws the hypnogram withmatplotlib.pyplot.stairs instead of matplotlib.pyplot.step. See issue #106 and PR #108

v0.6.2

27 Aug 01:23
fc51d93

Choose a tag to compare

This releases implement several new functions. Please refer to the full changelog at: https://raphaelvallat.com/yasa/build/html/changelog.html#v0-6-2-august-2022

What's Changed

New Contributors

v0.6.1

15 Mar 17:21

Choose a tag to compare

This release fixes a CRITICAL BUG with the spindles detection. Specifically, the yasa.spindles_detect() could return different results depending on the sampling rate of the data. For example, downsampling the data from 256 Hz to 128 Hz may have significantly reduced the number of detected spindles. As explained in issue 54, this bug was caused by a floating-point error in numpy.convolve() when calculating the soft spindle threshold. Tests seem to indicate that only certain sampling frequencies were impacted, such as 200 Hz, 256 Hz or 400 Hz. Other sampling frequencies such as 100 Hz and 500 Hz were seemingly not affected by this bug.

We recommend all users to upgrade to this new version ASAP and check any results obtained with the yasa.spindles_detect() function!

v0.6.0

20 Feb 22:30

Choose a tag to compare

YASA 0.6.0

This is a MAJOR release with several API-breaking changes, new functions, bugfixes and a new section in the documentation.

Slow oscillations—sigma coupling

IMPORTANT — The default behavior of coupling=True in yasa.sw_detect() has been changed: YASA now uses a ± 1 second window around the negative peak of the slow-waves (2 sec total) to calculate the coupling, instead of a ± 2 sec window. Overall, this tends to increase the ndPAC values because of the higher temporal specificity. To keep a 4-sec window, use coupling_params['time'] = 2.

We’ve enabled the statistical thresholding in the ndPAC calculation. Practically, this means that events with a weak/unreliable coupling are assigned an ndPAC value of zero. Statistical thresholding can be disabled with coupling_params['p'] = None.

Because of these changes, the coupling values are therefore not comparable with previous versions of YASA. Please make sure to re-run your analyses with the new default parameters.

Events detection

Plotting

Documentation

  • Added a Quickstart section to illustrate the main functions of YASA. Make sure to check it out!

Others

v0.5.1

18 Aug 03:53

Choose a tag to compare

This is a bugfix release. The latest pre-trained classifiers for yasa.SleepStaging were accidentally missing from the previous release. They have now been included in this release. We recommend all users to upgrade to this version with pip install –upgrade yasa

v0.5.0

11 Aug 22:56

Choose a tag to compare

This is a major release with an important bugfix for the slow-waves detection as well as API-breaking changes in the automatic sleep staging module. Please read the full changelog here.

We recommend all users to upgrade to this version with pip install –upgrade yasa.

v0.4.1

23 Mar 22:07

Choose a tag to compare

New functions

Added yasa.topoplot(), a wrapper around mne.viz.plot_topomap(). See 15_topoplot.ipynb.

Enhancements

  • The default frequency range for slow-waves in yasa.sw_detect() is now 0.3-1.5 Hz instead of 0.3-2 Hz. Indeed, most slow-waves have a frequency below 1Hz. This may result in slightly different coupling values when coupling=True so make sure to homogenize your slow-waves detection pipeline across all nights in your dataset.
  • yasa.trimbothstd() now handles missing values in input array.
  • yasa.bandpower_from_psd() and yasa.bandpower_from_psd_ndarray() now print a warning if the PSD contains negative values. See issue 29.
  • Upon loading, YASA will now use the outdated package to check and warn the user if a newer stable version is available.
  • YASA now uses the AntroPy package to calculate non-linear features in the automatic sleep staging module. Previously, YASA was using EntroPy, which could not be installed using pip.