You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DOC: Add Hypnogram tutorial and Migration tutorial from 0.6 to 0.7 (#234)
* Update index and README
* Move quickstart
* Remove Hypnogram from FAQ; Remove SleepStaging Notes
* Add two new tutorials: Hypnogram class and migrate
* Update changelog and Hypnogram class docstring
Copy file name to clipboardExpand all lines: HYPNOGRAM_ROADMAP.md
-3Lines changed: 0 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,8 +40,5 @@ Goal: make `yasa.Hypnogram` the industry-standard Python object for handling sle
40
40
41
41
## Planned (future releases)
42
42
43
-
### I/O
44
-
-**`from_edf_annotations(raw)`** — load hypnogram from EDF+ annotations.
45
-
46
43
### Multi-scorer support
47
44
-**`HypnogramSet`** — new container class for multiple scorers of the same night (alignment, pairwise agreement, consensus scoring). See [HYPNOGRAM_MULTIPLE_SCORERS.md](HYPNOGRAM_MULTIPLE_SCORERS.md) for the full design plan.
Copy file name to clipboardExpand all lines: README.rst
+12-34Lines changed: 12 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,10 +29,9 @@
29
29
* Event detection: sleep spindles, slow-waves and rapid eye movements, on single or multi-channel EEG data.
30
30
* Artefact rejection, on single or multi-channel EEG data.
31
31
* Spectral analyses: bandpower, phase-amplitude coupling, 1/f slope, and more!
32
-
* Hypnogram analysis: sleep statistics and stage transitions.
33
-
* Scorer agreement evaluation: epoch-by-epoch and sleep-statistics Bland–Altman agreement between two scorers.
32
+
* Hypnogram analysis: sleep statistics, stage transitions, visualization, and manipulation.
34
33
35
-
For more details, try the `quickstart<https://yasa-sleep.org/quickstart.html>`_ or read the `FAQ <https://yasa-sleep.org/faq.html>`_.
34
+
For more details, try the `tutorials<https://yasa-sleep.org/tutorials/index.html>`_ or read the `FAQ <https://yasa-sleep.org/faq.html>`_.
36
35
37
36
----------------
38
37
@@ -75,41 +74,20 @@ For common questions about prerequisites, data formats, and how to load EEG data
75
74
How do I get started with YASA?
76
75
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
77
76
78
-
If you want to dive right in, you can simply go to the main `documentation <https://yasa-sleep.org/quickstart.html>`_ and try to apply YASA's functions on your own EEG data.
79
-
However, for most users, we strongly recommend that you first try running the examples Jupyter notebooks to get a sense of how YASA works and what it can do!
80
-
The notebooks also come with example datasets so they should work right out of the box as long as you've installed YASA first.
81
-
The notebooks and datasets can be found on `GitHub <https://github.com/raphaelvallat/yasa/tree/master/notebooks>`_ (make sure that you download the whole *notebooks/* folder). A short description of all notebooks is provided below:
77
+
The best starting point is the `tutorials <https://yasa-sleep.org/tutorials/index.html>`_ section
78
+
of the documentation, which includes a quickstart guide and step-by-step walkthroughs of the most
79
+
common workflows.
82
80
83
-
**Automatic sleep staging**
84
-
85
-
* `automatic_staging <notebooks/14_automatic_sleep_staging.ipynb>`_: Automatic sleep staging of polysomnography data.
86
-
87
-
**Event detection**
88
-
89
-
* `spindles_detection <notebooks/01_spindles_detection.ipynb>`_: single-channel spindles detection and step-by-step description of the spindles detection algorithm.
* `spindles_detection_NREM_only <notebooks/03_spindles_detection_NREM_only.ipynb>`_: how to limit the spindles detection on specific sleep stages using an hypnogram.
92
-
* `spindles_slow_fast <notebooks/04_spindles_slow_fast.ipynb>`_: slow versus fast spindles.
93
-
* `sw_detection <notebooks/05_sw_detection.ipynb>`_: single-channel slow-waves detection and step-by-step description of the slow-waves detection algorithm.
* `run_visbrain <notebooks/run_visbrain.py>`_: interactive display of the detected spindles using the Visbrain visualization software in Python.
98
-
99
-
**Spectral analysis**
100
-
101
-
* `bandpower <notebooks/08_bandpower.ipynb>`_: calculate spectral band power, optionally averaged across channels and sleep stages.
102
-
* `IRASA <notebooks/09_IRASA.ipynb>`_: separate the aperiodic (= fractal = 1/f) components of the EEG power spectrum using the IRASA method.
103
-
* `spectrogram <notebooks/10_spectrogram.ipynb>`_: plot a multi-taper full-night spectrogram on single-channel EEG data with the hypnogram on top.
104
-
* `nonlinear_features <notebooks/11_nonlinear_features.ipynb>`_: calculate non-linear EEG features on 30-seconds epochs and perform a naive sleep stage classification.
105
-
* `SO-sigma_coupling <notebooks/12_SO-sigma_coupling.ipynb>`_: slow-oscillations/spindles phase-amplitude coupling and data-driven comodulogram.
106
-
* `EEG-HRV coupling <notebooks/16_EEG-HRV_coupling.ipynb>`_: overnight coupling between EEG bandpower and heart rate variability.
Additional worked examples are available as `Jupyter notebooks on GitHub
82
+
<https://github.com/raphaelvallat/yasa/tree/master/notebooks>`_. Note that some notebooks may
83
+
not reflect the latest API.
108
84
109
85
Gallery
110
86
~~~~~~~
111
87
112
-
Below some plots demonstrating the functionalities of YASA. To reproduce these, check out the `tutorial (Jupyter notebooks) <https://github.com/raphaelvallat/yasa/tree/master/notebooks>`_.
88
+
Below some plots demonstrating the functionalities of YASA. For step-by-step examples, see the
89
+
`tutorials <https://yasa-sleep.org/tutorials/index.html>`_ or the `Jupyter notebooks
@@ -119,7 +97,7 @@ Below some plots demonstrating the functionalities of YASA. To reproduce these,
119
97
Development
120
98
~~~~~~~~~~~
121
99
122
-
YASA was created and is maintained by `Raphael Vallat <https://raphaelvallat.com>`_, a former postdoctoral researcher in `Matthew Walker's lab <https://www.humansleepscience.com/>`_ at UC Berkeley. Contributions are more than welcome so feel free to contact me, open an issue or submit a pull request!
100
+
YASA was created and is maintained by `Raphael Vallat <https://raphaelvallat.com>`_. Contributions are more than welcome! See the `contributing guide <https://yasa-sleep.org/contributing.html>`_ for guidelines.
123
101
124
102
To see the code or report a bug, please visit the `GitHub repository <https://github.com/raphaelvallat/yasa>`_.
* :py:class:`yasa.SleepStaging` now returns a :py:class:`yasa.Hypnogram` instead of a :py:class:`numpy.ndarray`. The probability of each sleep stage for each epoch can now be accessed with :py:attr:`yasa.Hypnogram.proba`.
63
-
* :py:func:`yasa.simulate_hypnogram` now returns a :py:class:`yasa.Hypnogram` instead of a :py:class:`numpy.ndarray`.
64
-
* :py:func:`yasa.plot_hypnogram` now *requires* a :py:class:`yasa.Hypnogram` instance as input (previously accepted a plain array).
65
-
* :py:func:`yasa.transition_matrix` now accepts a :py:class:`yasa.Hypnogram` instance in addition to integer arrays. When a :py:class:`yasa.Hypnogram` is passed, the output DataFrames use string stage labels (e.g. ``"WAKE"``, ``"N1"``) instead of integers. Equivalent to calling :py:meth:`yasa.Hypnogram.transition_matrix` directly.
66
-
* Detection functions (:py:func:`yasa.spindles_detect`, :py:func:`yasa.sw_detect`, :py:func:`yasa.rem_detect`) now log an explicit warning when ``sf`` or ``ch_names`` are ignored because an MNE object was passed. (`PR 207 <https://github.com/raphaelvallat/yasa/pull/207>`_)
47
+
* :py:class:`yasa.SleepStaging`: ``predict()`` now returns a :py:class:`~yasa.Hypnogram`
48
+
instead of a string array. Stage probabilities are stored in :py:attr:`~yasa.Hypnogram.proba`
49
+
and are available directly to :py:meth:`~yasa.Hypnogram.plot_hypnodensity`.
50
+
* :py:func:`yasa.simulate_hypnogram` now returns a :py:class:`~yasa.Hypnogram` instead of a
51
+
:py:class:`numpy.ndarray`.
52
+
* :py:func:`yasa.plot_hypnogram` now *requires* a :py:class:`~yasa.Hypnogram` instance as
53
+
input (previously accepted a plain array).
54
+
* :py:func:`yasa.transition_matrix` now accepts a :py:class:`~yasa.Hypnogram` instance in
55
+
addition to integer arrays. When a :py:class:`~yasa.Hypnogram` is passed, the output
56
+
DataFrames use string stage labels (e.g. ``"WAKE"``, ``"N1"``). Equivalent to calling
* 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 <https://github.com/raphaelvallat/yasa/pull/220>`_)
71
-
* Fixed multiple compatibility issues with pandas 3.x and numpy 2.x in :py:func:`yasa.compare_detection`, :py:class:`yasa.Hypnogram`, and :py:class:`yasa.SleepStaging`.
72
-
* Fixed multiple broken or outdated links in doc and docstrings
79
+
* Fixed slow-wave slope calculation: the slope numerator was incorrectly using the positive
80
+
half-wave amplitude instead of the negative half-wave amplitude.
* Overhauled the documentation with the `PyData Sphinx Theme <https://pydata-sphinx-theme.readthedocs.io/>`_. (`PR 194 <https://github.com/raphaelvallat/yasa/pull/194>`_)
83
-
* Updated the Quickstart guide end-to-end to use the new :py:class:`yasa.Hypnogram` API.
84
-
* Added `YASA Flaskified <https://github.com/bartromb/YASAFlaskified>`_ (a web-based interface built on YASA) to README and FAQ. (`PR 198 <https://github.com/raphaelvallat/yasa/pull/198>`_)
85
-
* FAQ: clarified the difference between Volts and µV in MNE objects. (`PR 204 <https://github.com/raphaelvallat/yasa/pull/204>`_)
86
-
* FAQ: specified REM density units. (`PR 206 <https://github.com/raphaelvallat/yasa/pull/206>`_)
101
+
* New :ref:`tutorials` section with step-by-step guides: :ref:`tutorial_hypnogram`,
102
+
:ref:`tutorial_migrate`, and an updated :ref:`quickstart`.
* Added helpful string representation (``__repr__``) to :py:class:`~yasa.SleepStaging`.
90
118
91
119
**Packaging & tooling**
92
120
93
-
* Modern packaging: migrated to ``src/`` layout, ``pyproject.toml``-only configuration, numpy 2 compatibility. (`PR 187 <https://github.com/raphaelvallat/yasa/pull/187>`_)
94
-
* Switched to `uv <https://docs.astral.sh/uv/>`_ as the recommended package manager; development dependencies moved to ``[dependency-groups]`` (PEP 735).
121
+
* Modern packaging: migrated to ``src/`` layout, ``pyproject.toml``-only configuration, numpy 2
* Switched to `uv <https://docs.astral.sh/uv/>`_ as the recommended package manager;
124
+
development dependencies moved to ``[dependency-groups]`` (PEP 735).
95
125
* Added ruff linting and formatting to the CI pipeline.
96
126
97
127
**CI / GitHub Actions**
98
128
99
129
* Updated all GitHub Actions to their latest versions.
100
-
* New ``test-dependency-combinations`` CI job: runs the test suite against minimum-supported and latest versions of numpy, scipy, pandas, MNE, and numba.
101
-
* Coverage reporting moved to a dedicated ``coverage.yml`` workflow
130
+
* New ``test-dependency-combinations`` CI job: runs the test suite against minimum-supported and
131
+
latest versions of numpy, scipy, pandas, MNE, and numba.
132
+
* Coverage reporting moved to a dedicated ``coverage.yml`` workflow.
0 commit comments