Skip to content

Commit

Permalink
avoiding nested dependencies, fixing mne compatibility .. update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dengemann committed Mar 29, 2024
1 parent f416e24 commit 2af5208
Show file tree
Hide file tree
Showing 18 changed files with 456 additions and 198 deletions.
2 changes: 1 addition & 1 deletion docs/api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ <h1 class="title">Python API overview</h1>

<div class="quarto-listing quarto-listing-container-grid" id="listing-listing">
<div class="list grid quarto-listing-cols-3">
<div class="g-col-1" data-index="0" data-listing-file-modified-sort="1711142091693" data-listing-reading-time-sort="2" data-listing-word-count-sort="256">
<div class="g-col-1" data-index="0" data-listing-file-modified-sort="1711705210280" data-listing-reading-time-sort="2" data-listing-word-count-sort="256">
<a href="../api/wavelets.html" class="quarto-grid-link">
<div class="quarto-grid-item card h-100 card-left">
<div class="card-body post-contents">
Expand Down
283 changes: 206 additions & 77 deletions docs/api/wavelets.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/background/0_tour.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ <h1 class="title">Onboarding</h1>
<h2 class="anchored" data-anchor-id="power-spectral-density-in-units-of-µv²oct">Power spectral density in units of µV²/oct</h2>
<p>The implementation provides the power spectrum in units of <span class="math inline">\(µV^2/oct\)</span>. While this is an unusual normalization for power spectral density, it is a logical continuation embracing the logarithmic nature of electrophysiological signals and Jean Morlet’s work extending Gabor wavelets <span class="citation" data-cites="gabor1946theory">(<a href="#ref-gabor1946theory" role="doc-biblioref">Gabor 1946</a>)</span> into families of proportionial wavelets <span class="citation" data-cites="morlet_wave_1982">(<a href="#ref-morlet_wave_1982" role="doc-biblioref">Morlet et al. 1982</a>)</span>. It automatically leads to larger values at higher frequencies compared to the traditional <span class="math inline">\(µV^2/Hz\)</span> normalization, thereby accounting for lower amplitudes at higher frequencies.</p>
<p>We therefore use a log-frequency grid with a wavelet design that increases spectral smoothing log-linearly with frequency. The implementation parameterizes spectral spacing and smoothing in units of <em>octaves</em> (<code>delta_oct</code> and <code>bw_oct</code>). We provide a python and a Matlab implementation. In the following we describe the python version.</p>
<div id="63521146" class="cell" data-execution_count="1">
<div id="8b4436fa" class="cell" data-execution_count="1">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> numpy <span class="im">as</span> np</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> matplotlib.pyplot <span class="im">as</span> plt</span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a></span>
Expand All @@ -383,7 +383,7 @@ <h2 class="anchored" data-anchor-id="power-spectral-density-in-units-of-µv²oct
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>The first step prepares frequencies of interest, <code>foi</code>, for which Morlet wavelets are constructed.</p>
<div id="32ea87ba" class="cell" data-execution_count="2">
<div id="7aa42c68" class="cell" data-execution_count="2">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>wavelets <span class="op">=</span> define_wavelets(foi, sigma_time, sfreq<span class="op">=</span><span class="dv">1000</span>)</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a>fig, axes <span class="op">=</span> plt.subplots(<span class="bu">len</span>(wavelets), sharex<span class="op">=</span><span class="va">True</span>)</span>
Expand All @@ -410,7 +410,7 @@ <h2 class="anchored" data-anchor-id="power-spectral-density-in-units-of-µv²oct
</div>
<p>The Morlet wavelets are widest in lower frequencies and shorter in higher frequencies. Note also that the <em>number of cycles</em> is constant across wavelets, which is in line with Jean Morlet’s original work <span class="citation" data-cites="morlet_wave_1982">(<a href="#ref-morlet_wave_1982" role="doc-biblioref">Morlet et al. 1982</a>)</span> as it is controlled by the <em>kernel width</em>.</p>
<p>In addition, our Morlet wavelet family does not only have a log-linearly increasing spectral width and a log-linearly decreasing temporal width, but spacing between frequencies increases log-linearly, i.e., increasingly fewer wavelets are deployed at higher frequencies. The spectral distance between two wavelets, i.e.&nbsp;spacing, is expressed in <em>octaves</em>, hence, log-linear too. This is a natural choice and ensures efficient spectral sampling.</p>
<div id="b0f2cff0" class="cell" data-execution_count="3">
<div id="e88f2f78" class="cell" data-execution_count="3">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>delta_foi <span class="op">=</span> np.c_[</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="dv">2</span> <span class="op">**</span> (np.log2(foi) <span class="op">-</span> delta_oct <span class="op">/</span> <span class="dv">2</span>), </span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="dv">2</span> <span class="op">**</span> (np.log2(foi) <span class="op">+</span> delta_oct <span class="op">/</span> <span class="dv">2</span>)</span>
Expand Down
4 changes: 2 additions & 2 deletions docs/background/1_background_wavelets.html
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ <h4 class="anchored" data-anchor-id="relationship-between-the-bandwidth-in-octav
q=\frac{2^{bw}+2^{-bw}+2}{2^{bw}-2^{-bw}} \sqrt{2ln(2)}
\tag{10}\]</span></span></p>
<p>Applied, to our defaults of <span class="math inline">\(bw=0.5\)</span>, using the arithmetic mean, we find <span class="math inline">\(q=6.9\)</span>, which is close to the <span class="math inline">\(q=7\)</span> that is used in literature <span class="citation" data-cites="tallon1996stimulus">(<a href="#ref-tallon1996stimulus" role="doc-biblioref">Tallon-Baudry et al. 1996</a>)</span>.</p>
<div id="e65f41e0" class="cell" data-execution_count="2">
<div id="2ea41e41" class="cell" data-execution_count="2">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="kw">def</span> bw2q(bw):</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> L <span class="op">=</span> np.sqrt(<span class="dv">2</span><span class="op">*</span>np.log(<span class="dv">2</span>))</span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> (<span class="dv">2</span> <span class="op">**</span> bw <span class="op">+</span> <span class="dv">2</span> <span class="op">**</span> <span class="op">-</span> bw <span class="op">+</span> <span class="dv">2</span>) <span class="op">/</span> (<span class="dv">2</span> <span class="op">**</span> bw <span class="op">-</span> <span class="dv">2</span> <span class="op">**</span> <span class="op">-</span> bw) <span class="op">*</span> L</span>
Expand Down Expand Up @@ -674,7 +674,7 @@ <h4 class="anchored" data-anchor-id="relationship-between-the-bandwidth-in-octav
<p><span id="eq-11"><span class="math display">\[
bw = log_2\left( \pm\sqrt{\frac{\lambda^2}{(\lambda-q)^2}-\frac{\lambda+q}{\lambda-q}} - \frac{\lambda}{\lambda-q} \right)
\tag{11}\]</span></span></p>
<div id="65c1c702" class="cell" data-execution_count="3">
<div id="726ab55d" class="cell" data-execution_count="3">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="kw">def</span> q2bw(q):</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> L <span class="op">=</span> np.sqrt(<span class="dv">2</span><span class="op">*</span>np.log(<span class="dv">2</span>))</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> np.log2(</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ <h1 class="title">MEEGLET</h1>
<li>Harmonized &amp; tested <a href="api/wavelets.html">Python</a> and <a href="matlab/matlab_functions.html">MATLAB</a> implementation <a href="./api/wavelets.html#more-unit-tests-and-validation">(numerically equivalent)</a></li>
<li>Comprehensive <a href="background/1_background_wavelets.html">mathematical documentation</a></li>
</ul>
<div id="747a2d1b" class="cell" data-execution_count="1">
<div id="451735ff" class="cell" data-execution_count="1">
<details class="code-fold">
<summary>Code</summary>
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> matplotlib.pyplot <span class="im">as</span> plt</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/matlab/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ <h1 class="title">Matlab functionality</h1>

<div class="quarto-listing quarto-listing-container-grid" id="listing-listing">
<div class="list grid quarto-listing-cols-3">
<div class="g-col-1" data-index="0" data-listing-file-modified-sort="1711142091360" data-listing-reading-time-sort="1" data-listing-word-count-sort="144">
<div class="g-col-1" data-index="0" data-listing-file-modified-sort="1711705027571" data-listing-reading-time-sort="1" data-listing-word-count-sort="144">
<a href="../matlab/matlab_functions.html" class="quarto-grid-link">
<div class="quarto-grid-item card h-100 card-left">
<div class="card-body post-contents">
Expand Down
4 changes: 2 additions & 2 deletions docs/search.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions docs/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://Roche.github.io/neuro-meeglet/tutorials/plot_eeg_power.html</loc>
<lastmod>2024-03-22T21:14:51.382Z</lastmod>
<lastmod>2024-03-29T09:37:07.624Z</lastmod>
</url>
<url>
<loc>https://Roche.github.io/neuro-meeglet/tutorials/plot_eeg_covariance.html</loc>
<lastmod>2024-03-22T21:14:51.313Z</lastmod>
<lastmod>2024-03-29T09:37:07.583Z</lastmod>
</url>
<url>
<loc>https://Roche.github.io/neuro-meeglet/api/index.html</loc>
<lastmod>2024-03-22T21:14:51.295Z</lastmod>
<lastmod>2024-03-29T09:37:07.621Z</lastmod>
</url>
<url>
<loc>https://Roche.github.io/neuro-meeglet/matlab/index.html</loc>
<lastmod>2024-03-22T21:14:51.314Z</lastmod>
<lastmod>2024-03-29T09:37:07.587Z</lastmod>
</url>
<url>
<loc>https://Roche.github.io/neuro-meeglet/index.html</loc>
Expand All @@ -30,22 +30,22 @@
</url>
<url>
<loc>https://Roche.github.io/neuro-meeglet/background/index.html</loc>
<lastmod>2024-03-22T21:14:51.307Z</lastmod>
<lastmod>2024-03-29T09:37:07.554Z</lastmod>
</url>
<url>
<loc>https://Roche.github.io/neuro-meeglet/matlab/matlab_functions.html</loc>
<lastmod>2024-03-22T21:14:51.360Z</lastmod>
<lastmod>2024-03-29T09:37:07.571Z</lastmod>
</url>
<url>
<loc>https://Roche.github.io/neuro-meeglet/api/wavelets.html</loc>
<lastmod>2024-03-22T21:14:51.693Z</lastmod>
<lastmod>2024-03-29T09:40:10.280Z</lastmod>
</url>
<url>
<loc>https://Roche.github.io/neuro-meeglet/tutorials/plot_wavelets.html</loc>
<lastmod>2024-03-22T21:14:51.323Z</lastmod>
<lastmod>2024-03-29T09:37:07.618Z</lastmod>
</url>
<url>
<loc>https://Roche.github.io/neuro-meeglet/tutorials/index.html</loc>
<lastmod>2024-03-22T21:14:51.335Z</lastmod>
<lastmod>2024-03-29T09:37:07.627Z</lastmod>
</url>
</urlset>
6 changes: 3 additions & 3 deletions docs/tutorials/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ <h1 class="title">Python tutorials</h1>

<div class="quarto-listing quarto-listing-container-grid" id="listing-listing">
<div class="list grid quarto-listing-cols-3">
<div class="g-col-1" data-index="0" data-listing-file-modified-sort="1711142091323" data-listing-reading-time-sort="1" data-listing-word-count-sort="70">
<div class="g-col-1" data-index="0" data-listing-file-modified-sort="1711705027618" data-listing-reading-time-sort="1" data-listing-word-count-sort="70">
<a href="../tutorials/plot_wavelets.html" class="quarto-grid-link">
<div class="quarto-grid-item card h-100 card-left">
<div class="card-body post-contents">
Expand All @@ -326,7 +326,7 @@ <h5 class="no-anchor card-title listing-title">
</div>
</a>
</div>
<div class="g-col-1" data-index="1" data-listing-file-modified-sort="1711142091313" data-listing-reading-time-sort="3" data-listing-word-count-sort="439">
<div class="g-col-1" data-index="1" data-listing-file-modified-sort="1711705027583" data-listing-reading-time-sort="3" data-listing-word-count-sort="439">
<a href="../tutorials/plot_eeg_covariance.html" class="quarto-grid-link">
<div class="quarto-grid-item card h-100 card-left">
<div class="card-body post-contents">
Expand All @@ -340,7 +340,7 @@ <h5 class="no-anchor card-title listing-title">
</div>
</a>
</div>
<div class="g-col-1" data-index="2" data-listing-file-modified-sort="1711142091382" data-listing-reading-time-sort="2" data-listing-word-count-sort="306">
<div class="g-col-1" data-index="2" data-listing-file-modified-sort="1711705027624" data-listing-reading-time-sort="2" data-listing-word-count-sort="306">
<a href="../tutorials/plot_eeg_power.html" class="quarto-grid-link">
<div class="quarto-grid-item card h-100 card-left">
<div class="card-body post-contents">
Expand Down
2 changes: 1 addition & 1 deletion public/api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ <h1 class="title">Python API overview</h1>

<div class="quarto-listing quarto-listing-container-grid" id="listing-listing">
<div class="list grid quarto-listing-cols-3">
<div class="g-col-1" data-index="0" data-listing-file-modified-sort="1711142091693" data-listing-reading-time-sort="2" data-listing-word-count-sort="256">
<div class="g-col-1" data-index="0" data-listing-file-modified-sort="1711705210280" data-listing-reading-time-sort="2" data-listing-word-count-sort="256">
<a href="../api/wavelets.html" class="quarto-grid-link">
<div class="quarto-grid-item card h-100 card-left">
<div class="card-body post-contents">
Expand Down
Loading

0 comments on commit 2af5208

Please sign in to comment.