bd-j / prospector

Python code for Stellar Population Inference from Spectra and SEDs
http://prospect.readthedocs.io
MIT License
156 stars 73 forks source link

Prospector alpha: Model not converge #147

Closed kaiwen-kakuiii closed 4 years ago

kaiwen-kakuiii commented 5 years ago

I wonder how should I sign values to model parameters. It seems my model doesn't converge very well, no matter how I tweak my model. Below are my model parameters and trace plots:

image image

bd-j commented 5 years ago

You need more iterations, but that doesn't look so bad, at least the last few thousand iterations.

Note that you should not expect the walkers to converge to a single value for each parameter, but rather to a distribution of values. While individual walkers can move within the distribution, a converged sampler will have a distribution of walker values that is not strongly changing as a function of iteration. If a parameter is poorly constrained by the data, then that distribution may be quite broad, or look just like the prior distribution.

bd-j commented 5 years ago

PS you might try using the dynesty sampler, which has some built-in convergence checking criteria.

kaiwen-kakuiii commented 5 years ago

I have a question about prospector-alpha model. Have you updated this model to which in Leja et al. (2018) (ie. use f_agn_mir instead of f_agn etc)? If not, how can I use the 2018 model?

jrleja commented 5 years ago

The Prospector-alpha model in the templates file is from Leja+17. The Leja+19 updates are detailed in Section 3.1 of that paper. We still fit in f_agn, but you can translate this to f_mir after performing a fit by measuring the MIR luminosity with the AGN parameter turned on and off. You can update the Prospector-alpha model in templates.py to that version with the following modifications:

  1. Update the star formation history to the 'continuity_sfh', and use adjust_continuity_agebins to build appropriately-sized bins (you can mimic the spacing in Leja+19 if you wish, though there is some freedom in your choices here).
  2. Fix the IR SED to the duste_XXX parameters here: https://github.com/jrleja/prospector_alpha/blob/master/parameter_files/td_delta_params.py. Also, using the nebular emission parameters here, which include a free gas-phase metallicity and a higher ionization parameter.
  3. The stellar mass -- stellar metallicity prior is a bit more complicated to implement, you will need to generate a text file with the center and widths of the desired prior following the parameter file in the above link. This might be something worth skipping unless you are getting bizarre outputs for metallicity.
kaiwen-kakuiii commented 5 years ago

Could you explain #2 in more detail? I didn't find "IR SED" in that link and which part should I use nebular emission? Plus, all these modifications should be done in templates.py, is that correct? Thanks!

jrleja commented 5 years ago

In general, templates.py provides a 'shorthand' for building models in your Prospector parameter file. Editing it directly is probably not best practice. Instead, you can import the desired models in the build_model() function of your parameter file, and subsequently the model_params dictionary directly to have your desired values.

The IR emission in FSPS is explained in the FSPS manual or in Leja+17. in brief it's controlled by four parameters:

add_dust_emission is a flag that turns on dust emission. This should be set to 'on'. duste_gamma, duste_qpah, and duste_umin are three parameters from Draine & Lee 2007 which specify the shape of the dust SED. In the above link, they are fixed to the value specified in 'init'.

Similarly, nebular emission is controlled by a few parameters which are also best explained in the FSPS manual ($SPS_HOME/doc/MANUAL.pdf). After importing the nebular emission model from templates.py, you can change the gas-phase metallicity and the ionization parameter by accessing the gas_logz and gas_logu parameters respectively.

kaiwen-kakuiii commented 5 years ago

Below is my code for 2018 model, could you please check it? image And in the output, I notice there are two mass parameters, one called total_mass which is used in 2017 model, and another one called logmass. The total_mass result seems unreasonable while logmass seems about right. I don't think we need two masses in one model, unless they mean different thing. Could you help me clarify it? Thx!

jrleja commented 5 years ago

This looks good. Total_mass is a byproduct of importing the Dirichlet nonparametric SFH. You can either ignore it, or avoid importing the Dirichlet nonparametric SFH to begin with by instead simply copying the commands in the Prospector-alpha definition in the templates file and removing the SFH components.