Skip to content

Commit

Permalink
Added the option to plot Teff and log(g) with the plot_cooling functi…
Browse files Browse the repository at this point in the history
…on, added HIP99770b to companion_data.json
  • Loading branch information
tomasstolker committed Sep 24, 2024
1 parent 487d2e0 commit 2e40e2d
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 11 deletions.
47 changes: 45 additions & 2 deletions species/data/companion_data/companion_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,37 @@
"Stolker et al. 2020a"
]
},
"HIP 99770 b": {
"simbad": "* b03 Cyg",
"parallax": [
24.5456,
0.0911
],
"semi_major": [
16.9,
-1.8,
3.4
],
"mass_star": [
1.85,
0.19
],
"mass_companion": [
16.1,
-5.0,
5.4
],
"accretion": false,
"age": [
45.0,
-5.0,
5.0
],
"references": [
"Currie et al. 2023",
"Zuckerman 2019"
]
},
"51 Eri b": {
"simbad": "51 Eri",
"parallax": [
Expand Down Expand Up @@ -699,7 +730,7 @@
"semi_major": [
20.8,
-0.7,
0.7
0.6
],
"mass_star": [
0.98,
Expand All @@ -720,10 +751,16 @@
2.3e-19
]
},
"age": [
5.4,
-1.0,
1.0
],
"references": [
"Gaia Early Data Release 3",
"Haffert et al. 2019",
"Hashimoto et al. 2020",
"Müller et al. 2018",
"Stolker et al. 2020b",
"Wang et al. 2020",
"Wang et al. 2021"
Expand All @@ -747,7 +784,7 @@
},
"semi_major": [
34.3,
-2.2,
-1.8,
2.2
],
"mass_star": [
Expand All @@ -759,9 +796,15 @@
4.7
],
"accretion": true,
"age": [
5.4,
-1.0,
1.0
],
"references": [
"Gaia Early Data Release 3",
"Haffert et al. 2019",
"Müller et al. 2018",
"Stolker et al. 2020b",
"Wang et al. 2020",
"Wang et al. 2021"
Expand Down
6 changes: 3 additions & 3 deletions species/fit/fit_evolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,14 @@ def run_multinest(
Function to run the ``PyMultiNest`` wrapper of the
``MultiNest`` sampler. While ``PyMultiNest`` can be
installed with ``pip`` from the PyPI repository,
``MultiNest`` has to to be build manually. See the
``MultiNest`` has to be build manually. See the

This comment has been minimized.

Copy link
@gabrielastro

gabrielastro Sep 25, 2024

→ built 😉

``PyMultiNest`` documentation for details:
http://johannesbuchner.github.io/PyMultiNest/install.html.
Note that the library path of ``MultiNest`` should be set
to the environmental variable ``LD_LIBRARY_PATH`` on a
Linux machine and ``DYLD_LIBRARY_PATH`` on a Mac.
Alternatively, the variable can be set before importing
the ``species`` package, for example:
Alternatively, the variable can be set before
importing the ``species`` package, for example:
.. code-block:: python
Expand Down
52 changes: 47 additions & 5 deletions species/plot/plot_evolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def plot_cooling(
Number of randomly drawn cooling tracks that will be plotted.
cooling_param : str
Type of cooling parameter that will be plotted
('luminosity' or 'radius').
('luminosity', 'radius', 'teff', or 'logg').
xlim : tuple(float, float), None
Limits of the wavelength axis. Automatic limits are used if
the argument is set to ``None``.
Expand Down Expand Up @@ -90,11 +90,11 @@ def plot_cooling(

plt.close()

if cooling_param not in ["luminosity", "radius"]:
if cooling_param not in ["luminosity", "radius", "teff", "logg"]:
raise ValueError(
"The argument of 'cooling_parameter' is "
"not valid and should be set to "
"'luminosity' or 'radius'."
"'luminosity', 'radius', 'teff', or 'logg'."
)

from species.data.database import Database
Expand Down Expand Up @@ -155,6 +155,12 @@ def plot_cooling(
radius_prior[i][0] + radius_prior[i][1],
]

param_idx = samples_box.parameters.index(f"teff_{i}")
teff_tmp = np.percentile(samples[:, param_idx], [50.0, 16.0, 84.0])

param_idx = samples_box.parameters.index(f"logg_{i}")
logg_tmp = np.percentile(samples[:, param_idx], [50.0, 16.0, 84.0])

ax[i].set_xscale(xscale)
ax[i].set_yscale(yscale)

Expand Down Expand Up @@ -199,10 +205,16 @@ def plot_cooling(
ax[i].set_xlabel("Age (Myr)", fontsize=13)

if cooling_param == "luminosity":
ax[i].set_ylabel("$\\log(L/L_\\odot)$", fontsize=13)
ax[i].set_ylabel("$\log(L/L_\odot)$", fontsize=13)

elif cooling_param == "radius":
ax[i].set_ylabel("Radius ($R_\\mathrm{J}$)", fontsize=13)
ax[i].set_ylabel("Radius ($R_\mathrm{J}$)", fontsize=13)

elif cooling_param == "teff":
ax[i].set_ylabel("$T_\mathrm{eff}$ (K)", fontsize=13)

elif cooling_param == "logg":
ax[i].set_ylabel("$\log\,g$", fontsize=13)

if xlim is not None:
ax[i].set_xlim(xlim[0], xlim[1])
Expand All @@ -228,6 +240,12 @@ def plot_cooling(
elif cooling_param == "radius":
cool_tracks[planet_idx].append([cool_box.age, cool_box.radius])

elif cooling_param == "teff":
cool_tracks[planet_idx].append([cool_box.age, cool_box.teff])

elif cooling_param == "logg":
cool_tracks[planet_idx].append([cool_box.age, cool_box.logg])

ax[planet_idx].plot(
cool_tracks[planet_idx][-1][0],
cool_tracks[planet_idx][-1][1],
Expand Down Expand Up @@ -261,6 +279,30 @@ def plot_cooling(
color="tab:orange",
)

elif cooling_param == "teff":
ax[i].errorbar(
[age_prior[0]],
[teff_tmp[0]],
xerr=[
[age_prior[0] - np.abs(age_prior[1])],
[age_prior[2] - age_prior[0]],
],
yerr=[[teff_tmp[0] - teff_tmp[1]], [teff_tmp[2] - teff_tmp[0]]],
color="tab:orange",
)

elif cooling_param == "logg":
ax[i].errorbar(
[age_prior[0]],
[logg_tmp[0]],
xerr=[
[age_prior[0] - np.abs(age_prior[1])],
[age_prior[2] - age_prior[0]],
],
yerr=[[logg_tmp[0] - logg_tmp[1]], [logg_tmp[2] - logg_tmp[0]]],
color="tab:orange",
)

if title is not None:
ax[0].set_title(title, fontsize=18.0)

Expand Down
2 changes: 1 addition & 1 deletion species/read/read_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ def integrate_spectrum(self, model_param: Dict[str, float]) -> float:
extinct luminosity and not the intrinsic luminosity. Without
applying extinction, the integrated luminosity should in
principle be the same as the luminosity calculated directly
from the :math:`T_\\mathrm{eff}` and radius parameters. Unless
from the :math:`T_\\mathrm{eff}` and radius parameters, unless
the radiative-convective model had not fully converged for a
particular set of input parameters. It can thus be useful
to check if the integrated luminosity is indeed consistent
Expand Down

0 comments on commit 2e40e2d

Please sign in to comment.