dfm / python-fsps

Python bindings to Charlie Conroy's Flexible Stellar Population Synthesis (FSPS) Fortran code
https://python-fsps.readthedocs.io
MIT License
67 stars 38 forks source link

MOD_HB ERROR from get_mags #129

Closed RGleis closed 4 years ago

RGleis commented 4 years ago

Hi, I'm trying to create a MCMC SED fitting pipeline using Python-fsps and emcee. My code initializes a single instance of the stellar population object as shown in the tutorial.

fsps.StellarPopulation(compute_vega_mags=False, zcontinuous=1, sfh=0, logzsol=0.0, dust_type=2, dust2=0.2)

Then my likelihood function changes the logzsol and fbhb using the params dict and gets model magnitudes using the get_mags function to compare with photometry from MegaCam. This normally works but sometimes crashes and prints the error

MOD_HB ERROR: number of mass points GT nm

This always happens for a given input but I haven't figured out any pattern. An input I found this happens for is age: 6.97626367308258 logmetals: 0.8600410419349913 fBHB: 0.14265687017609485 redshift: 0.00428

I'm not seeing any other error messages and I haven't found any references to this error . Do you have any idea what could be going on? Is this a wrapper issue or core fsps issue?

RGleis commented 4 years ago

I forgot to mention that this is on Fedora Linux with Python 3.7

bd-j commented 4 years ago

Hi,

This is definitely a core FSPS issue. I suspect some corner case with particular isochrones. Can you tell me the result of

sp = fsps.StellarPopulation(compute_vega_mags=False, zcontinuous=1, sfh=0, logzsol=0.0, dust_type=2, dust2=0.2)
print(sp.libraries)

also if you are looking for MCMC SED fitting with FSPS can I recommend https://github.com/bd-j/prospector ? 😉

RGleis commented 4 years ago

Thanks for your help

Those commands output (b'mist', b'miles'). I haven't changed the libraries since installation. I'm aware that I can change the libraries but it requires reinstalling Python-fsps so I've put that off until I've added the filters I need so my institution's IT specialist only has to do so once. It wouldn't be that big of a deal to change, though, if you think it would help.

Prospector looks interesting. I'm a grad student and I want to build my own pipeline for understanding but I'll consider that for my actual science.

On Wed, Jun 3, 2020 at 4:38 PM Ben Johnson notifications@github.com wrote:

Hi,

This is definitely a core FSPS issue. I suspect some corner case with particular isochrones. Can you tell me the result of

sp = fsps.StellarPopulation(compute_vega_mags=False, zcontinuous=1, sfh=0, logzsol=0.0, dust_type=2, dust2=0.2) print(sp.libraries)

also if you are looking for MCMC SED fitting with FSPS can I recommend https://github.com/bd-j/prospector ? 😉

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dfm/python-fsps/issues/129#issuecomment-638516011, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSN65DW2GXJYMDEEEYMEF3RU3NGVANCNFSM4NRHKMNA .

bd-j commented 4 years ago

So, the issue is that for some of the MIST isochrones there's a large number of HB isochrone points, and the way they are redistributed to create BHB stars adds too many extra isochrone points. I believe this should be restricted to highest metallicity intermediate age isochrones, but need to investigate. You could also switch to the Padove isochrones.

PS, in the code above you use a logmetal value of ~0.8; just FYI the MIST isochrones do not extend past log(Z/Zsun) = +0.5, and the MILES stellar libraries do not have stars more metal rich than about log(Z/Zsun) = +0.2, so higher metallicity SSPs will will be constructed from extrapolations that may not be very robust in detail. I would suggest imposing a maximum in log(Z/Zsun) of +0.2.

RGleis commented 4 years ago

Changing to Padova worked