Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotting Teff(t) with plot_cooling #110

Open
gabrielastro opened this issue Sep 23, 2024 · 4 comments
Open

Plotting Teff(t) with plot_cooling #110

gabrielastro opened this issue Sep 23, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@gabrielastro
Copy link

Hello Tomas,

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

Thanks,

Gabriel

@tomasstolker tomasstolker added the enhancement New feature or request label Sep 23, 2024
@gabrielastro
Copy link
Author

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:

  • "Mass prior (Rjup)" → … (Mjup) 😉
  • In the documentation: "These masses we be used" →" … will be…"

@tomasstolker
Copy link
Owner

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

@gabrielastro
Copy link
Author

gabrielastro commented Sep 27, 2024

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 🤓) 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
Copy link
Author

Also, if I accidentally set too low a lower bound on the blackbody (bounds['disk_teff'] = (3., 1000.) for fit = FitModel(…, bounds=bounds), instead of the minimum 10 K ("teff range": [10, 20000] in species/data/model_data/model_data.json)), I get from MultiNest:

  File "[…]/species/fit/fit_model.py", line 1658, in _lnlike_func
    disk_flux = self.diskphot[phot_idx].spectrum_interp(
  File "[…]/.local/lib/python3.8/site-packages/scipy/interpolate/_rgi.py", line 320, in __call__
    raise ValueError("One of the requested xi is out of bounds "
ValueError: One of the requested xi is out of bounds in dimension 0

but it is not so obvious right away what the cause is, and it requires killing the session (pausing ipython3 with Ctrl+Z and then doing in the same terminal kill %%). Maybe this too could/should be caught by species before MultiNest is called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants