add ode solver, tests and update docs

This commit is contained in:
2019-05-26 21:54:58 +02:00
parent 184e80269b
commit d0873a36da
33 changed files with 1821 additions and 396 deletions

View File

@@ -13,6 +13,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
@@ -33,26 +34,32 @@
<div class="section" id="module-fit">
<span id="fit-module"></span><h1>fit module<a class="headerlink" href="#module-fit" title="Permalink to this headline"></a></h1>
<dl class="function">
<p>Function and approximation.</p>
<span class="target" id="module-fit"></span><dl class="function">
<dt id="fit.gauss">
<code class="descname">gauss</code><span class="sig-paren">(</span><em>x</em>, <em>*p</em><span class="sig-paren">)</span><a class="headerlink" href="#fit.gauss" title="Permalink to this definition"></a></dt>
<dd><p>Gauss distribution function.</p>
<div class="math notranslate nohighlight">
\[f(x)=ae^{-(x-b)^{2}/(2c^{2})}\]</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>x</strong> positions where the gauss function will be calculated</p></li>
<li><p><strong>p</strong> <p>gauss parameters [a, b, c, d]:</p>
<li><p><strong>x</strong> (<em>int</em><em> or </em><em>float</em><em> or </em><em>list</em><em> or </em><em>numpy.ndarray</em>) positions where the gauss function will be calculated</p></li>
<li><p><strong>p</strong> (<em>list</em>) <p>gauss parameters [a, b, c, d]:</p>
<ul>
<li><p>a amplitude (integral = 1 if a = 1/(c*sqrt(2*pi)))</p></li>
<li><p>b expected value mu (position of maximum, default = 0)</p></li>
<li><p>c standard deviation sigma (variance sigma**2 = c**2)</p></li>
<li><p>a amplitude (<span class="math notranslate nohighlight">\(\int y \,\mathrm{d}x=1 \Leftrightarrow a=1/(c\sqrt{2\pi})\)</span> )</p></li>
<li><p>b expected value <span class="math notranslate nohighlight">\(\mu\)</span> (position of maximum, default = 0)</p></li>
<li><p>c standard deviation <span class="math notranslate nohighlight">\(\sigma\)</span> (variance <span class="math notranslate nohighlight">\(\sigma^2=c^2\)</span>)</p></li>
<li><p>d vertical offset (default = 0)</p></li>
</ul>
</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>array gauss values at given positions x</p>
<dd class="field-even"><p>gauss values at given positions x</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>numpy.ndarray</p>
</dd>
</dl>
</dd></dl>
@@ -64,22 +71,32 @@
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>x</strong> positions</p></li>
<li><p><strong>y</strong> values</p></li>
<li><p><strong>e</strong> error values</p></li>
<li><p><strong>x_fit</strong> positions of fitted function (default steps is 3*len(x) but min 150)</p></li>
<li><p><strong>x</strong> (<em>int</em><em> or </em><em>float</em><em> or </em><em>list</em><em> or </em><em>numpy.ndarray</em>) positions</p></li>
<li><p><strong>y</strong> (<em>int</em><em> or </em><em>float</em><em> or </em><em>list</em><em> or </em><em>numpy.ndarray</em>) values</p></li>
<li><p><strong>e</strong> (<em>int</em><em> or </em><em>float</em><em> or </em><em>list</em><em> or </em><em>numpy.ndarray</em>) error values (default = None)</p></li>
<li><p><strong>x_fit</strong> (<em>int</em><em> or </em><em>float</em><em> or </em><em>list</em><em> or </em><em>numpy.ndarray</em>) positions of fitted function (default = None, if None then x
is used)</p></li>
<li><p><strong>verbose</strong> (<em>bool</em>) verbose information (default = False)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>y_fit values</p></li>
<li><p>popt parameters of gauss distribution function (amplitude a, expected
value mu, standard deviation sigma, vertical offset d)</p></li>
<li><p>FWHM full width at half maximum</p></li>
<li><p>numpy.ndarray fitted values (y_fit)</p></li>
<li><p>numpy.ndarray parameters of gauss distribution function (popt:
amplitude a, expected value <span class="math notranslate nohighlight">\(\mu\)</span>, standard deviation
<span class="math notranslate nohighlight">\(\sigma\)</span>, vertical offset d)</p></li>
<li><p>numpy.float64 full width at half maximum (FWHM)</p></li>
</ul>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>tuple</p>
</dd>
</dl>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#fit.gauss" title="fit.gauss"><code class="xref py py-meth docutils literal notranslate"><span class="pre">gauss()</span></code></a></p>
</div>
</dd></dl>
<dl class="function">