cgarling / StarFormationHistories.jl

Fitting astrophysical star formation histories via CMD modelling.
MIT License
3 stars 0 forks source link

Priors for metallicity-related variables #25

Open cgarling opened 6 months ago

cgarling commented 6 months ago

For CMDs with significant contamination, fitting age-metallicity relation variables (i.e., with what is now fit_templates_mdf) can result in very unphysical results. Should include some default weak priors to hopefully prevent these errors. These priors would ideally be user-facing via keyword arguments so they could be overwritten if desired. Problem with using any arbitrary user-provided function is that they need to be differentiable for use in the solvers. I suppose we could rely on autodiff, and for analytic differentials I believe there are standard APIs for this (maybe rrule and frule from ChainRulesCore.jl)?

cgarling commented 5 months ago

Tried adding priors on the MDF parameters to fit_templates_mdf in aeb0730d644beed4034f07cc13040f148b7689f0, didn't seem to help convergence. Indicates there may not be a well-defined global maximum likelihood towards which we can converge for this MDF model.

An iterative approach might work better; alternate fixing either the SFH parameters or the MDF parameters and refitting the maximum likelihood until a convergence is achieved. If there is a minimum in the vicinity of the initial guess, this approach may be more robust.

cgarling commented 4 months ago

It seems like the Gaussian MDF width sigma goes to relatively high values (e.g., 0.3) when freely fit with real data. These fits do not look good. I think it is preferable to fix sigma rather than allow it to be fit in most cases.

Additionally for CMDs with contamination to the red of the RGB, these stars should be removed or the Hess diagram should be masked; otherwise red contamination will result in fits with higher mean metallicities.