Closed rrgupta closed 7 years ago
Thats right. For zcontinuous=2
the logzsol
is basically the mode of the MDF. The form of the MDF comes from closed-box chemical evolution, and is covered in several galaxy evolution textbooks.
Note also that you can set pmetals
to a negative number and you will get a 3-point triangular distribution in Z instead of the closed-box MDF. This can be useful to smooth a bit in metallicity without the excessive weighting towards low-Z stars given by the MDF, which strictly speaking should also be age dependent (young-stars will be more metal rich than old stars, but this is not handled in the code as it requires many more parameters to be self-consistently worked out in a quantitative way)
So zcontinuous=2, pmetals<0
will not actually use the (Z*exp(-Z))^pmetals function at all, and instead does something similar to zcontinuous=1
in that it interpolates to a single metallicity for the SSP, but does so using triangular kernel smoothing?
Correct, though you can also think of the triangular kernel used in smoothing as a kind of ad-hoc MDF albeit without as much physical motivation as the Ze^(-Z) version. Though the Ze^(-Z) version really only makes sense for extended star-formation (sfh!=0
) and then only if there is also Z(tage) relation, which is not handled in the code.
I know in the recent Leja et al. paper you guys advocate for the use of zcontinuous=2, pmetals<0
since it produces more physically motivated SEDs. However, I'm finding that it takes nearly 6 times longer to generate models using this option vs. using zcontinuous=1
and doing a simple linear interpolation. I'm guessing this is because the triangular smoothing process is computationally intensive. Do you have a sense of how "wrong" it is to use zcontinuous=1
? It certainly is a more attractive option given that it's so much faster and I need to generate many thousands of models.
I think this is due to a loop over all metallicities in FSPS that is actually unnecessary for the triangular kernel. I'll make a fix in FSPS that speeds this up.
Note though that as soon as you start adding nebular emission (and maybe even dust emission?), that becomes the bottleneck, not the Z smoothing.
The zcontinuous=2, pmetals<0
option has been sped up with cconroy20/fsps#17
It should now be within a factor 2 of zcontinuous=1
Hello, how can I handle the Z(tage) relation for the closed-box Model with the use of zcontinuous=2, pmetals<0 ?
Hi @flyboys, to do closed-box correctly you have to calculate the Z(tage) relation yourself for closed box and then input that as a tabular sfh using the sfh=3
option and set_tabular_sfh()
The pmetals
parameter (see the docs for its description and usage) results in a metallicity distribution at every age, which is not what you expect from closed-box.
Thanks @bd-j Its very impressive , but can not we use the routine PZ CONVOL(yield,zave,spec pz,lbol pz,mass pz) to convolve the full array of metallicity-dependent SSPs with a closed-box (MDF) since the only input here is the Yield ?
PZ_CONVOL is not included within python-fsps. I am also not quite sure that it implements the MDF correctly, since I think it applies the same MDF to each age, whereas for closed box what really happens is the metallicity changes as a monotonic function of age in a way that yields the closed box MDF when summing all ages.
yes that’s correct , but what really confused me , in spite of the fact that; my function was implemented very good sp=fsps.StellarPopulation(compute_vega_mags=False, zcontinuous=1, sfh=3, logzsol=0.0, dust_type=2, imf_type=0 ,pmetals=2,dust2=0.2) ,but when to try to implement sp.set_tabular_sfh(age=13.7,sfr, Z=0.0) as a result i got 'COMPSP ERROR: sfh=3 but sfh_tab array not initialized!'
which was provided with Tabulated SFH ( sfh.dat) and already located in my data directory (SPS_HOME)//'/data/sfh.dat')
in set_tabular_sfh
both variables age
and sfr
must be arrays of the same length describing the SFH. This is noted in the documentation string for set_tabular_sfh
and indeed the line you write
sp.set_tabular_sfh(age=13.7,sfr, Z=0.0)
should result in a separate error, therefore the tabular sfh never gets initialized, leading to the error you report.
sfh.dat
is irrelevant for python-fsps when using sfh=3 or set_tabular_sfh. You have to put in your own SFH using your own age
and sfr
variables in set_tabular_sfh
.
Also note that for a single metallicity you need to set it through the logzsol
or zmet
parameter (depending on the value of zcontinuous
), not through set_tabular_sfh
. For a full metallicity history, where Z
is an array of same length as age
and sfr
you need to initialize the stellar population with zcontinuous=3
Thanks @bd-j ,it was correct . To set sp.set_tabular_sfh(), your variables age and sfr , Z must be arrays of the same length and absolutely correct for zcontinuous=3 to initialize your SP . What really interests me is how we could use the output of our sp.set_tabular_sfh() to prove that metallicity changes at each Age with specific sfr could be affected by yields the closed box MDF when summing all ages.
you can see #87 for some similar tests, except using the Z history in sfh.dat instead of a true closed box metallicity history.
Hello @bd-j , considering z = age / age.max() * 0.019 for the Z history in sfh.data (Its only a linear relation with no effect of sfr or yield ) , unless doing the closed box model , should not we consider the sfr ,yield in our Z history or can i use Z(t) = zlegend*zpow2 EXP(-zlegend/yield) because i wanted to see the yield effect on my Age-metallicity Relation ?
Hi @flyboys, this is more of a science question. You can put in whatever Z(t) relation you want using the tabular SFH. But python-fsps will not compute the relation for you.
Hi, I just wanted to confirm my understanding of the
zcontinuous
options and get a bit more background info on the metallicity distribution function (MDF). If I got this right, the 3zcontinuous
options are: 0: SSP has metallicity fixed to one of the allowed discrete values for the isochrone set I'm using (set by integer value ofzmet
) 1: SSP has metallicity fixed to any interpolated value in between the (min,max) of my isochrone set (set bylogzsol
) 2: SSP has a range of metalliticies set by the MDF, which is defined by exponentpmetals
andlogzsol
(which is something like a normalization?)Is that correct? Also, do you have any article reference(s) for this functional form of the MDF? I'd like to learn more about it in order to decide what values of
pmetals
andlogzsol
I want to choose.