Closed rrgupta closed 3 years ago
when tage !=0
the normalization is such that one solar mass formed from t=0
to tage
. When tage=0
the normalization is such that one solar mass formed from t=0
to the oldest isochrone.
The compsp warning should not be coming up though.
Got it, thanks.
Yeah, I wasn't worried about the COMPSP warning since I figured it was just because sf_trunc=0.0
by default and so for any value of sf_start
>0, it will give that warning.
FYI, the python-fsps doc string says sf_trunc
and sf_slope
are undocumented, but it looks like the most recent version of the FSPS MANUAL.pdf has definitions documented in there.
Feel free to close this issue whenever. Thanks again!
If tage != 0
and the normalization of get_mags()
is such that 1 solar mass is formed from t=0
to tage
, does that imply that the mass-to-light ratio in some band (call it X) for that model is 1.0/(10**(-0.4*model_mag_X))
? And if I am using redshift_colors=True
can I estimate the mass of my observed galaxy by simply multiplying the best-fit model SED M/L by 10**(-0.4*obs_mag_X)
? According to Sec. 1.5 of Charlie's MANUAL.pdf (Redshift Effects), "returned magnitudes include both the relevant (1 + z) factors and the distance modulus" and so is it true that I don't need to correct my observed mags for distance modulus? If I do this, the masses I get are way too low, probably because the model mags I'm getting from get_mags()
seem so bright (~ 10 mag) for 1 solar mass of material at an intermediate redshift. I must be missing something. How do you properly estimate masses from the outputs of get_mags(tage != 0)
? Thanks.
does that imply that the mass-to-light ratio in some band (call it X) for that model is 1.0/(10*_(-0.4_model_mag_X))?
Not quite. You can access the stellar masses (including stellar remnants if add_stellar_remnants==True
) with the sp.stellar_mass
attribute. This returns the actual surviving stellar mass for the current parameter set. The 1 solar mass is for the solar mass formed (of which some is returned to the ISM through stellar evolution.)
The interaction of get_mags()
with zred
, redshift
, and redshift_colors
is a little complicated and not ideal. Also redshift_colors
looks from the source like it might be broken in FSPS for tage != 0
. I think what you want is something like
sp.params['zred'] = 0
sp.params['redshift_colors'] = False
model_mag_x = sp.get_mags(redshift=z, tage=t, bands=[x])
total_mass = sp.stellar_mass * 10**(0.4 * (model_mag_x - obs_mag_x))
In this case you have to do your own conversions between age and redshift (e.g. using astropy.cosmology)
If you use zred
instead and then set redshift=0
in the call to get_mags
you will get apparent model magnitudes that are too small by mu - 2.5log(1+zred)
Let me know if the above gives sensible results, and thanks for all this feedback and testing!
Ah...I think I see. So in get_mags()
the redshift
and tage
keywords are completely decoupled. I want to output the observed mags of a model galaxy as it evolves over cosmic time (in small redshift bins) for the purposes of SED fitting to observed mags. If I understand what you're saying, I should first compute a t(z) relation (using astropy.cosmology and assuming my favorite cosmology) and obtain the model mags by calling get_mags()
and inserting these t and z values as in your example, while looping over cosmic time, under the condition that each call to get_mags()
contains a pair of (z, t) that satisfy my t(z) relation:
model_mag_x = sp.get_mags(redshift=z, tage=t, bands=[x])
Is that correct?
Regarding your calculation of mass:
total_mass = sp.stellar_mass * 10**(0.4 * (model_mag_x - obs_mag_x))
my obs_mag_x
should simply be my observed mags from my telescope, corrected for MW extinction but no need for k-corrections or distance modulus, right? And to be clear, the units of sp.stellar_mass
are M_sun, not log10(M_sun)? Thanks (and sorry for all the naïve questions)!
yes, that all sounds good.
Ideally setting redshift_colors=True
would couple redshift
and tage
in get_mags
but we don't yet have the necessary checks and the code in FSPS itself looks broken for the tage !=0
case. Fixing this up is on the list for the next code sprint.
Yeah, the last time I used FSPS was a few years back (v2.1) and at the time I was using redshift_colors=1
(True) which is why I was trying to do the same here in python-fsps. However, your solution above seems to give reasonable results that are in pretty good agreement to the masses I had computed years ago with FSPS v2.1.
In PR #73 we added a new attribute, formed_mass
that for tage =0
will allow you to work out the normalization compared to the tage=0
case. #73 also updated the docstring to note that redshift_colors
has no effect in python-FSPS.
Dear @jrleja ,regarding to the M/L ration . Using FSPS , how would you calculate Mass light ratio as a function of age for a fixed stellar mass or when your IMF=const . I am using the first channel of Spitzer satellite IRAC-1 as Band for my get mags() function .
What I meant to say , physically M/L ratio is an indirect way to describe the age and metallicity in your stellar population . My goal is to modify it with first channel band of Spitzer satellite with a given sfr to get the luminousity as a function of age for each of my stellar population samples.
This is related to Issue #4 but a separate problem, I think. When I run
get_mags()
without anytage
option it gives me an array of mags at each isochrone age, as expected. But I'm finding that when I specify a nonzerotage
inget_mags()
I get a set of mags returned that are inconsistent with the defaulttage=0.0
output for that given age.Here's an example using the MIST library:
You can see that at an age of 10 Gyr, the mags are not the same (4.86723385 for
tage=10.
and 5.504291255 fortage=0.0
). Am I misunderstanding how thetage
option forget_mags()
works?