bd-j / prospector

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

speeding up SedModel.mean_model method? #164

Open moustakas opened 4 years ago

moustakas commented 4 years ago

In the interactive demo (as well as in my own, independent fits), instantiating the CSPSpecBasis object (using the MILES spectral library and the MIST isochrones) takes about 10 seconds, which is fine because all the model spectra have to be read and cached.

However, the sedmodel.SedModel.mean_model (or, equivalently, the sedmodel.SedModel.sed) method, which evaluates the SED given a set of input parameters, takes a almost a full minute.

I can do some profiling but off-hand I wanted to ask if there are any ways to speed up this computation. Or maybe I'm missing something obvious?

moustakas commented 4 years ago

I wonder if having sources.galaxy_basis.CSPSpecBasis subclass sources.ssp_basis.FastSSPBasis instead of sources.ssp_basis.SSPBasis would speed things up.

moustakas commented 4 years ago

I wonder if having sources.galaxy_basis.CSPSpecBasis subclass sources.ssp_basis.FastSSPBasis instead of sources.ssp_basis.SSPBasis would speed things up.

Unfortunately, no change in compute time.

bd-j commented 4 years ago

The default MIST isochrones are just slow the first time the SSPs for a given metallicity are constructed. This is largely due to a huge amount of isochrone points covering the TP-AGB. Ity is on our to-do list to remove some of these points, but this may take some time.

However, subsequent calls with the same metallicity should be fast (since the SSPs get cached unless you change the IMF or something like that.). Once all metallicities are generated, call time should be something like 50ms including nebular emission.