Skip to content

Commit

Permalink
clean doc
Browse files Browse the repository at this point in the history
  • Loading branch information
brash6 committed Apr 9, 2024
1 parent 5ec5f69 commit 6a9eb17
Show file tree
Hide file tree
Showing 39 changed files with 7,254 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
pip install sphinx sphinx_rtd_theme myst_parser
- name: Sphinx build
run: |
sphinx-build doc _build
sphinx-build docs _build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Binary file added docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file added docs/_build/doctrees/index.doctree
Binary file not shown.
Binary file added docs/_build/doctrees/modules.doctree
Binary file not shown.
4 changes: 4 additions & 0 deletions docs/_build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +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: a0064967e4db7d108cafad9366e2bc15
tags: 645f666f9bcd5a90fca523b33c5a78b7
188 changes: 188 additions & 0 deletions docs/_build/html/_modules/deepdespeckling/denoiser.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
<!DOCTYPE html>

<html lang="English" data-content_root="../../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>deepdespeckling.denoiser &#8212; deepdespeckling 0.3 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=d1102ebc" />
<link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=12dfc556" />
<script src="../../_static/documentation_options.js?v=cb255500"></script>
<script src="../../_static/doctools.js?v=888ff710"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />

<link rel="stylesheet" href="../../_static/custom.css" type="text/css" />





</head><body>


<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">


<div class="body" role="main">

<h1>Source code for deepdespeckling.denoiser</h1><div class="highlight"><pre>
<span></span><span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">import</span> <span class="nn">torch</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>


<div class="viewcode-block" id="Denoiser">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser">[docs]</a>
<span class="k">class</span> <span class="nc">Denoiser</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Class to share parameters beyond denoising functions</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">device</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_device</span><span class="p">()</span>

<div class="viewcode-block" id="Denoiser.get_device">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser.get_device">[docs]</a>
<span class="k">def</span> <span class="nf">get_device</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Get torch device to use depending on gpu&#39;s availability</span>

<span class="sd"> Returns:</span>
<span class="sd"> device (str): device to be used by torch</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">torch</span><span class="o">.</span><span class="n">backends</span><span class="o">.</span><span class="n">mps</span><span class="o">.</span><span class="n">is_available</span><span class="p">()</span> <span class="ow">and</span> <span class="n">torch</span><span class="o">.</span><span class="n">backends</span><span class="o">.</span><span class="n">mps</span><span class="o">.</span><span class="n">is_built</span><span class="p">():</span>
<span class="n">device</span> <span class="o">=</span> <span class="s2">&quot;mps&quot;</span>
<span class="k">elif</span> <span class="n">torch</span><span class="o">.</span><span class="n">cuda</span><span class="o">.</span><span class="n">is_available</span><span class="p">():</span>
<span class="n">device</span> <span class="o">=</span> <span class="s2">&quot;cuda:0&quot;</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">device</span> <span class="o">=</span> <span class="s2">&quot;cpu&quot;</span>
<span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">device</span><span class="si">}</span><span class="s2"> device is used by torch&quot;</span><span class="p">)</span>

<span class="k">return</span> <span class="n">device</span></div>


<div class="viewcode-block" id="Denoiser.initialize_axis_range">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser.initialize_axis_range">[docs]</a>
<span class="k">def</span> <span class="nf">initialize_axis_range</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">image_axis_dim</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">patch_size</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">stride_size</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">list</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Initialize the convolution range for x or y axis</span>

<span class="sd"> Args:</span>
<span class="sd"> image_axis_dim (int): axis size</span>
<span class="sd"> patch_size (int): patch size</span>
<span class="sd"> stride_size (int): stride size</span>

<span class="sd"> Returns:</span>
<span class="sd"> axis_range (list) : pixel borders of each convolution</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">image_axis_dim</span> <span class="o">==</span> <span class="n">patch_size</span><span class="p">:</span>
<span class="n">axis_range</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">]))</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">axis_range</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span>
<span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">image_axis_dim</span> <span class="o">-</span> <span class="n">patch_size</span><span class="p">,</span> <span class="n">stride_size</span><span class="p">))</span>
<span class="k">if</span> <span class="p">(</span><span class="n">axis_range</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">+</span> <span class="n">patch_size</span><span class="p">)</span> <span class="o">&lt;</span> <span class="n">image_axis_dim</span><span class="p">:</span>
<span class="n">axis_range</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span>
<span class="nb">range</span><span class="p">(</span><span class="n">image_axis_dim</span> <span class="o">-</span> <span class="n">patch_size</span><span class="p">,</span> <span class="n">image_axis_dim</span> <span class="o">-</span> <span class="n">patch_size</span> <span class="o">+</span> <span class="mi">1</span><span class="p">))</span>

<span class="k">return</span> <span class="n">axis_range</span></div>


<div class="viewcode-block" id="Denoiser.save_despeckled_images">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser.save_despeckled_images">[docs]</a>
<span class="k">def</span> <span class="nf">save_despeckled_images</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span></div>


<div class="viewcode-block" id="Denoiser.denoise_image_kernel">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser.denoise_image_kernel">[docs]</a>
<span class="k">def</span> <span class="nf">denoise_image_kernel</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span></div>


<div class="viewcode-block" id="Denoiser.preprocess_denoised_image">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser.preprocess_denoised_image">[docs]</a>
<span class="k">def</span> <span class="nf">preprocess_denoised_image</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span></div>


<div class="viewcode-block" id="Denoiser.denoise_image">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser.denoise_image">[docs]</a>
<span class="k">def</span> <span class="nf">denoise_image</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span></div>


<div class="viewcode-block" id="Denoiser.denoise_images">
<a class="viewcode-back" href="../../modules.html#deepdespeckling.denoiser.Denoiser.denoise_images">[docs]</a>
<span class="k">def</span> <span class="nf">denoise_images</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span></div>
</div>

</pre></div>

</div>

</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="../../index.html">deepdespeckling</a></h1>








<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../modules.html">deepdespeckling</a></li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="../../index.html">Documentation overview</a><ul>
<li><a href="../index.html">Module code</a><ul>
</ul></li>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>








</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&#169;2024, Hadrien Mariaccia, Emanuele Delsasso.

|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 7.2.6</a>
&amp; <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>

</div>




</body>
</html>
Loading

0 comments on commit 6a9eb17

Please sign in to comment.