Comments (16)
Oops! Thank you, indeed I was. I thought I had deactivated that but apparently it was still there. (Or was it because the mass prior remained in an internal variable in FitModel
between a first call with normal_prior=…
and a second one with normal_prior=None
in the same session?) Maybe warn the user if the input is non-consistent in this way… In any case, thanks a lot!
from species.
Sure! I will remove the mass
and luminosity
by default.
from species.
That should be possible! Not sure if I fully understand the blackbody part. Would you fit in this case an arbitrary scaling instead of using the radius and parallax/distance parameters for the scaling? And then as second parameter an offset applied to the model spectrum?
from species.
Using a blackbody is just a partial workaround but I would like to fit a regular atmospheric model but which can be modified by an offset and a scaling. Currently, one can only scale the model spectrum (through the radius), but not offset it arbitarily. So, yes, I would fit for an arbitary scaling and offset. It would be sensible for the offset to be a linear function of wavelength (and not only a constant).
from species.
Ah I see, so you used the blackbody for the offset. Should the scaling and offset parameters be sampled linearly? Or logarithmic?
from species.
Exactly! I guess the scaling of the atmospheric model spectrum should be sampled logarithmically since it should not be negative. Actually, for this one can use the radius (but sampled logarithmically for that reason); it will not have physical meaning but this is ok for these purposes. The new part is the linear offset function, whose slope and intercept should be sampled linearly since they can be positive or negative. I guess their needed range is not clear in general and cannot be derived physically (and will depend on the atmospheric model). Maybe useful parameters scales are Delta_offset = (mean of starting theoretical spectrum) - (mean of data spectrum) and Delta_slope = (mean slope of theoretical spectrum = quick, rough least-squares fit) - (mean slope of data), i.e., starting at offset = 0 but stepping around with Delta_offset, and similarly for slope)?
from species.
I have added the flux_scaling
, log_flux_scaling
, and flux_offset
(in W m-2 um-1) parameters in commit 4804241. These parameters can be added to bounds
in FitModel
. They are also supported by ReadModel
. For now I have not included the offset slope, perhaps it is not needed.
from species.
Thanks a lot! Sorry for the delay. I wanted first to check "quickly" simple, classical fitting and then report but I have not quite succeeded yet, so I want to come back to this once the rest works…
from species.
Finally! I am able to try it out. Thanks a lot again. However, I get:
KeyError: 'radius'
Exception ignored on calling ctypes callback function: <function run.<locals>.loglike at 0x7f88492a4160>
Traceback (most recent call last):
File "[…]/.local/lib/python3.9/site-packages/pymultinest/run.py", line 228, in loglike
return LogLikelihood(cube, ndim, nparams)
File "[…]/species/fit/fit_model.py", line 2018, in _lnlike_multinest
return self._lnlike_func(params)
File "[…]/species/fit/fit_model.py", line 1375, in _lnlike_func
params[self.cube_index["radius"]],
i.e., the radius does not exist as a free parameter anymore yet it would be needed for logg. (By the way, it would be better if the Exception
of KeyError
were not ignored; can this be done from species
or would it require the user to recompile pymultinest
?)
I guess a solution is instead to let the distance (1/parallax) be a completely free parameter, or be the real distance times a free parameter. Would this break something else, though?
from species.
The radius
is not needed for logg
, so should be removed from bounds
. Then it will hopefully work!
from species.
The problem is that the 'radius'
is getting set in species
, not by the user. I do:
Spekkalpar = {'teff': (1000, 1900), 'log_flux_scaling': (-24.0, -18), 'flux_offset': (-1e-15, 1e-15)}
fit = FitModel(…, bounds=Spekkalpar)
but FitMode prints:
Fitting 5 parameters:
- teff
- logg
- feh
- log_flux_scaling
- flux_offset
Uniform priors (min, max):
- teff = (1000, 1900)
- log_flux_scaling = (-24.0, -18)
- flux_offset = (-1e-15, 1e-15)
- logg = (3.0, 5.5)
- feh = (-0.6, 0.3)
and indeed, after the call to FitModel
, Spekkalpar
contains additionally 'logg': (3.0, 5.5), 'feh': (-0.6, 0.3)
.
from species.
Do you use a mass prior? That should not be used if the radius is not a free parameter.
from species.
Sorry, two additions:
1.) It works 🥳! Thanks!
2.) It would be good/needed to add automatically the a_flux
and b_flux
parameters to the plot_spectrum
legend, as a reminder that they were used.
from species.
I changed the implementation a bit. Any parameter that was used by a model should be included by default now (apart from parallax
and distance
).
from species.
Hm, thanks but for the legend, I would prefer if the default did not include the mass and luminosity because they are only derived and the legend entries get too long, forcing hand tweaking (that option is very good but up to now I was very happy with the default, which is practical) or tempting users to shrink the font, which is usually a bad idea
from species.
Small further suggestions while you are at it (thanks so much!):
- Have the
b_flux
be in "pretty scientific notation" (not with9.7e-17
but rather 9.7×10⁻¹⁷) - Let the negative numbers (e.g.
a_flux
typically) be in math mode, which gives a minus sign (longer than a hyphen) 🤓 - At the end of the fit, print to screen not only the median but also the ±1 sigma values (this is more general than this thread)?
from species.
Related Issues (20)
- Upper limits on photometric measurements? HOT 1
- Change fontsize of axis labels with plot_spectrum? HOT 3
- Problem in add_custom_model with data_path HOT 1
- Tutorial "Fitting data with a grid of model spectra" (and a few other pages): small things HOT 5
- database overview: list_models() and verbosity control? HOT 4
- Database problem: OSError: Unable to open file (file is already open for read-only) HOT 4
- Making unpacking/storing of atmospheric models more memory-efficient HOT 10
- Adding dynesty support (especially to retrievals) HOT 8
- Various small things HOT 7
- Fitting with nested sampling (UltraNest or MultiNest) HOT 4
- Enhancing plot_spectrum a bit HOT 21
- Running multinest or ultranest in parallel? HOT 11
- Higher-order interpolation? HOT 3
- Retrieval with radial velocity / rotational broadening vsini HOT 2
- Installation error: No matching distribution found for matplotlib~=3.8.0 HOT 3
- Using wavel_range with database.add_model() HOT 5
- wavelength / spectral spacing for exo-rem-highres grid HOT 9
- pypi package version HOT 1
- Different fsed for cloud species in retrieval HOT 4
- sonora elf-owl as successor to bobcat and cholla HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from species.