Skip to content

Commit 5e0c9ca

Browse files
committed
deploy: bb7d151
1 parent a701eb2 commit 5e0c9ca

File tree

47 files changed

+519
-547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+519
-547
lines changed

tutorials/1_models-quick-fit.html

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ <h2>2) Fit a Polynomial model: Choose fitter wisely<a class="headerlink" href="#
690690
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Text(0, 0.5, &#39;$y_1$&#39;)
691691
</pre></div>
692692
</div>
693-
<img alt="_images/2c7430868a31864c453bf6eeea774904986f6b0a38904187dab38931519020fe.png" src="_images/2c7430868a31864c453bf6eeea774904986f6b0a38904187dab38931519020fe.png" />
693+
<img alt="_images/b206e7e157616fe49c4578d4e72c813d4fe0ebdbfaf76532566fee6111aacffb.png" src="_images/b206e7e157616fe49c4578d4e72c813d4fe0ebdbfaf76532566fee6111aacffb.png" />
694694
</div>
695695
</div>
696696
<p>To fit this data let’s remember the three steps: model, fitter and perform fit.</p>
@@ -716,9 +716,9 @@ <h2>2) Fit a Polynomial model: Choose fitter wisely<a class="headerlink" href="#
716716
Model set size: 1
717717
Degree: 3
718718
Parameters:
719-
c0 c1 c2 c3
720-
------------------ ------------------ ------------------ ------------------
721-
-8.474181693465024 11.266137297252593 -5.502843775502853 0.8973360354644486
719+
c0 c1 c2 c3
720+
----------------- ----------------- ------------------ ------------------
721+
-9.12800757901219 12.77469171003877 -6.575706598856835 1.1054564059454586
722722
</pre></div>
723723
</div>
724724
</div>
@@ -751,9 +751,9 @@ <h2>2) Fit a Polynomial model: Choose fitter wisely<a class="headerlink" href="#
751751
Model set size: 1
752752
Degree: 3
753753
Parameters:
754-
c0 c1 c2 c3
755-
------------------- ------------------- ------------------- -------------------
756-
-0.0940845418190468 -0.2695751224157016 -0.8510531934902894 0.32231617541725033
754+
c0 c1 c2 c3
755+
----------------- -------------------- ------------------- -------------------
756+
0.448425931971312 -0.19628287661401733 -0.8790022925273284 0.31732388584772475
757757
</pre></div>
758758
</div>
759759
</div>
@@ -788,7 +788,7 @@ <h3>Compare results<a class="headerlink" href="#compare-results" title="Link to
788788
</div>
789789
</div>
790790
<div class="cell_output docutils container">
791-
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Reduced Chi Squared with LinearLSQFitter: 2.0380848248340815
791+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Reduced Chi Squared with LinearLSQFitter: 1.5151632695641253
792792
</pre></div>
793793
</div>
794794
</div>
@@ -801,7 +801,7 @@ <h3>Compare results<a class="headerlink" href="#compare-results" title="Link to
801801
</div>
802802
</div>
803803
<div class="cell_output docutils container">
804-
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Reduced Chi Squared with SimplexLSQFitter: 4.645859203398919
804+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Reduced Chi Squared with SimplexLSQFitter: 5.108396459855349
805805
</pre></div>
806806
</div>
807807
</div>
@@ -820,10 +820,10 @@ <h3>Compare results<a class="headerlink" href="#compare-results" title="Link to
820820
</div>
821821
</div>
822822
<div class="cell_output docutils container">
823-
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7f5ca2a27e30&gt;
823+
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7f6f6fc23b90&gt;
824824
</pre></div>
825825
</div>
826-
<img alt="_images/8d0f7ce9cbb7be0373bb7283110b71eb162d92d1e3788929088008f7ec559b79.png" src="_images/8d0f7ce9cbb7be0373bb7283110b71eb162d92d1e3788929088008f7ec559b79.png" />
826+
<img alt="_images/a778877b480f6d98adf60320ed335116426b5908b8f05bb629cd263e8b15f03f.png" src="_images/a778877b480f6d98adf60320ed335116426b5908b8f05bb629cd263e8b15f03f.png" />
827827
</div>
828828
</div>
829829
<p>Results are as espected, the fit performed with the linear fitter is better than the second, non linear one.</p>
@@ -860,7 +860,7 @@ <h2>3) Fit a Gaussian: Let’s compare to scipy<a class="headerlink" href="#fit-
860860
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Text(0, 0.5, &#39;$y_2$&#39;)
861861
</pre></div>
862862
</div>
863-
<img alt="_images/c31c511b4804dad58698e20d1a40cf477946ac56000b20e07b23866cf24791d6.png" src="_images/c31c511b4804dad58698e20d1a40cf477946ac56000b20e07b23866cf24791d6.png" />
863+
<img alt="_images/2490abbcc794c140fa0a5e1f8580b93769ebc35a8ea0d36a888ce01cb3c6ec40.png" src="_images/2490abbcc794c140fa0a5e1f8580b93769ebc35a8ea0d36a888ce01cb3c6ec40.png" />
864864
</div>
865865
</div>
866866
<p>Let’s do our three steps to make the fit we want. For this fit we’re going to use a non-linear fitter, <code class="docutils literal notranslate"><span class="pre">LevMarLSQFitter</span></code>, because the model we need (<code class="docutils literal notranslate"><span class="pre">Gaussian1D</span></code>) is non-linear in the parameters.</p>
@@ -885,9 +885,9 @@ <h2>3) Fit a Gaussian: Let’s compare to scipy<a class="headerlink" href="#fit-
885885
Outputs: (&#39;y&#39;,)
886886
Model set size: 1
887887
Parameters:
888-
amplitude mean stddev
889-
----------------- ------------------ ------------------
890-
9.919351213300535 0.3726248055188302 10.319677387647905
888+
amplitude mean stddev
889+
----------------- -------------------- -----------------
890+
10.25380980329387 -0.34280774429380745 9.449824403814645
891891
</pre></div>
892892
</div>
893893
</div>
@@ -913,7 +913,7 @@ <h2>3) Fit a Gaussian: Let’s compare to scipy<a class="headerlink" href="#fit-
913913
</div>
914914
</div>
915915
<div class="cell_output docutils container">
916-
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[0.04977461 0.07176987 0.07212312]
916+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[0.05429624 0.06147289 0.06154842]
917917
</pre></div>
918918
</div>
919919
</div>
@@ -934,9 +934,9 @@ <h2>3) Fit a Gaussian: Let’s compare to scipy<a class="headerlink" href="#fit-
934934
</div>
935935
</div>
936936
<div class="cell_output docutils container">
937-
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Amplitude: 9.919351213300535 +\- 0.2231022439896053
938-
Mean: 0.3726248055188302 +\- 0.26789898297447357
939-
Standard Deviation: 10.319677387647905 +\- 0.2685574753381447
937+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Amplitude: 10.25380980329387 +\- 0.2330155370528277
938+
Mean: -0.34280774429380745 +\- 0.24793727111438463
939+
Standard Deviation: 9.449824403814645 +\- 0.2480895430045534
940940
</pre></div>
941941
</div>
942942
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;&gt;:2: SyntaxWarning: invalid escape sequence &#39;\-&#39;
@@ -945,11 +945,11 @@ <h2>3) Fit a Gaussian: Let’s compare to scipy<a class="headerlink" href="#fit-
945945
&lt;&gt;:2: SyntaxWarning: invalid escape sequence &#39;\-&#39;
946946
&lt;&gt;:4: SyntaxWarning: invalid escape sequence &#39;\-&#39;
947947
&lt;&gt;:6: SyntaxWarning: invalid escape sequence &#39;\-&#39;
948-
/tmp/ipykernel_3536/1659586526.py:2: SyntaxWarning: invalid escape sequence &#39;\-&#39;
948+
/tmp/ipykernel_3538/1659586526.py:2: SyntaxWarning: invalid escape sequence &#39;\-&#39;
949949
&quot;Amplitude: {} +\- {}&quot;.format(best_fit_gauss.amplitude.value, np.sqrt(cov_diag[0]))
950-
/tmp/ipykernel_3536/1659586526.py:4: SyntaxWarning: invalid escape sequence &#39;\-&#39;
950+
/tmp/ipykernel_3538/1659586526.py:4: SyntaxWarning: invalid escape sequence &#39;\-&#39;
951951
print(&quot;Mean: {} +\- {}&quot;.format(best_fit_gauss.mean.value, np.sqrt(cov_diag[1])))
952-
/tmp/ipykernel_3536/1659586526.py:6: SyntaxWarning: invalid escape sequence &#39;\-&#39;
952+
/tmp/ipykernel_3538/1659586526.py:6: SyntaxWarning: invalid escape sequence &#39;\-&#39;
953953
&quot;Standard Deviation: {} +\- {}&quot;.format(
954954
</pre></div>
955955
</div>
@@ -980,7 +980,7 @@ <h2>3) Fit a Gaussian: Let’s compare to scipy<a class="headerlink" href="#fit-
980980
</div>
981981
</div>
982982
<div class="cell_output docutils container">
983-
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[ 9.91935132 0.37262559 10.31967716]
983+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[10.25380967 -0.3428078 9.44982465]
984984
</pre></div>
985985
</div>
986986
</div>
@@ -994,9 +994,9 @@ <h2>3) Fit a Gaussian: Let’s compare to scipy<a class="headerlink" href="#fit-
994994
</div>
995995
</div>
996996
<div class="cell_output docutils container">
997-
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Amplitude: 9.919351324668995 +\- 0.22692644067578163
998-
Mean: 0.3726255910714404 +\- 0.27249027313296453
999-
Standard Deviation: 10.319677158924282 +\- 0.2731600598915281
997+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Amplitude: 10.253809670516787 +\- 0.22874702438437425
998+
Mean: -0.3428078046174718 +\- 0.24339562710215684
999+
Standard Deviation: 9.449824649755104 +\- 0.24354512996537175
10001000
</pre></div>
10011001
</div>
10021002
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;&gt;:1: SyntaxWarning: invalid escape sequence &#39;\-&#39;
@@ -1005,11 +1005,11 @@ <h2>3) Fit a Gaussian: Let’s compare to scipy<a class="headerlink" href="#fit-
10051005
&lt;&gt;:1: SyntaxWarning: invalid escape sequence &#39;\-&#39;
10061006
&lt;&gt;:2: SyntaxWarning: invalid escape sequence &#39;\-&#39;
10071007
&lt;&gt;:3: SyntaxWarning: invalid escape sequence &#39;\-&#39;
1008-
/tmp/ipykernel_3536/2222327920.py:1: SyntaxWarning: invalid escape sequence &#39;\-&#39;
1008+
/tmp/ipykernel_3538/2222327920.py:1: SyntaxWarning: invalid escape sequence &#39;\-&#39;
10091009
print(&quot;Amplitude: {} +\- {}&quot;.format(p_opt[0], np.sqrt(p_cov[0, 0])))
1010-
/tmp/ipykernel_3536/2222327920.py:2: SyntaxWarning: invalid escape sequence &#39;\-&#39;
1010+
/tmp/ipykernel_3538/2222327920.py:2: SyntaxWarning: invalid escape sequence &#39;\-&#39;
10111011
print(&quot;Mean: {} +\- {}&quot;.format(p_opt[1], np.sqrt(p_cov[1, 1])))
1012-
/tmp/ipykernel_3536/2222327920.py:3: SyntaxWarning: invalid escape sequence &#39;\-&#39;
1012+
/tmp/ipykernel_3538/2222327920.py:3: SyntaxWarning: invalid escape sequence &#39;\-&#39;
10131013
print(&quot;Standard Deviation: {} +\- {}&quot;.format(p_opt[2], np.sqrt(p_cov[2, 2])))
10141014
</pre></div>
10151015
</div>
@@ -1025,7 +1025,7 @@ <h3>Compare results<a class="headerlink" href="#id1" title="Link to this heading
10251025
</div>
10261026
</div>
10271027
<div class="cell_output docutils container">
1028-
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Reduced Chi Squared using astropy.modeling: 1.034573985888868
1028+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Reduced Chi Squared using astropy.modeling: 0.9636990281912249
10291029
</pre></div>
10301030
</div>
10311031
</div>
@@ -1038,7 +1038,7 @@ <h3>Compare results<a class="headerlink" href="#id1" title="Link to this heading
10381038
</div>
10391039
</div>
10401040
<div class="cell_output docutils container">
1041-
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Reduced Chi Squared using scipy: 1.0345739858891707
1041+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Reduced Chi Squared using scipy: 0.9636990281913128
10421042
</pre></div>
10431043
</div>
10441044
</div>
@@ -1056,10 +1056,10 @@ <h3>Compare results<a class="headerlink" href="#id1" title="Link to this heading
10561056
</div>
10571057
</div>
10581058
<div class="cell_output docutils container">
1059-
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7f5ca286fef0&gt;
1059+
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;matplotlib.legend.Legend at 0x7f6f6f9d6c00&gt;
10601060
</pre></div>
10611061
</div>
1062-
<img alt="_images/09c2c445345d0c30586d49171516066734c9d829db36595ef252f7c795b9fb3c.png" src="_images/09c2c445345d0c30586d49171516066734c9d829db36595ef252f7c795b9fb3c.png" />
1062+
<img alt="_images/9a20769891e99632aa5763a2cf8507468858807b9965ba8698e770f70c0e2bf0.png" src="_images/9a20769891e99632aa5763a2cf8507468858807b9965ba8698e770f70c0e2bf0.png" />
10631063
</div>
10641064
</div>
10651065
<p><strong>Conclusion:</strong> Choose the method most convenient for every case you need to fit. We recomend <code class="docutils literal notranslate"><span class="pre">astropy.modeling</span></code> because is easier to write the name of the function you want to fit than to remember the expression every time we want to use it. Also, <code class="docutils literal notranslate"><span class="pre">astropy.modeling</span></code> becomes useful with more complicated models like <a class="reference external" href="http://docs.astropy.org/en/stable/modeling/#compound-models">two gaussians</a> plus a <a class="reference external" href="http://docs.astropy.org/en/stable/modeling/#blackbody-radiation">black body</a>, but that is another tutorial.</p>
@@ -1111,7 +1111,7 @@ <h2>4) Exercise: Your turn to choose<a class="headerlink" href="#exercise-your-t
11111111
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Text(0, 0.5, &#39;$y_3$&#39;)
11121112
</pre></div>
11131113
</div>
1114-
<img alt="_images/bb5e4350e6ea445f773dab6b70d0ad70f4b75e523b780589353805df68dcfed3.png" src="_images/bb5e4350e6ea445f773dab6b70d0ad70f4b75e523b780589353805df68dcfed3.png" />
1114+
<img alt="_images/f69bc99f67f5ea5c1fcc12e802847d267cda08a63da00cf92c1058311a02ab76.png" src="_images/f69bc99f67f5ea5c1fcc12e802847d267cda08a63da00cf92c1058311a02ab76.png" />
11151115
</div>
11161116
</div>
11171117
</section>

tutorials/2_WavelengthCalibration.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ <h2>Improving on our guesses<a class="headerlink" href="#improving-on-our-guesse
856856
<div class="cell_output docutils container">
857857
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;&gt;:3: SyntaxWarning: invalid escape sequence &#39;\l&#39;
858858
&lt;&gt;:3: SyntaxWarning: invalid escape sequence &#39;\l&#39;
859-
/tmp/ipykernel_4453/1543648565.py:3: SyntaxWarning: invalid escape sequence &#39;\l&#39;
859+
/tmp/ipykernel_3570/1543648565.py:3: SyntaxWarning: invalid escape sequence &#39;\l&#39;
860860
plt.ylabel(&quot;$\lambda(x)$&quot;)
861861
</pre></div>
862862
</div>
@@ -924,7 +924,7 @@ <h2>Improving on our guesses<a class="headerlink" href="#improving-on-our-guesse
924924
<div class="cell_output docutils container">
925925
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;&gt;:5: SyntaxWarning: invalid escape sequence &#39;\l&#39;
926926
&lt;&gt;:5: SyntaxWarning: invalid escape sequence &#39;\l&#39;
927-
/tmp/ipykernel_4453/3761740803.py:5: SyntaxWarning: invalid escape sequence &#39;\l&#39;
927+
/tmp/ipykernel_3570/3761740803.py:5: SyntaxWarning: invalid escape sequence &#39;\l&#39;
928928
plt.xlabel(&quot;$\lambda$ [nm]&quot;);
929929
</pre></div>
930930
</div>
@@ -968,7 +968,7 @@ <h2>Improving on our guesses<a class="headerlink" href="#improving-on-our-guesse
968968
<div class="cell_output docutils container">
969969
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;&gt;:3: SyntaxWarning: invalid escape sequence &#39;\l&#39;
970970
&lt;&gt;:3: SyntaxWarning: invalid escape sequence &#39;\l&#39;
971-
/tmp/ipykernel_4453/2204884587.py:3: SyntaxWarning: invalid escape sequence &#39;\l&#39;
971+
/tmp/ipykernel_3570/2204884587.py:3: SyntaxWarning: invalid escape sequence &#39;\l&#39;
972972
plt.xlabel(&quot;$\lambda$ [nm]&quot;)
973973
</pre></div>
974974
</div>
@@ -988,7 +988,7 @@ <h2>Improving on our guesses<a class="headerlink" href="#improving-on-our-guesse
988988
<div class="cell_output docutils container">
989989
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;&gt;:3: SyntaxWarning: invalid escape sequence &#39;\l&#39;
990990
&lt;&gt;:3: SyntaxWarning: invalid escape sequence &#39;\l&#39;
991-
/tmp/ipykernel_4453/12811141.py:3: SyntaxWarning: invalid escape sequence &#39;\l&#39;
991+
/tmp/ipykernel_3570/12811141.py:3: SyntaxWarning: invalid escape sequence &#39;\l&#39;
992992
plt.xlabel(&quot;$\lambda$ [nm]&quot;)
993993
</pre></div>
994994
</div>

0 commit comments

Comments
 (0)