Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.6.5 #176

Merged
merged 4 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
platform: [ubuntu-latest, windows-latest] # macos-latest
python-version: ["3.9", "3.10", "3.11"]

runs-on: ${{ matrix.platform }}

Expand Down
2 changes: 2 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Hypnogram & sleep statistics
sleep_statistics
Hypnogram
simulate_hypnogram
EpochByEpochAgreement
SleepStatsAgreement

Spectral analyses
-----------------
Expand Down
2 changes: 1 addition & 1 deletion docs/build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 489cdac284cc185cfdae105616c5af8a
config: f80ed99698c532d7a1c5d14ebdacc629
tags: 645f666f9bcd5a90fca523b33c5a78b7
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/build/html/_images/yasa-Hypnogram-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions docs/build/html/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Overview: module code &#8212; yasa 0.6.4 documentation</title>
<title>Overview: module code &#8212; yasa 0.6.5 documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/bootstrap-sphinx.css" />
<link rel="stylesheet" type="text/css" href="../_static/plot_directive.css" />
Expand Down Expand Up @@ -43,7 +43,7 @@
</button>
<a class="navbar-brand" href="../index.html"><span><img src="../_static/yasa_128x128.png"></span>
yasa</a>
<span class="navbar-text navbar-version pull-left"><b>0.6.4</b></span>
<span class="navbar-text navbar-version pull-left"><b>0.6.5</b></span>
</div>

<div class="collapse navbar-collapse nav-collapse">
Expand Down Expand Up @@ -94,6 +94,7 @@

<h1>All modules for which code is available</h1>
<ul><li><a href="yasa/detection.html">yasa.detection</a></li>
<li><a href="yasa/evaluation.html">yasa.evaluation</a></li>
<li><a href="yasa/heart.html">yasa.heart</a></li>
<li><a href="yasa/hypno.html">yasa.hypno</a></li>
<li><a href="yasa/others.html">yasa.others</a></li>
Expand Down
5 changes: 3 additions & 2 deletions docs/build/html/_modules/yasa/detection.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>yasa.detection &#8212; yasa 0.6.4 documentation</title>
<title>yasa.detection &#8212; yasa 0.6.5 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../_static/bootstrap-sphinx.css" />
<link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
Expand Down Expand Up @@ -43,7 +43,7 @@
</button>
<a class="navbar-brand" href="../../index.html"><span><img src="../../_static/yasa_128x128.png"></span>
yasa</a>
<span class="navbar-text navbar-version pull-left"><b>0.6.4</b></span>
<span class="navbar-text navbar-version pull-left"><b>0.6.5</b></span>
</div>

<div class="collapse navbar-collapse nav-collapse">
Expand Down Expand Up @@ -101,6 +101,7 @@ <h1>Source code for yasa.detection</h1><div class="highlight"><pre>
<span class="sd">- GitHub: https://github.com/raphaelvallat/yasa</span>
<span class="sd">- License: BSD 3-Clause License</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">mne</span>
<span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
Expand Down
1,626 changes: 1,626 additions & 0 deletions docs/build/html/_modules/yasa/evaluation.html

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions docs/build/html/_modules/yasa/heart.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>yasa.heart &#8212; yasa 0.6.4 documentation</title>
<title>yasa.heart &#8212; yasa 0.6.5 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../_static/bootstrap-sphinx.css" />
<link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
Expand Down Expand Up @@ -43,7 +43,7 @@
</button>
<a class="navbar-brand" href="../../index.html"><span><img src="../../_static/yasa_128x128.png"></span>
yasa</a>
<span class="navbar-text navbar-version pull-left"><b>0.6.4</b></span>
<span class="navbar-text navbar-version pull-left"><b>0.6.5</b></span>
</div>

<div class="collapse navbar-collapse nav-collapse">
Expand Down Expand Up @@ -99,6 +99,7 @@ <h1>Source code for yasa.heart</h1><div class="highlight"><pre>
<span class="sd">Author: Dr Raphael Vallat &lt;[email protected]&gt;, UC Berkeley.</span>
<span class="sd">Date: May 2022</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
Expand Down
45 changes: 42 additions & 3 deletions docs/build/html/_modules/yasa/hypno.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>yasa.hypno &#8212; yasa 0.6.4 documentation</title>
<title>yasa.hypno &#8212; yasa 0.6.5 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../_static/bootstrap-sphinx.css" />
<link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
Expand Down Expand Up @@ -43,7 +43,7 @@
</button>
<a class="navbar-brand" href="../../index.html"><span><img src="../../_static/yasa_128x128.png"></span>
yasa</a>
<span class="navbar-text navbar-version pull-left"><b>0.6.4</b></span>
<span class="navbar-text navbar-version pull-left"><b>0.6.5</b></span>
</div>

<div class="collapse navbar-collapse nav-collapse">
Expand Down Expand Up @@ -96,6 +96,7 @@ <h1>Source code for yasa.hypno</h1><div class="highlight"><pre>
<span></span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Hypnogram-related functions and class.</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">mne</span>
<span class="kn">import</span> <span class="nn">logging</span>

Expand All @@ -105,6 +106,7 @@ <h1>Source code for yasa.hypno</h1><div class="highlight"><pre>
<span class="kn">from</span> <span class="nn">yasa.io</span> <span class="kn">import</span> <span class="n">set_log_level</span>
<span class="kn">from</span> <span class="nn">yasa.plotting</span> <span class="kn">import</span> <span class="n">plot_hypnogram</span>
<span class="kn">from</span> <span class="nn">yasa.sleepstats</span> <span class="kn">import</span> <span class="n">transition_matrix</span>
<span class="kn">from</span> <span class="nn">yasa.evaluation</span> <span class="kn">import</span> <span class="n">EpochByEpochAgreement</span>
<span class="kn">from</span> <span class="nn">pandas.api.types</span> <span class="kn">import</span> <span class="n">CategoricalDtype</span>

<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span>
Expand Down Expand Up @@ -575,7 +577,7 @@ <h1>Source code for yasa.hypno</h1><div class="highlight"><pre>
<span class="sd"> Name: Stage, dtype: int16</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># Return as int16 (-32768 to 32767) to reduce memory usage</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">hypno</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">)</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">int16</span><span class="p">)</span></div>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">hypno</span><span class="o">.</span><span class="n">cat</span><span class="o">.</span><span class="n">rename_categories</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">)</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">int16</span><span class="p">)</span></div>

<div class="viewcode-block" id="Hypnogram.consolidate_stages"><a class="viewcode-back" href="../../generated/yasa.Hypnogram.html#yasa.Hypnogram.consolidate_stages">[docs]</a> <span class="k">def</span> <span class="nf">consolidate_stages</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">new_n_stages</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Reduce the number of stages in a hypnogram to match actigraphy or wearables.</span>
Expand Down Expand Up @@ -665,6 +667,43 @@ <h1>Source code for yasa.hypno</h1><div class="highlight"><pre>
<span class="n">scorer</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">scorer</span><span class="p">,</span>
<span class="p">)</span></div>

<div class="viewcode-block" id="Hypnogram.evaluate"><a class="viewcode-back" href="../../generated/yasa.Hypnogram.html#yasa.Hypnogram.evaluate">[docs]</a> <span class="k">def</span> <span class="nf">evaluate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obs_hyp</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Evaluate agreement between two hypnograms of the same sleep session.</span>

<span class="sd"> For example, the reference hypnogram (i.e., ``self``) might be a manually-scored hypnogram</span>
<span class="sd"> and the reference hypnogram (i.e., ``ref_hyp``) might be a hypnogram from actigraphy, a</span>
<span class="sd"> wearable device, or an automated scorer (e.g., :py:meth:`yasa.SleepStaging.predict`).</span>

<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> self : :py:class:`yasa.Hypnogram`</span>
<span class="sd"> Reference or ground-truth hypnogram.</span>
<span class="sd"> obs_hyp : :py:class:`yasa.Hypnogram`</span>
<span class="sd"> The observed or to-be-evaluated hypnogram.</span>

<span class="sd"> Returns</span>
<span class="sd"> -------</span>
<span class="sd"> ebe : :py:class:`yasa.EpochByEpochAgreement`</span>
<span class="sd"> See :py:class:`~yasa.EpochByEpochAgreement` documentation for more detail.</span>

<span class="sd"> Examples</span>
<span class="sd"> --------</span>
<span class="sd"> &gt;&gt;&gt; from yasa import simulate_hypnogram</span>
<span class="sd"> &gt;&gt;&gt; hyp_a = simulate_hypnogram(tib=90, scorer=&quot;AASM&quot;, seed=8)</span>
<span class="sd"> &gt;&gt;&gt; hyp_b = hyp_a.simulate_similar(scorer=&quot;YASA&quot;, seed=9)</span>
<span class="sd"> &gt;&gt;&gt; ebe = hyp_a.evaluate(hyp_b)</span>
<span class="sd"> &gt;&gt;&gt; ebe.get_agreement().round(3)</span>
<span class="sd"> accuracy 0.550</span>
<span class="sd"> balanced_acc 0.355</span>
<span class="sd"> kappa 0.227</span>
<span class="sd"> mcc 0.231</span>
<span class="sd"> precision 0.515</span>
<span class="sd"> recall 0.550</span>
<span class="sd"> fbeta 0.524</span>
<span class="sd"> Name: agreement, dtype: float64</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">EpochByEpochAgreement</span><span class="p">([</span><span class="bp">self</span><span class="p">],</span> <span class="p">[</span><span class="n">obs_hyp</span><span class="p">])</span></div>

<div class="viewcode-block" id="Hypnogram.find_periods"><a class="viewcode-back" href="../../generated/yasa.Hypnogram.html#yasa.Hypnogram.find_periods">[docs]</a> <span class="k">def</span> <span class="nf">find_periods</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">threshold</span><span class="o">=</span><span class="s2">&quot;5min&quot;</span><span class="p">,</span> <span class="n">equal_length</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Find sequences of consecutive values exceeding a certain duration in hypnogram.</span>

Expand Down
5 changes: 3 additions & 2 deletions docs/build/html/_modules/yasa/others.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>yasa.others &#8212; yasa 0.6.4 documentation</title>
<title>yasa.others &#8212; yasa 0.6.5 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../_static/bootstrap-sphinx.css" />
<link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
Expand Down Expand Up @@ -43,7 +43,7 @@
</button>
<a class="navbar-brand" href="../../index.html"><span><img src="../../_static/yasa_128x128.png"></span>
yasa</a>
<span class="navbar-text navbar-version pull-left"><b>0.6.4</b></span>
<span class="navbar-text navbar-version pull-left"><b>0.6.5</b></span>
</div>

<div class="collapse navbar-collapse nav-collapse">
Expand Down Expand Up @@ -96,6 +96,7 @@ <h1>Source code for yasa.others</h1><div class="highlight"><pre>
<span></span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">This file contains several helper functions to manipulate 1D and 2D EEG data.</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">scipy.interpolate</span> <span class="kn">import</span> <span class="n">interp1d</span>
Expand Down
Loading
Loading