synthpop.modules.metallicity.double_gaussian
Metallicity class for a double Gaussian distribution, where the two distributions have a relative weight, upper and lower limits, and each Gaussian is given a mean and standard deviation.
Classes
Double Gaussian metallicity class |
Module Contents
- class synthpop.modules.metallicity.double_gaussian.DoubleGaussian(weight: float, mean1: float, std1: float, mean2: float, std2: float, low_bound: float = -4, high_bound: float = 0.5, **kwargs)
Bases:
synthpop.modules.metallicity._metallicity.MetallicityDouble Gaussian metallicity class
Attributes
- metallicity_func_namestring
A class attribute for the name of the _MetallicityBase subclass that this is.
- weightfloat
percentage of stars belonging to the first Gaussian distribution ( A1/(A1+A2))
- mean1float [[Fe/H]]
the mean value of the first Gaussian distribution
- std1float [[Fe/H]]
the standard deviation of the first Gaussian distribution
- mean2float [[Fe/H]]
the mean value of the second Gaussian distribution
- std2float [[Fe/H]]
the standard deviation of the second Gaussian distribution
- lower_boundfloat [[FE/H]]
lower limit for truncation of the distribution
- upper_boundfloat [[FE/H]]
upper limit for truncation of the distribution
Methods
- __init__(self,Population)None
- check that required attributes of Population are present:
-Population.metallicity_func_kwargs : float
- random_metallicity(self)float
return a random metallicity drawn from the weighted double Gaussian
- average_metallicity(self)float
return the average metallicity
- metallicity_func_name = 'double-gaussian'
- weight
- mean1
- std1
- mean2
- std2
- lower = -4
- upper = 0.5
- draw_random_metallicity(N: int or None = None, **kwargs) np.ndarray or float
Returns one or more metallicities in [Fe/H] from a double Gaussian distribution.
Parameters
- Nint, None, optional
if N is set to an integer, an array with N random ages is returned
Returns
- valndarray, float [Gyr]
single metallicities or ndarray of N metallicities in [Fe/H]
- likelyhood_distribution(met: numpy.ndarray) numpy.ndarray
analytic version of likelyhood_distribution. only used for the validating