dfm / python-fsps

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

Add documentation about changing FSPS libraries using compiler flags #139

Closed dfm closed 3 years ago

dfm commented 3 years ago

To change the libraries, we would use something like this for a local version:

FFLAGS="-DMIST=0 -DPADOVA=1 -DMILES=0 -DBASEL=1" python -m pip install .

And I think this will also work with a version from PyPI using the following:

FFLAGS="-DMIST=0 -DPADOVA=1 -DMILES=0 -DBASEL=1" python -m pip install fsps --no-binary fsps

Where the --no-binary fsps flag is required to force building from source.

Originally posted by @dfm in https://github.com/dfm/python-fsps/issues/136#issuecomment-779514680

dfm commented 3 years ago

I've pushed a release candidate to PyPI so we can test this now. I can confirm that running:

FFLAGS="-DMIST=0 -DPADOVA=1 -DMILES=0 -DBASEL=1" python -m pip install fsps==0.3.0rc1 --no-binary fsps
python -c 'import fsps;sps = fsps.StellarPopulation();print(sps.libraries)'

prints

(b'pdva', b'basel')
ghost commented 3 years ago

Hi @dfm,

I have changed the default isochrone library from 'MIST' to 'BaSTI' using

FFLAGS="-DBASTI=1 -DMIST=0 -DPADOVA=0 -DMILES=1 -DBASEL=0" python -m pip install fsps==0.3.0rc1 --no-binary fsps

So the isochrone library has been changed, but the output of fsps.list_filters() is ['v', 'u', 'b', 'buser_b', 'cousins_r', 'cousins_i', 'cfht_b', 'cfht_r', 'cfht_i', '2mass_j', '2mass_h', '2mass_ks', 'sdss_u', 'sdss_g', 'sdss_r', 'sdss_i', 'sdss_z', 'wfpc2_f255w', 'wfpc2_f300w', 'wfpc2_f336w', 'wfpc2_f439w', 'wfpc2_f450w', 'wfpc2_f555w', 'wfpc2_f606w', 'wfpc2_f814w', 'wfpc2_f850lp', 'wfc_acs_f435w', 'wfc_acs_f475w', 'wfc_acs_f555w', 'wfc_acs_f606w', 'wfc_acs_f625w', 'wfc_acs_f775w', 'wfc_acs_f814w', 'wfc_acs_f850lp', 'wfc3_uvis_f218w', 'wfc3_uvis_f225w', 'wfc3_uvis_f275w', 'wfc3_uvis_f336w', 'wfc3_uvis_f390w', 'wfc3_uvis_f438w', 'wfc3_uvis_f475w', 'wfc3_uvis_f555w', 'wfc3_uvis_f606w', 'wfc3_uvis_f775w', 'wfc3_uvis_f814w', 'wfc3_uvis_f850lp', 'wfc3_ir_f098m', 'wfc3_ir_f105w', 'wfc3_ir_f110w', 'wfc3_ir_f125w', 'wfc3_ir_f140w', 'wfc3_ir_f160w', 'irac_1', 'irac_2', 'irac_3', 'irac_4', 'isaac_ks', 'fors_v', 'fors_r', 'nicmos_f110w', 'nicmos_f160w', 'galex_fuv', 'galex_nuv', 'des_g', 'des_r', 'des_i', 'des_z', 'des_y', 'wfcam_z', 'wfcam_y', 'wfcam_j', 'wfcam_h', 'wfcam_k', 'steidel_un', 'steidel_g', 'steidel_rs', 'steidel_i', 'megacam_u', 'megacam_g', 'megacam_r', 'megacam_i', 'megacam_z', 'wise_w1', 'wise_w2', 'wise_w3', 'wise_w4', 'uvot_w2', 'uvot_m2', 'uvot_w1', 'mips_24', 'mips_70', 'mips_160', 'scuba_450wb', 'scuba_850wb', 'pacs_70', 'pacs_100', 'pacs_160', 'spire_250', 'spire_350', 'spire_500', 'iras_12', 'iras_25', 'iras_60', 'iras_100', 'bessell_l', 'bessell_lp', 'bessell_m', 'stromgren_u', 'stromgren_v', 'stromgren_b', 'stromgren_y', 'i1500', 'i2300', 'i2800', 'jwst_f070w', 'jwst_f090w', 'jwst_f115w', 'jwst_f150w', 'jwst_f200w', 'jwst_f277w', 'jwst_f356w', 'jwst_f444w', 'newfirm_j1', 'newfirm_j2', 'newfirm_j3', 'newfirm_h1', 'newfirm_h2', 'newfirm_k', 'vista_y', 'vista_j', 'vista_h', 'vista_k', 'suprimecam_b', 'suprimecam_g', 'suprimecam_v', 'suprimecam_r', 'suprimecam_i', 'suprimecam_z', 'ps1_g', 'ps1_r', 'ps1_i', 'ps1_z', 'ps1_y']

Which does not include Gaia filters though the Gaia filters have been added to the BaSTI isochrone library. Why is that so? Kindly suggest.

dfm commented 3 years ago

Pinging @bd-j who might be able to help!

bd-j commented 3 years ago

Hi @Dh-hgi, FSPS does not use the magnitudes as provided by isochrone files. Magnitudes are computed at run time within FSPS using the FSPS stellar spectral libraries and the stored transmission curves. This allows the same machinery used for computing the spectra of integrated stellar populations (and for altering the isochrones) to be used by write_isochrones. I'd also note that write_isochrones is more of a convenience function; the primary goal of FSPS is to compute the integrated spectra of stellar populations.

bd-j commented 3 years ago

To include Gaia filters they would have to be added to the FSPS filter transmission database; feel free to open an issue or make a PR in the cconroy20/fsps core repository related to this (IIRC there are a number of extant Gaia filter curve determinations so some discussion of which to use might be useful)

dfm commented 3 years ago

Closed by #144