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

stellar_mass array #66

Closed safonova closed 7 years ago

safonova commented 8 years ago

I need to find galaxy stellar mass for a set of stellar formation parameters. Could you please clarify the legend for stellar_mass? All the permutations I've tried return an array of length 107. See example below.

>>> sp = fsps.StellarPopulation(compute_vega_mags=False, fburst=1, dust2=0,
...                             tburst=2.1, sfh=0, add_stellar_remnants=1)
>>> mass = sp.stellar_mass
>>> len(mass)
107
>>> mass
array([ 0.98616134,  0.9769826 ,  0.98562886,  0.9711376 ,  0.97735713,
        0.98599344,  0.97116799,  0.97546839,  0.98408086,  0.985447  ,
        0.97430706,  0.9810679 ,  0.98456513,  0.98291342,  0.98144469,
        0.98289142,  0.98496373,  0.98510727,  0.984505  ,  0.98129545,
        0.98287753,  0.98177916,  0.98539177,  0.9852902 ,  0.98632074,
        0.98435871,  0.98143104,  0.98484755,  0.98182749,  0.98662982,
        0.99517756,  0.99452189,  0.98956458,  0.98525965,  0.97990264,
        0.9752592 ,  0.97128988,  0.9578926 ,  0.94327441,  0.9315638 ,
        0.92393593,  0.91528826,  0.90535964,  0.89380085,  0.88523836,
        0.8777081 ,  0.87052765,  0.86343586,  0.85690613,  0.85141056,
        0.84669751,  0.84096454,  0.83359988,  0.82624121,  0.81992397,
        0.81296946,  0.80682805,  0.79950558,  0.79314997,  0.78615958,
        0.78023559,  0.7735735 ,  0.76666815,  0.76039073,  0.75389661,
        0.74778219,  0.7415822 ,  0.73524118,  0.72895989,  0.72247523,
        0.71616977,  0.71041594,  0.70453481,  0.69886719,  0.69338396,
        0.68809376,  0.68287829,  0.67774895,  0.67282461,  0.66799453,
        0.6632059 ,  0.65811364,  0.65292194,  0.64751641,  0.64188525,
        0.63671824,  0.63194398,  0.62742008,  0.6229796 ,  0.61876836,
        0.61474785,  0.61079031,  0.60699565,  0.60330605,  0.59971137,
        0.59623209,  0.59291197,  0.58967825,  0.58659533,  0.58366297,
        0.58079528,  0.57811899,  0.57556869,  0.57315952,  0.57090274,
        0.56879837,  0.56686542])
bd-j commented 8 years ago

If tage is not given or is zero the masses are returned for every age in the sp.ssp_ages array. Also since you have sfh=0, the tburst and fburst parameters are ignored - please see the "SFH Parameters" section of the FSPS manual for a description of how the SFH parameters work.

With sfh=0 and not specifying tage, what you are getting is the surviving stellar mass (including remnants) of an SSP with the default zmet metallicity, at each of the ages given by sp.ssp_ages, for 1 solar mass formed initially.

If what you want is the stellar mass of a solar metallicity SSP at 2.1 Gyr, you could do the following

sp = fsps.StellarPopulation(compute_vega_mags=False, zcontinuous=1, add_stellar_remnants=True)

sp.params['logzsol'] = 0.0
sp.params['sfh'] = 0
sp.params['tage'] = 2.1
mass = sp.stellar_mass

Note that the logzsol parameter only works if you set zcontinuous at instantiation.

astromariana commented 11 months ago

Hello FSPS team! I hope you're doing well. I've been exploring various SPSs, and I noticed that in FSPS, the sp.stellar_mass parameter shows some variation in the mass fraction between logage 5 to 6.3. I was wondering if you could provide some insights into this. For comparison, I observed a decreasing behaviour in the mass fractions of the Bruzual & Charlot SPS. Also, does fsps.get_remnant_mass_fraction() exist? Thanks in advance for your guidance!

bd-j commented 11 months ago

Hi! I suspect this is due to some numerical issues in the interaction of the IMF upper limit with the sampling of the high mass end of the isochrones at very early ages, but it might have to do with how remnants are computed. Can you reopen this issue on the core FSPS repo (https://github.com/cconroy20/fsps), noting the output of sp.libraries? Thanks.

There is no StellarPopulation().get_remnant_mass_fraction, but I think you can set sp.params["add_stellar_remnants"] = False and then take the difference.

astromariana commented 11 months ago

Thank you, @bd-j! I just opened an issue.