synthpop.modules.metallicity.double_gaussian ============================================ .. py:module:: synthpop.modules.metallicity.double_gaussian .. autoapi-nested-parse:: 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 ------- .. autoapisummary:: synthpop.modules.metallicity.double_gaussian.DoubleGaussian Module Contents --------------- .. py:class:: DoubleGaussian(weight: float, mean1: float, std1: float, mean2: float, std2: float, low_bound: float = -4, high_bound: float = 0.5, **kwargs) Bases: :py:obj:`synthpop.modules.metallicity._metallicity.Metallicity` Double Gaussian metallicity class Attributes ---------- metallicity_func_name : string A class attribute for the name of the _MetallicityBase subclass that this is. weight : float percentage of stars belonging to the first Gaussian distribution ( A1/(A1+A2)) mean1 : float [[Fe/H]] the mean value of the first Gaussian distribution std1 : float [[Fe/H]] the standard deviation of the first Gaussian distribution mean2 : float [[Fe/H]] the mean value of the second Gaussian distribution std2 : float [[Fe/H]] the standard deviation of the second Gaussian distribution lower_bound : float [[FE/H]] lower limit for truncation of the distribution upper_bound : float [[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 .. py:attribute:: metallicity_func_name :value: 'double-gaussian' .. py:attribute:: weight .. py:attribute:: mean1 .. py:attribute:: std1 .. py:attribute:: mean2 .. py:attribute:: std2 .. py:attribute:: lower :value: -4 .. py:attribute:: upper :value: 0.5 .. py:method:: _gen_met(N: int = 1) -> numpy.ndarray generate random metallicities using a mixture methode .. py:method:: 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 ---------- N : int, None, optional if N is set to an integer, an array with N random ages is returned Returns ------- val : ndarray, float [Gyr] single metallicities or ndarray of N metallicities in [Fe/H] .. py:method:: average_metallicity() -> float Determine the average metallicity of the population .. py:method:: likelyhood_distribution(met: numpy.ndarray) -> numpy.ndarray analytic version of likelyhood_distribution. only used for the validating