dfm / python-fsps

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

Metallicity out of range error #67

Closed rrgupta closed 7 years ago

rrgupta commented 8 years ago

Hi, I just installed FSPS v3.0 and python fsps v0.2.2 yesterday. I went to try the example here: http://dan.iel.fm/python-fsps/current/stellarpop_api/#example but when I instatiate the SSP following the example I get the following error: AssertionError: zmet=20 out of range [1, 12] This seems odd since my understanding is the Padova isochrones are used by default and I have checked that the Padova zlegend.dat file contains 22 metallicities (so zmet=20 as in the example should be fine). Any idea what is going wrong? Thanks!

bd-j commented 8 years ago

The bleeding edge development version of FSPS now has MIST as the default isochrone set, which only has 12 metallicities. You can change that in fsps/src/sps_vars.f90 if you want the old Padova isochrones. Sorry for the confusion, I'll try to update the python-FSPS documentation to reflect this change in defaults.

rrgupta commented 8 years ago

Thanks! And I just noticed this is also a closed issue someone else had brought up -- should have checked those first, sorry!

bd-j commented 8 years ago

no problem. I'm going to reopen this as a reminder to fix the docs, and make it easier to see for anyone else.

rrgupta commented 8 years ago

Following up on this: I edited fsps/src/sps_vars.f90 so that the set isochrone library block now reads:

#define MIST 0
!Padova models circa 2008
#define PADOVA 1
#define PARSEC 0
#define BASTI 0
#define GENEVA 0

I then did a "make clean" in the src directory (as per Charlie's instructions in the Manual) and then ran a "make" again. However, running this example with zmet=20 still gives the same error: AssertionError: zmet=20 out of range [1, 12]. Am I forgetting something else?

bd-j commented 8 years ago

You need to reinstall python-fsps after fsps is recompiled

cd /path/to/python-fsps/
python setup.py install
rrgupta commented 8 years ago

Hmm...What is the procedure if I installed with pip? Do I have to "pip uninstall" and then "pip install" again?

dnarayanan commented 8 years ago

i'm not 100% sure but try

pip install packagename -U

and maybe it will work? otherwise uninstall and install should work

On Wed, Sep 21, 2016 at 12:53 AM, Ravi Gupta notifications@github.com wrote:

Hmm...What is the procedure if I installed with pip? Do I have to "pip uninstall" and then "pip install" again?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dfm/python-fsps/issues/67#issuecomment-248511317, or mute the thread https://github.com/notifications/unsubscribe-auth/AEQRW0sDV0cwg9w63TbyB82miuhEBTxwks5qsLhkgaJpZM4J_FHf .

bd-j commented 7 years ago

Docs are now updated to use zcontinuous=1 and logzsol in the example, instead of zmet. Also an example of using the libraries attribute to know which isochrone and spectral library you are using. Hopefully the zmet confusion shouldn't come up anymore, so closing.