Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
postpop committed Mar 14, 2024
1 parent 9d2a994 commit d9dc125
Show file tree
Hide file tree
Showing 104 changed files with 3,436 additions and 1,601 deletions.
2 changes: 1 addition & 1 deletion .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: 0d0cb37fa096d078f78dc57c0de1cd95
config: f2b6eff1bd81e97cf224aeba3a01bf82
tags: 645f666f9bcd5a90fca523b33c5a78b7
44 changes: 19 additions & 25 deletions _modules/das/predict.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark"><link rel="index" title="Index" href="../../genindex.html" /><link rel="search" title="Search" href="../../search.html" />

<meta name="generator" content="sphinx-4.5.0, furo 2022.06.21"/>
<!-- Generated with Sphinx 4.5.0 and Furo 2023.03.27 -->
<title>das.predict - DAS documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" />
<link rel="stylesheet" type="text/css" href="../../_static/mystnb.css" />
<link rel="stylesheet" type="text/css" href="../../_static/togglebutton.css" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?digest=fad236701ea90a88636c2a8c73b44ae642ed2a53" />
<link rel="stylesheet" type="text/css" href="../../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<link rel="stylesheet" type="text/css" href="../../_static/tabs.css" />
<link rel="stylesheet" type="text/css" href="../../_static/panels-main.c949a650a448cc0ae9fd3441c0e17fb0.css" />
<link rel="stylesheet" type="text/css" href="../../_static/panels-bootstrap.5fd3999ee7762ccc51105388f4a9d115.css" />
Expand Down Expand Up @@ -157,7 +156,7 @@


</a><form class="sidebar-search-container" method="get" action="../../search.html" role="search">
<input class="sidebar-search" placeholder=Search name="q" aria-label="Search">
<input class="sidebar-search" placeholder="Search" name="q" aria-label="Search">
<input type="hidden" name="check_keywords" value="yes">
<input type="hidden" name="area" value="default">
</form>
Expand Down Expand Up @@ -298,7 +297,7 @@ <h1>Source code for das.predict</h1><div class="highlight"><pre>
<span class="n">verbose</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span>
<span class="n">prepend_data_padding</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span>
<span class="p">):</span>
<span class="sd">&quot;&quot;&quot;[summary]</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;[summary]</span>

<span class="sd"> Args:</span>
<span class="sd"> x ([samples, ...]): [description]</span>
Expand Down Expand Up @@ -350,7 +349,7 @@ <h1>Source code for das.predict</h1><div class="highlight"><pre>
<div class="viewcode-block" id="labels_from_probabilities"><a class="viewcode-back" href="../../api/das.predict.html#das.predict.labels_from_probabilities">[docs]</a><span class="k">def</span> <span class="nf">labels_from_probabilities</span><span class="p">(</span>
<span class="n">probabilities</span><span class="p">,</span> <span class="n">threshold</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">indices</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="n">Sequence</span><span class="p">[</span><span class="nb">int</span><span class="p">],</span> <span class="nb">slice</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;Convert class-wise probabilities into labels.</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Convert class-wise probabilities into labels.</span>

<span class="sd"> Args:</span>
<span class="sd"> probabilities ([type]): [samples, classes] or [samples, ]</span>
Expand Down Expand Up @@ -395,7 +394,7 @@ <h1>Source code for das.predict</h1><div class="highlight"><pre>
<span class="n">segment_fillgap</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<span class="n">segment_labels_by_majority</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Dict</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;[summary]</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;[summary]</span>

<span class="sd"> TODO: document different approaches for single-type vs. multi-type segment detection</span>

Expand Down Expand Up @@ -526,7 +525,7 @@ <h1>Source code for das.predict</h1><div class="highlight"><pre>
<span class="k">def</span> <span class="nf">_detect_events_oom</span><span class="p">(</span>
<span class="n">event_probability</span><span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">,</span> <span class="n">thres</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.70</span><span class="p">,</span> <span class="n">min_dist</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">100</span><span class="p">,</span> <span class="n">index</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">block_info</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">pad</span><span class="o">=</span><span class="mi">0</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;Wrapper around detect_events that returns 2D np.ndarray for use in predict_oom.&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Wrapper around detect_events that returns 2D np.ndarray for use in predict_oom.&quot;&quot;&quot;</span>
<span class="n">event_indices</span><span class="p">,</span> <span class="n">event_confidence</span> <span class="o">=</span> <span class="n">event_utils</span><span class="o">.</span><span class="n">detect_events</span><span class="p">(</span><span class="n">event_probability</span><span class="p">,</span> <span class="n">thres</span><span class="p">,</span> <span class="n">min_dist</span><span class="p">,</span> <span class="n">index</span><span class="p">)</span>

<span class="k">if</span> <span class="n">block_info</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
Expand Down Expand Up @@ -561,7 +560,7 @@ <h1>Source code for das.predict</h1><div class="highlight"><pre>
<span class="n">event_dist_min</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span>
<span class="n">event_dist_max</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">inf</span><span class="p">,</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">]:</span>
<span class="sd">&quot;&quot;&quot;[summary]</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;[summary]</span>

<span class="sd"> Args:</span>
<span class="sd"> class_probabilities (np.ndarray): [samples, classes][description]</span>
Expand Down Expand Up @@ -697,7 +696,7 @@ <h1>Source code for das.predict</h1><div class="highlight"><pre>
<span class="n">prepend_data_padding</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span>
<span class="n">save_memory</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span>
<span class="p">):</span>
<span class="sd">&quot;&quot;&quot;[summary]</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;[summary]</span>

<span class="sd"> Usage:</span>
<span class="sd"> Calling predict with the path to the model will load the model and the</span>
Expand Down Expand Up @@ -816,7 +815,8 @@ <h1>Source code for das.predict</h1><div class="highlight"><pre>
<span class="n">segments</span><span class="p">[</span><span class="s2">&quot;probabilities&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">_to_np</span><span class="p">(</span><span class="n">segments</span><span class="p">[</span><span class="s2">&quot;probabilities&quot;</span><span class="p">])</span>
<span class="n">segments</span><span class="p">[</span><span class="s2">&quot;samples&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">_to_np</span><span class="p">(</span><span class="n">segments</span><span class="p">[</span><span class="s2">&quot;samples&quot;</span><span class="p">])</span>
<span class="n">class_probabilities</span> <span class="o">=</span> <span class="n">_to_np</span><span class="p">(</span><span class="n">class_probabilities</span><span class="p">)</span>
<span class="n">class_probabilities</span><span class="o">.</span><span class="n">temp_dir</span> <span class="o">=</span> <span class="n">temp_dir</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">class_probabilities</span><span class="o">.</span><span class="n">temp_dir</span> <span class="o">=</span> <span class="n">temp_dir</span>
<span class="k">return</span> <span class="n">events</span><span class="p">,</span> <span class="n">segments</span><span class="p">,</span> <span class="n">class_probabilities</span><span class="p">,</span> <span class="n">params</span><span class="p">[</span><span class="s2">&quot;class_names&quot;</span><span class="p">]</span></div>


Expand Down Expand Up @@ -846,7 +846,7 @@ <h1>Source code for das.predict</h1><div class="highlight"><pre>
<span class="n">bandpass_up_freq</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span>
<span class="n">resample</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span>
<span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Predict song labels for a wav file or a folder of wav files.</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Predict song labels for a wav file or a folder of wav files.</span>

<span class="sd"> Saves hdf5 files with keys: events, segments, class_probabilities</span>
<span class="sd"> OR csv files with columns: label/start_seconds/stop_seconds</span>
Expand Down Expand Up @@ -976,10 +976,11 @@ <h1>Source code for das.predict</h1><div class="highlight"><pre>
<span class="n">evt</span><span class="o">.</span><span class="n">to_df</span><span class="p">()</span><span class="o">.</span><span class="n">to_csv</span><span class="p">(</span><span class="n">save_filename</span><span class="p">)</span>
<span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Done.&quot;</span><span class="p">)</span>
<span class="c1"># reset</span>
<span class="n">temp_dir</span> <span class="o">=</span> <span class="n">class_probabilities</span><span class="o">.</span><span class="n">temp_dir</span>
<span class="k">del</span> <span class="n">class_probabilities</span>
<span class="n">shutil</span><span class="o">.</span><span class="n">rmtree</span><span class="p">(</span><span class="n">temp_dir</span><span class="p">,</span> <span class="n">ignore_errors</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">temp_dir</span><span class="p">))</span>
<span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">class_probabilities</span><span class="p">,</span> <span class="s2">&quot;temp_dir&quot;</span><span class="p">):</span>
<span class="n">temp_dir</span> <span class="o">=</span> <span class="n">class_probabilities</span><span class="o">.</span><span class="n">temp_dir</span>
<span class="k">del</span> <span class="n">class_probabilities</span>
<span class="n">shutil</span><span class="o">.</span><span class="n">rmtree</span><span class="p">(</span><span class="n">temp_dir</span><span class="p">,</span> <span class="n">ignore_errors</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>

<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
<span class="n">save_filename</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span>
Expand All @@ -1004,9 +1005,7 @@ <h1>Source code for das.predict</h1><div class="highlight"><pre>

</div>
<div class="right-details">
<div class="icons">

</div>

</div>
</div>

Expand All @@ -1024,11 +1023,6 @@ <h1>Source code for das.predict</h1><div class="highlight"><pre>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/scripts/furo.js"></script>
<script src="../../_static/tabs.js"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
<script>let toggleOpenOnPrint = 'true';</script>
<script src="../../_static/togglebutton.js"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown, .tag_hide_input div.cell_input, .tag_hide-input div.cell_input, .tag_hide_output div.cell_output, .tag_hide-output div.cell_output, .tag_hide_cell.cell, .tag_hide-cell.cell';</script>
<script src="../../_static/sphinxcontrib-images/LightBox2/lightbox2/dist/js/lightbox-plus-jquery.min.js"></script>
<script src="../../_static/sphinxcontrib-images/LightBox2/lightbox2-customize/jquery-noconflict.js"></script>
</body>
Expand Down
18 changes: 5 additions & 13 deletions _modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark"><link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" />

<meta name="generator" content="sphinx-4.5.0, furo 2022.06.21"/>
<!-- Generated with Sphinx 4.5.0 and Furo 2023.03.27 -->
<title>Overview: module code - DAS documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.css" />
<link rel="stylesheet" type="text/css" href="../_static/togglebutton.css" />
<link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=fad236701ea90a88636c2a8c73b44ae642ed2a53" />
<link rel="stylesheet" type="text/css" href="../_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<link rel="stylesheet" type="text/css" href="../_static/tabs.css" />
<link rel="stylesheet" type="text/css" href="../_static/panels-main.c949a650a448cc0ae9fd3441c0e17fb0.css" />
<link rel="stylesheet" type="text/css" href="../_static/panels-bootstrap.5fd3999ee7762ccc51105388f4a9d115.css" />
Expand Down Expand Up @@ -157,7 +156,7 @@


</a><form class="sidebar-search-container" method="get" action="../search.html" role="search">
<input class="sidebar-search" placeholder=Search name="q" aria-label="Search">
<input class="sidebar-search" placeholder="Search" name="q" aria-label="Search">
<input type="hidden" name="check_keywords" value="yes">
<input type="hidden" name="area" value="default">
</form>
Expand Down Expand Up @@ -326,9 +325,7 @@ <h1>All modules for which code is available</h1>

</div>
<div class="right-details">
<div class="icons">

</div>

</div>
</div>

Expand All @@ -346,11 +343,6 @@ <h1>All modules for which code is available</h1>
<script src="../_static/doctools.js"></script>
<script src="../_static/scripts/furo.js"></script>
<script src="../_static/tabs.js"></script>
<script>let toggleHintShow = 'Click to show';</script>
<script>let toggleHintHide = 'Click to hide';</script>
<script>let toggleOpenOnPrint = 'true';</script>
<script src="../_static/togglebutton.js"></script>
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown, .tag_hide_input div.cell_input, .tag_hide-input div.cell_input, .tag_hide_output div.cell_output, .tag_hide-output div.cell_output, .tag_hide_cell.cell, .tag_hide-cell.cell';</script>
<script src="../_static/sphinxcontrib-images/LightBox2/lightbox2/dist/js/lightbox-plus-jquery.min.js"></script>
<script src="../_static/sphinxcontrib-images/LightBox2/lightbox2-customize/jquery-noconflict.js"></script>
</body>
Expand Down
4 changes: 2 additions & 2 deletions _sources/installation.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Create an anaconda environment called `das` that contains all the required packa
On windows
```shell
conda install mamba -c conda-forge -n base -y
mamba create python=3.9 das=0.32.1 "numpy<1.24" -c conda-forge -c ncb -c anaconda -c nvidia -n das -y
mamba create python=3.9 das=0.32.2 "numpy<1.24" -c conda-forge -c ncb -c anaconda -c nvidia -n das -y
```

On Linux or MacOS (intel and arm):
```shell
conda install mamba -c conda-forge -n base -y
mamba create python=3.10 das=0.32.1 -c conda-forge -c ncb -c anaconda -c nvidia -c apple -n das -y
mamba create python=3.10 das=0.32.2 -c conda-forge -c ncb -c anaconda -c nvidia -c apple -n das -y
```


Expand Down
2 changes: 1 addition & 1 deletion _static/debug.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ body {
.sb-footer__inner {
background: salmon;
}
[role="main"] {
.sb-article {
background: white;
}
Loading

0 comments on commit d9dc125

Please sign in to comment.