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

zmet out of range #64

Closed dnarayanan closed 8 years ago

dnarayanan commented 8 years ago

for py-fsps hash: e27ea2d96e49fd587de653f127dfb6cf69e380c8 and fsps hash: c45124307a5ecf2fb98e07c4c4b4193ee35a4a57

(which I think should be the latest versions of each code), running the example from the py fsps docs returns an out of bounds error

In [1]: import fsps

In [2]: sp = fsps.StellarPopulation(compute_vega_mags=False, sfh=0, zmet=20,dust_type=2, dust2=0.2, sf_start=6.)
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-2-1569792ad7b1> in <module>()
----> 1 sp = fsps.StellarPopulation(compute_vega_mags=False, sfh=0, zmet=20,dust_type=2, dust2=0.2, sf_start=6.)

/ufrc/narayanan/desika.narayanan/pd/python-fsps/fsps/fsps.pyc in __init__(self, compute_vega_mags, vactoair_flag, zcontinuous, **kwargs)
    450         # Parse any input options.
    451         for k, v in self.params.iteritems():
--> 452             self.params[k] = kwargs.pop(k, v)
    453
    454         # Make sure that we didn't get any unknown options.

/ufrc/narayanan/desika.narayanan/pd/python-fsps/fsps/fsps.pyc in __setitem__(self, k, v)
    992
    993             self._params[k] = v
--> 994             self.check_params()

/ufrc/narayanan/desika.narayanan/pd/python-fsps/fsps/fsps.pyc in check_params(self)
    971         NZ = driver.get_nz()
    972         assert self._params["zmet"] in range(1, NZ + 1), \
--> 973             "zmet={0} out of range [1, {1}]".format(self._params["zmet"], NZ)
    974         assert self._params["dust_type"] in range(5), \
    975             "dust_type={0} out of range [0, 4]".format(

AssertionError: zmet=20 out of range [1, 12]
bd-j commented 8 years ago

The FSPS default isochrones seem to have changed from Padova to MIST, which only has 12 metallicities. You can either change the isochrone set back to Padova in fsps/src/sps_vars.f90 or use zmet=10 for solar metallicity.

dnarayanan commented 8 years ago

ah perfect - thanks a lot.