tomasstolker / species

Toolkit for atmospheric characterization of directly imaged exoplanets
https://species.readthedocs.io
MIT License
22 stars 10 forks source link

Plotting Teff(t) with plot_cooling #110

Closed gabrielastro closed 1 week ago

gabrielastro commented 1 month ago

Hello Tomas,

A logical and useful extension to plot_cooling would be to plot the effective temperature!

Thanks,

Gabriel

gabrielastro commented 1 month ago

An (unofficial) thanks for already having added the feature! That was fast and is practical.

I am a bit confused or surprised about the bounds in FitEvolution. I did:

fit_evol = FitEvolution(evolution_model='baraffe2015', log_lum=(-3.6, 0.1),
                        mass_prior=(10, 9.), radius_prior=None,
                        bounds={'age': (3., 150.)})

and got

----------------------
Fit evolutionary model
----------------------

Evolution model: baraffe2015
Luminosity log(L/Lsun): (-3.6, 0.1)

Age prior: None
Mass prior (Rjup): (10, 9.0)
Radius prior (Rjup): None

Fitting 2 parameters:
   - age
   - mass_0

Uniform priors (min, max):
   - age = (3.0, 150.0)
   - mass_0 = (10.475655146604772, 1466.591720524668)

Now, in hindsight it makes sense that the uniform prior for the mass be much larger than the normal priors I set but at first I was surprised why the range is so large (and the lower limit actually larger than the prior I put in). Correspondingly, even with only 50 points, the run was taking forever and actually never finishing. I guess it is some issue of going off the model grid but maybe it could be helpful if some bounds were re-adjusted automatically and/or warnings given?

Two small things in passing:

tomasstolker commented 1 month ago

I have made some improvements for when a prior or luminosity is outside the grid range. Could you test once more 😊?

gabrielastro commented 1 month ago

Thanks! Indeed, with the same FitEvolution() call (see above), I get

[…]/species/fit/fit_evolution.py:241: UserWarning: The lower bound on mass_0 (0.5) is smaller
than the lower bound from the available evolution model grid (10.475655146604772).
The lower bound of the mass_0 prior will be adjusted to 10.475655146604772.

and in another context, I did run into ValueError: The input value of 'teff' is smaller than the lower boundary of the model grid (1457.404357917523 < 1500.0), both of which were useful. (I think both are from the same commit.)

However, baraffe2015 is still not working, somehow. It is running forever and even with only 50 points still not producing any output. Plotting the raw data, it looks as though there should be a solution:

BHAC15-Datenauszug_bis30MJ_bis 300Ma

The black line is -3.6 dex, and there should be many solutions for masses between 10.48 MJ (= 10 millisolarmasses :nerd_face:) and whatever, and ages between 3 Myr and 150 Myr, with the normal priors not even very tight. Is it a units issue somewhere? Or is it because of the non-monotonic behaviour (due to the deuterium-burning shoulder)?

gabrielastro commented 1 month ago
tomasstolker commented 1 week ago

Hmm might indeed be non-monotonic behavior. Perhaps use ReadIsochrone to check if the interpolated isochrones seem fine. Please open a separate issue with a full but minimal example if you still encounter the issue. Thanks!

gabrielastro commented 1 week ago

I tried again baraffe15 with another set of values and it took much longer than in the run above but it eventually worked. I suspect that the acceptance rate is just very low because the mass is close to the lower limit of 10 mMsol. So everything is probably ok!