SFH Models#
SFH modeling in Lightning is biased toward the use of the “non-parametric” PiecewiseConstSFH as in every previous
Lightning publication.
- class lightning.sfh.PiecewiseConstSFH#
Bases:
objectClass for piecewise-constant star formation histories.
\[\psi(t) = \psi_i,~t_i \leq t < t_{i+1}\]- Parameters:
- agearray-like, (Nbins+1)
This array should define the edges of the stellar age bins.
Methods
evaluate(params)Return the SFR as a function of time.
multiply(params, arr)Multiply the SFR in each bin by a supplied array (to determine, e.g., the stellar mass in each bin).
sum(params, arr[, cumulative])Multiply the SFR in each bin by a supplied array and sum along the age axis.
- __init__(age)#
- __new__(*args, **kwargs)#
- evaluate(params)#
Return the SFR as a function of time.
For this piecewise constant SFH, it’s just a pass-through for params after checking that it’s the right shape.
- Parameters:
- paramsarray-like (Nmodels, Nbins)
SFR in each bin.
- Returns:
- sfrt
- multiply(params, arr)#
Multiply the SFR in each bin by a supplied array (to determine, e.g., the stellar mass in each bin).
For normal internal use this function determines the appropriate broadcast shape of the output based on the shape of
arr(which could be, e.g. stellar mass as a function of time, or luminosity density as a function of time and wavelength). If you find yourself using this function on its own, check the shape of the outputs carefully.- Parameters:
- paramsarray-like (Nmodels, Nbins)
SFR in each bin.
- arrarray-like, (…, Nbins, …) (up to three dimensions)
Array to multiply by the SFH.
- Returns:
- resarray-like
Product of sfh and
arrbroadcast to whatever shape was deemed appropriate.
- sum(params, arr, cumulative=False)#
Multiply the SFR in each bin by a supplied array and sum along the age axis.
For normal internal use this function determines the appropriate broadcast shape of the output based on the shape of
arr(which could be, e.g. stellar mass as a function of time, or luminosity density as a function of time and wavelength). If you find yourself using this function on its own, check the shape of the outputs carefully.- Parameters:
- paramsarray-like (Nmodels, Nbins)
SFR in each bin.
- arrarray-like, (…, Nbins, …) (up to three dimensions)
Array to multiply by the SFH.
- cumulativebool
If
True, return the cumulative sum as a function of age.
- Returns:
- resarray-like, (Nmodels, …)
Product of sfh and
arr, summed along the age axis.
Several parametric SFH models are also included in the code for implementing toy models, simulating populations, reproducing literature results, etc.
- class lightning.sfh.DelayedExponentialSFH#
Bases:
FunctionalSFHDelayed exponential burst of star formation
\[\psi(t) = A (t / \tau) \exp(-t / \tau)\]Methods
evaluate(params)Returns the SFR as a function of time.
integrate(params, arr[, cumulative])Multiply the SFR in each bin by a supplied array and integrate along the age axis.
multiply(params, arr)Multiply the SFR in each bin by a supplied array (to determine, e.g., the stellar mass in each bin).
- __init__(age)#
- __new__(*args, **kwargs)#
- evaluate(params)#
Returns the SFR as a function of time.
- integrate(params, arr, cumulative=False)#
Multiply the SFR in each bin by a supplied array and integrate along the age axis.
For normal internal use this function determines the appropriate broadcast shape of the output based on the shape of
arr(which could be, e.g. stellar mass as a function of time, or luminosity density as a function of time and wavelength). If you find yourself using this function on its own, check the shape of the outputs carefully.- Parameters:
- paramsarray-like (Nmodels, Nbins)
SFR in each bin.
- arrarray-like, (…, Nbins, …) (up to three dimensions)
Array to multiply by the SFH.
- cumulativebool
If
True, return the cumulative intgral as a function of age.
- Returns:
- resarray-like, (Nmodels, …)
Product of sfh and
arr, integrated along the age axis.
- multiply(params, arr)#
Multiply the SFR in each bin by a supplied array (to determine, e.g., the stellar mass in each bin).
For normal internal use this function determines the appropriate broadcast shape of the output based on the shape of
arr(which could be, e.g. stellar mass as a function of time, or luminosity density as a function of time and wavelength). If you find yourself using this function on its own, check the shape of the outputs carefully.- Parameters:
- paramsarray-like (Nmodels, Nparams)
Model parameters.
- arrarray-like, (…, Nbins, …) (up to three dimensions)
Array to multiply by the SFH.
- Returns:
- resarray-like
Product of sfh and
arrbroadcast to whatever shape was deemed appropriate.
- class lightning.sfh.SingleExponentialSFH#
Bases:
FunctionalSFHExponentially decaying burst of star formation
\[\begin{split}\psi(t) = \begin{cases} A \exp[(t - t_{burst}) / \tau] / k,~&t \leq t_{burst} \\\\ 0,~&t > t_{burst} \end{cases}\end{split}\]where
\[k = \tau * [1 - \exp(-t_{burst} / \tau)]\]Methods
evaluate(params)Returns the SFR as a function of time.
integrate(params, arr[, cumulative])Multiply the SFR in each bin by a supplied array and integrate along the age axis.
multiply(params, arr)Multiply the SFR in each bin by a supplied array (to determine, e.g., the stellar mass in each bin).
- __init__(age)#
- __new__(*args, **kwargs)#
- evaluate(params)#
Returns the SFR as a function of time.
- integrate(params, arr, cumulative=False)#
Multiply the SFR in each bin by a supplied array and integrate along the age axis.
For normal internal use this function determines the appropriate broadcast shape of the output based on the shape of
arr(which could be, e.g. stellar mass as a function of time, or luminosity density as a function of time and wavelength). If you find yourself using this function on its own, check the shape of the outputs carefully.- Parameters:
- paramsarray-like (Nmodels, Nbins)
SFR in each bin.
- arrarray-like, (…, Nbins, …) (up to three dimensions)
Array to multiply by the SFH.
- cumulativebool
If
True, return the cumulative intgral as a function of age.
- Returns:
- resarray-like, (Nmodels, …)
Product of sfh and
arr, integrated along the age axis.
- multiply(params, arr)#
Multiply the SFR in each bin by a supplied array (to determine, e.g., the stellar mass in each bin).
For normal internal use this function determines the appropriate broadcast shape of the output based on the shape of
arr(which could be, e.g. stellar mass as a function of time, or luminosity density as a function of time and wavelength). If you find yourself using this function on its own, check the shape of the outputs carefully.- Parameters:
- paramsarray-like (Nmodels, Nparams)
Model parameters.
- arrarray-like, (…, Nbins, …) (up to three dimensions)
Array to multiply by the SFH.
- Returns:
- resarray-like
Product of sfh and
arrbroadcast to whatever shape was deemed appropriate.
New user-specific parametric SFHs can be added by defining classes that extend
the FunctionalSFH class and define the evaluate method.
- class lightning.sfh.base.FunctionalSFH#
Base class for functional (delayed exponential, double exponential, etc.) star formation histories.
- Parameters:
- agearray-like
Grid of stellar ages on which to evaluate the SFH.
Methods
evaluate(params)Return the SFR as a function of time.
integrate(params, arr[, cumulative])Multiply the SFR in each bin by a supplied array and integrate along the age axis.
multiply(params, arr)Multiply the SFR in each bin by a supplied array (to determine, e.g., the stellar mass in each bin).
- __init__(age)#
- __new__(*args, **kwargs)#
- evaluate(params)#
Return the SFR as a function of time.
- Parameters:
- paramsarray-like (Nmodels, Nparams)
Model parameters.
- Returns:
- sfrtarray-like (Nmodels, Nages)
- integrate(params, arr, cumulative=False)#
Multiply the SFR in each bin by a supplied array and integrate along the age axis.
For normal internal use this function determines the appropriate broadcast shape of the output based on the shape of
arr(which could be, e.g. stellar mass as a function of time, or luminosity density as a function of time and wavelength). If you find yourself using this function on its own, check the shape of the outputs carefully.- Parameters:
- paramsarray-like (Nmodels, Nbins)
SFR in each bin.
- arrarray-like, (…, Nbins, …) (up to three dimensions)
Array to multiply by the SFH.
- cumulativebool
If
True, return the cumulative intgral as a function of age.
- Returns:
- resarray-like, (Nmodels, …)
Product of sfh and
arr, integrated along the age axis.
- multiply(params, arr)#
Multiply the SFR in each bin by a supplied array (to determine, e.g., the stellar mass in each bin).
For normal internal use this function determines the appropriate broadcast shape of the output based on the shape of
arr(which could be, e.g. stellar mass as a function of time, or luminosity density as a function of time and wavelength). If you find yourself using this function on its own, check the shape of the outputs carefully.- Parameters:
- paramsarray-like (Nmodels, Nparams)
Model parameters.
- arrarray-like, (…, Nbins, …) (up to three dimensions)
Array to multiply by the SFH.
- Returns:
- resarray-like
Product of sfh and
arrbroadcast to whatever shape was deemed appropriate.