Skip to content

Commit

Permalink
MR: Updating readthedocs and correcting stuff in plotting and nested_…
Browse files Browse the repository at this point in the history
…sampling
  • Loading branch information
MatthieuR18 committed Sep 26, 2024
1 parent f65784e commit aa43396
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 24 deletions.
2 changes: 1 addition & 1 deletion ForMoSA/nested_sampling/nested_modif_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def modif_spec(global_params, theta, theta_index,
else: # If you want 1 common rv for all observations
if global_params.rv != "NA":
if global_params.rv[0] == "constant":
alpha_picked = float(global_params.rv[1])
rv_picked = float(global_params.rv[1])
else:
ind_theta_rv = np.where(theta_index == 'rv')
rv_picked = theta[ind_theta_rv[0][0]]
Expand Down
8 changes: 4 additions & 4 deletions ForMoSA/plotting/plotting_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def _get_posteriors(self):
tot_list_param_title.append(extra_parameters[2][1] + fr'$_{indobs}$' + ' ' + extra_parameters[2][2])
theta_index.append(f'alpha_{indobs}')
else: # If you want 1 common alpha for all observations
if self.global_params.alpha != 'NA' and self.global_params.alpha != 'constant':
if self.global_params.alpha != 'NA' and self.global_params.alpha[0] != 'constant':
tot_list_param_title.append(extra_parameters[2][1] + ' ' + extra_parameters[2][2])
theta_index.append('alpha')
if len(self.global_params.rv) > 3: # If you want separate rv for each observations
Expand All @@ -282,7 +282,7 @@ def _get_posteriors(self):
tot_list_param_title.append(extra_parameters[3][1] + fr'$_{indobs}$' + ' ' + extra_parameters[3][2])
theta_index.append(f'rv_{indobs}')
else: # If you want 1 common rv for all observations
if self.global_params.rv != 'NA' and self.global_params.rv != 'constant':
if self.global_params.rv != 'NA' and self.global_params.rv[0] != 'constant':
tot_list_param_title.append(extra_parameters[3][1] + ' ' + extra_parameters[3][2])
theta_index.append('rv')
if len(self.global_params.vsini) > 4: # If you want separate vsini for each observations
Expand All @@ -292,7 +292,7 @@ def _get_posteriors(self):
tot_list_param_title.append(extra_parameters[5][1] + fr'$_{indobs}$' + ' ' + extra_parameters[5][2])
theta_index.append(f'vsini_{indobs}')
else: # If you want 1 common vsini for all observations
if self.global_params.vsini != 'NA' and self.global_params.vsini != 'constant':
if self.global_params.vsini != 'NA' and self.global_params.vsini[0] != 'constant':
tot_list_param_title.append(extra_parameters[5][1] + ' ' + extra_parameters[5][2])
theta_index.append('vsini')
if len(self.global_params.ld) > 3: # If you want separate ld for each observations
Expand All @@ -302,7 +302,7 @@ def _get_posteriors(self):
tot_list_param_title.append(extra_parameters[6][1] + fr'$_{indobs}$' + ' ' + extra_parameters[6][2])
theta_index.append(f'ld_{indobs}')
else: # If you want 1 common vsini for all observations
if self.global_params.ld != 'NA' and self.global_params.ld != 'constant':
if self.global_params.ld != 'NA' and self.global_params.ld[0] != 'constant':
tot_list_param_title.append(extra_parameters[6][1] + ' ' + extra_parameters[6][2])
theta_index.append('ld')

Expand Down
18 changes: 17 additions & 1 deletion RELEASE_NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -390,4 +390,20 @@ Comments:
- New approach in the lsq function, we can now use the lsq in each sub wavelength separatly (eg. '1.4, 1.5', '1.6, 1.7', '1.8, 1.9' ...) and merge the results into a single array to compute the loglikelihood on one array only. This gives the advantage of limiting flux error calibration that can arrise between order for data such as CRIRES, HiRISE ... and being fast at the same time. Previously, the use had to define separated windows in 'wave_fit' (eg : '1.4, 1.5', '1.6, 1.7', '1.8, 1.9' ...) and one loglikelihood one computed for each of these windows. Now the user has to define separated windows in the format '1.4, 1.5 / 1.6, 1.7 / 1.8, 1.9 / ...'

Tests tha have been done to checkup the changes:
- High resolution datasets (HiRISE, CRIRES)
- High resolution datasets (HiRISE, CRIRES)


- - -

26/09/2024

Matthieu Ravet

Comments:
- Updating / correting the readthedocs
- Correction of the rv input loop if you want to set it to constant during the ns
- Correction of the plotting function (for constant extra grid and for the custom resolution grid)


Tests tha have been done to checkup the changes:
- Test with constant priors on the rv
Binary file modified docs/ForMoSA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/ForMoSA_old.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_build/doctrees/demo.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/index.doctree
Binary file not shown.
Binary file modified docs/_build/html/_images/ForMoSA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ <h1>Source code for ForMoSA.nested_sampling.nested_modif_spec</h1><div class="hi
<span class="k">if</span> <span class="n">analytic</span> <span class="o">==</span> <span class="s1">&#39;no&#39;</span><span class="p">:</span>
<span class="n">r_picked</span> <span class="o">*=</span> <span class="n">u</span><span class="o">.</span><span class="n">Rjup</span>
<span class="n">d_picked</span> <span class="o">*=</span> <span class="n">u</span><span class="o">.</span><span class="n">pc</span>
<span class="n">ck</span> <span class="o">=</span> <span class="n">alpha</span> <span class="o">*</span> <span class="p">(</span><span class="n">r_picked</span><span class="o">.</span><span class="n">value</span><span class="o">/</span><span class="n">d_picked</span><span class="o">.</span><span class="n">value</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span>
<span class="n">ck</span> <span class="o">=</span> <span class="n">alpha</span> <span class="o">*</span> <span class="p">(</span><span class="n">r_picked</span><span class="o">.</span><span class="n">to</span><span class="p">(</span><span class="n">u</span><span class="o">.</span><span class="n">m</span><span class="p">)</span><span class="o">.</span><span class="n">value</span><span class="o">/</span><span class="n">d_picked</span><span class="o">.</span><span class="n">to</span><span class="p">(</span><span class="n">u</span><span class="o">.</span><span class="n">m</span><span class="p">)</span><span class="o">.</span><span class="n">value</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span>
<span class="c1"># Calculation of the dilution factor ck analytically</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">flx_obs_spectro</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
Expand Down Expand Up @@ -551,7 +551,7 @@ <h1>Source code for ForMoSA.nested_sampling.nested_modif_spec</h1><div class="hi
<span class="k">else</span><span class="p">:</span> <span class="c1"># If you want 1 common rv for all observations</span>
<span class="k">if</span> <span class="n">global_params</span><span class="o">.</span><span class="n">rv</span> <span class="o">!=</span> <span class="s2">&quot;NA&quot;</span><span class="p">:</span>
<span class="k">if</span> <span class="n">global_params</span><span class="o">.</span><span class="n">rv</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s2">&quot;constant&quot;</span><span class="p">:</span>
<span class="n">alpha_picked</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">global_params</span><span class="o">.</span><span class="n">rv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="n">rv_picked</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">global_params</span><span class="o">.</span><span class="n">rv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">ind_theta_rv</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">theta_index</span> <span class="o">==</span> <span class="s1">&#39;rv&#39;</span><span class="p">)</span>
<span class="n">rv_picked</span> <span class="o">=</span> <span class="n">theta</span><span class="p">[</span><span class="n">ind_theta_rv</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">]]</span>
Expand Down
Loading

0 comments on commit aa43396

Please sign in to comment.