Skip to content

Commit

Permalink
further fixes rc6
Browse files Browse the repository at this point in the history
  • Loading branch information
dengemann committed Mar 22, 2024
1 parent cd4dafe commit fbb6cfc
Show file tree
Hide file tree
Showing 22 changed files with 71 additions and 91 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="1711120690280" 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="1711142091693" 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
4 changes: 2 additions & 2 deletions docs/api/wavelets.html
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ <h3 class="anchored" data-anchor-id="plot_wavelet_family">plot_wavelet_family</h
<pre><code> plot_wavelet_family (wavelets:list, foi:numpy.ndarray,
sampling_rate:float=1000.0, cmap:matplotlib.colors.C
olormap=&lt;matplotlib.colors.ListedColormap object at
0x164daee60&gt;, f_scale:str='linear',
0x149626f50&gt;, f_scale:str='linear',
scale:Union[float,int]=4, fmin:Union[float,int]=0,
fmax:Union[float,int]=120)</code></pre>
</blockquote>
Expand Down Expand Up @@ -1018,7 +1018,7 @@ <h3 class="anchored" data-anchor-id="plot_wavelet_family">plot_wavelet_family</h
<tr class="even">
<td>cmap</td>
<td>Colormap</td>
<td>&lt;matplotlib.colors.ListedColormap object at 0x164daee60&gt;</td>
<td>&lt;matplotlib.colors.ListedColormap object at 0x149626f50&gt;</td>
<td>Colormap.</td>
</tr>
<tr class="odd">
Expand Down
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="144069cb" class="cell" data-execution_count="1">
<div id="63521146" 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="4e6eca69" class="cell" data-execution_count="2">
<div id="32ea87ba" 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="73872a4a" class="cell" data-execution_count="3">
<div id="b0f2cff0" 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="7b8db621" class="cell" data-execution_count="2">
<div id="e65f41e0" 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="0396c1f8" class="cell" data-execution_count="3">
<div id="65c1c702" 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
12 changes: 6 additions & 6 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,9 @@ <h2 id="toc-title">On this page</h2>

<ul>
<li><a href="#documentation" id="toc-documentation" class="nav-link active" data-scroll-target="#documentation">Documentation</a></li>
<li><a href="#installation" id="toc-installation" class="nav-link" data-scroll-target="#installation">Installation</a></li>
<li><a href="#from-pypi" id="toc-from-pypi" class="nav-link" data-scroll-target="#from-pypi">from PyPi</a>
<li><a href="#installation" id="toc-installation" class="nav-link" data-scroll-target="#installation">Installation</a>
<ul>
<li><a href="#from-pypi" id="toc-from-pypi" class="nav-link" data-scroll-target="#from-pypi">from PyPi</a></li>
<li><a href="#from-the-sources" id="toc-from-the-sources" class="nav-link" data-scroll-target="#from-the-sources">from the sources</a></li>
</ul></li>
<li><a href="#citation" id="toc-citation" class="nav-link" data-scroll-target="#citation">Citation</a></li>
Expand Down 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="0e2c9051" class="cell" data-execution_count="1">
<div id="747a2d1b" 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 Expand Up @@ -376,11 +376,11 @@ <h2 class="anchored" data-anchor-id="documentation">Documentation</h2>
</section>
<section id="installation" class="level2">
<h2 class="anchored" data-anchor-id="installation">Installation</h2>
</section>
<section id="from-pypi" class="level2">
<h2 class="anchored" data-anchor-id="from-pypi">from PyPi</h2>
<section id="from-pypi" class="level3">
<h3 class="anchored" data-anchor-id="from-pypi">from PyPi</h3>
<p>In your environment of choice, use pip to install meeglet:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">pip</span> install meeglet</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</section>
<section id="from-the-sources" class="level3">
<h3 class="anchored" data-anchor-id="from-the-sources">from the sources</h3>
<p>Please clone the software, consider installing the dependencies listed in the `environment.yml.</p>
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="1711120690095" 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="1711142091360" 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
Loading

0 comments on commit fbb6cfc

Please sign in to comment.