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

Formed vs Surviving stellar mass #233

Open muryelgp opened 2 years ago

muryelgp commented 2 years ago

The output mass on the prospector is the ever-formed stellar mass, right?

How can this be changed? so that the output is the surviving stellar mass? I think I should pass add_stellar_remnants = False to fsps, but I was not able to do so.

Or even, it is possible to calculate the surviving mass from a fitted formed mass?

thanks!

bd-j commented 2 years ago

You can obtain the ratio of the surviving stellar mass to the formed stellar mass from a call to predict, e.g.

spec, phot, mfrac = model.predict(parameter_vector, obs=obs, sps=sps)
surviving_mass = np.sum(model.params["mass"]) * mfrac

where parameter_vector can by any posterior sample (e.g. the highest probability sample, or you can do this for every sample in the chain if you want the full posterior for the surviving stellar mass). See https://prospect.readthedocs.io/en/latest/tutorial.html#working-with-the-output for more info.

I should add this to the FAQ.

muryelgp commented 2 years ago

Thanks!

But this way if I want the full posterior for the surviving stellar mass I need to run 'model.predict(..)' in a for loop for every sample in the chain, which seems to take quite some time!

Is there a way to make the prospector result itself to be in surviving stellar mass?

bd-j commented 2 years ago

Sorry, not in general; the problem is that the ratio of surviving to formed mass is not known until the model is generated (it depends on the stellar age and metallicity distribution, as well as the IMF) and this makes sampling from the surviving mass itself a bit tricky.

If you are using CSPSPecBasis (for parametric SFHs) you can try adding

model_params["mass_units"]=dict(init="mstar", isfree=False, N=1)

to your model specification to get sampling in surviving stellar mass, but this is no longer an actively supported feature.

bd-j commented 2 years ago

Also to note a future update to prospector will store the ratio of the surviving to formed mass in the output.