Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Nov 12, 2024
1 parent 19c1935 commit 2af12ea
Show file tree
Hide file tree
Showing 25 changed files with 523 additions and 8,980 deletions.
26 changes: 17 additions & 9 deletions sed/develop/_modules/sed/calibrator/energy.html
Original file line number Diff line number Diff line change
Expand Up @@ -814,11 +814,11 @@ <h1>Source code for sed.calibrator.energy</h1><div class="highlight"><pre>

<span class="c1"># make plot</span>
<span class="n">labels</span> <span class="o">=</span> <span class="n">kwds</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;labels&quot;</span><span class="p">,</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> <span class="o">+</span> <span class="s2">&quot; V&quot;</span> <span class="k">for</span> <span class="n">b</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">biases</span><span class="p">])</span>
<span class="n">figsize</span> <span class="o">=</span> <span class="n">kwds</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;figsize&quot;</span><span class="p">,</span> <span class="p">(</span><span class="mi">8</span><span class="p">,</span> <span class="mi">4</span><span class="p">))</span>
<span class="n">figsize</span> <span class="o">=</span> <span class="n">kwds</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;figsize&quot;</span><span class="p">,</span> <span class="p">(</span><span class="mi">6</span><span class="p">,</span> <span class="mi">4</span><span class="p">))</span>
<span class="n">plot_segs</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">plot_peaks</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">fig</span><span class="p">,</span> <span class="n">ax</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplots</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="n">figsize</span><span class="p">)</span>
<span class="n">colors</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">get_cmap</span><span class="p">(</span><span class="s2">&quot;rainbow&quot;</span><span class="p">)(</span><span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">traces</span><span class="p">)))</span>
<span class="n">colors</span> <span class="o">=</span> <span class="n">it</span><span class="o">.</span><span class="n">cycle</span><span class="p">(</span><span class="n">plt</span><span class="o">.</span><span class="n">rcParams</span><span class="p">[</span><span class="s2">&quot;axes.prop_cycle&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">by_key</span><span class="p">()[</span><span class="s2">&quot;color&quot;</span><span class="p">])</span>
<span class="k">for</span> <span class="n">itr</span><span class="p">,</span> <span class="n">color</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">traces</span><span class="p">)),</span> <span class="n">colors</span><span class="p">):</span>
<span class="n">trace</span> <span class="o">=</span> <span class="n">traces</span><span class="p">[</span><span class="n">itr</span><span class="p">,</span> <span class="p">:]</span>
<span class="c1"># main traces</span>
Expand All @@ -841,6 +841,9 @@ <h1>Source code for sed.calibrator.energy</h1><div class="highlight"><pre>
<span class="n">plot_peaks</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">scatt</span><span class="p">)</span>
<span class="n">ax</span><span class="o">.</span><span class="n">legend</span><span class="p">(</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span> <span class="n">loc</span><span class="o">=</span><span class="s2">&quot;upper right&quot;</span><span class="p">)</span>
<span class="n">ax</span><span class="o">.</span><span class="n">set_title</span><span class="p">(</span><span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s2">&quot;Time-of-flight&quot;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s2">&quot;Intensity&quot;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">tight_layout</span><span class="p">()</span>

<span class="k">def</span> <span class="nf">update</span><span class="p">(</span><span class="n">refid</span><span class="p">,</span> <span class="n">ranges</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">add_ranges</span><span class="p">(</span><span class="n">ranges</span><span class="p">,</span> <span class="n">refid</span><span class="p">,</span> <span class="n">traces</span><span class="o">=</span><span class="n">traces</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
Expand Down Expand Up @@ -1139,15 +1142,19 @@ <h1>Source code for sed.calibrator.energy</h1><div class="highlight"><pre>

<span class="n">sign</span> <span class="o">=</span> <span class="mi">1</span> <span class="k">if</span> <span class="n">energy_scale</span> <span class="o">==</span> <span class="s2">&quot;kinetic&quot;</span> <span class="k">else</span> <span class="o">-</span><span class="mi">1</span>

<span class="n">figsize</span> <span class="o">=</span> <span class="n">kwds</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;figsize&quot;</span><span class="p">,</span> <span class="p">(</span><span class="mi">6</span><span class="p">,</span> <span class="mi">4</span><span class="p">))</span>

<span class="k">if</span> <span class="n">backend</span> <span class="o">==</span> <span class="s2">&quot;matplotlib&quot;</span><span class="p">:</span>
<span class="n">figsize</span> <span class="o">=</span> <span class="n">kwds</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;figsize&quot;</span><span class="p">,</span> <span class="p">(</span><span class="mi">6</span><span class="p">,</span> <span class="mi">4</span><span class="p">))</span>
<span class="n">fig_plt</span><span class="p">,</span> <span class="n">ax</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplots</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="n">figsize</span><span class="p">)</span>
<span class="k">for</span> <span class="n">itr</span><span class="p">,</span> <span class="n">trace</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">traces</span><span class="p">):</span>
<span class="n">colors</span> <span class="o">=</span> <span class="n">it</span><span class="o">.</span><span class="n">cycle</span><span class="p">(</span><span class="n">plt</span><span class="o">.</span><span class="n">rcParams</span><span class="p">[</span><span class="s2">&quot;axes.prop_cycle&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">by_key</span><span class="p">()[</span><span class="s2">&quot;color&quot;</span><span class="p">])</span>
<span class="n">_</span><span class="p">,</span> <span class="n">ax</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplots</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="n">figsize</span><span class="p">)</span>
<span class="k">for</span> <span class="n">itr</span><span class="p">,</span> <span class="n">color</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">traces</span><span class="p">)),</span> <span class="n">colors</span><span class="p">):</span>
<span class="n">trace</span> <span class="o">=</span> <span class="n">traces</span><span class="p">[</span><span class="n">itr</span><span class="p">,</span> <span class="p">:]</span>
<span class="k">if</span> <span class="n">align</span><span class="p">:</span>
<span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span>
<span class="n">xaxis</span> <span class="o">+</span> <span class="n">sign</span> <span class="o">*</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">biases</span><span class="p">[</span><span class="n">itr</span><span class="p">]),</span>
<span class="n">trace</span><span class="p">,</span>
<span class="n">ls</span><span class="o">=</span><span class="s2">&quot;-&quot;</span><span class="p">,</span>
<span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span>
<span class="n">linewidth</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
<span class="n">label</span><span class="o">=</span><span class="n">lbs</span><span class="p">[</span><span class="n">itr</span><span class="p">],</span>
<span class="o">**</span><span class="n">linekwds</span><span class="p">,</span>
Expand All @@ -1157,6 +1164,7 @@ <h1>Source code for sed.calibrator.energy</h1><div class="highlight"><pre>
<span class="n">xaxis</span><span class="p">,</span>
<span class="n">trace</span><span class="p">,</span>
<span class="n">ls</span><span class="o">=</span><span class="s2">&quot;-&quot;</span><span class="p">,</span>
<span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span>
<span class="n">linewidth</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
<span class="n">label</span><span class="o">=</span><span class="n">lbs</span><span class="p">[</span><span class="n">itr</span><span class="p">],</span>
<span class="o">**</span><span class="n">linekwds</span><span class="p">,</span>
Expand All @@ -1171,6 +1179,7 @@ <h1>Source code for sed.calibrator.energy</h1><div class="highlight"><pre>
<span class="n">tofseg</span><span class="p">,</span>
<span class="n">traceseg</span><span class="p">,</span>
<span class="n">ls</span><span class="o">=</span><span class="s2">&quot;-&quot;</span><span class="p">,</span>
<span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span>
<span class="n">linewidth</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span>
<span class="o">**</span><span class="n">linesegkwds</span><span class="p">,</span>
<span class="p">)</span>
Expand All @@ -1185,7 +1194,7 @@ <h1>Source code for sed.calibrator.energy</h1><div class="highlight"><pre>

<span class="k">if</span> <span class="n">show_legend</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">ax</span><span class="o">.</span><span class="n">legend</span><span class="p">(</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">12</span><span class="p">,</span> <span class="o">**</span><span class="n">legkwds</span><span class="p">)</span>
<span class="n">ax</span><span class="o">.</span><span class="n">legend</span><span class="p">(</span><span class="n">fontsize</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span> <span class="n">loc</span><span class="o">=</span><span class="s2">&quot;upper right&quot;</span><span class="p">,</span> <span class="o">**</span><span class="n">legkwds</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">TypeError</span><span class="p">:</span>
<span class="k">pass</span>

Expand All @@ -1196,11 +1205,10 @@ <h1>Source code for sed.calibrator.energy</h1><div class="highlight"><pre>
<span class="n">colors</span> <span class="o">=</span> <span class="n">it</span><span class="o">.</span><span class="n">cycle</span><span class="p">(</span><span class="n">ColorCycle</span><span class="p">[</span><span class="mi">10</span><span class="p">])</span>
<span class="n">ttp</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">&quot;(x, y)&quot;</span><span class="p">,</span> <span class="s2">&quot;($x, $y)&quot;</span><span class="p">)]</span>

<span class="n">figsize</span> <span class="o">=</span> <span class="n">kwds</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;figsize&quot;</span><span class="p">,</span> <span class="p">(</span><span class="mi">800</span><span class="p">,</span> <span class="mi">300</span><span class="p">))</span>
<span class="n">fig</span> <span class="o">=</span> <span class="n">pbk</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span>
<span class="n">title</span><span class="o">=</span><span class="n">ttl</span><span class="p">,</span>
<span class="n">width</span><span class="o">=</span><span class="n">figsize</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
<span class="n">height</span><span class="o">=</span><span class="n">figsize</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span>
<span class="n">width</span><span class="o">=</span><span class="n">figsize</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">*</span> <span class="mi">100</span><span class="p">,</span>
<span class="n">height</span><span class="o">=</span><span class="n">figsize</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">*</span> <span class="mi">100</span><span class="p">,</span>
<span class="n">tooltips</span><span class="o">=</span><span class="n">ttp</span><span class="p">,</span>
<span class="p">)</span>
<span class="c1"># Plotting the main traces</span>
Expand Down
Loading

0 comments on commit 2af12ea

Please sign in to comment.