synthpop.modules.metallicity._metallicity
This file contains the base class for the Metallicity distributions.
Classes
Metallicity class for a Population class. he appropriate subclass is |
Module Contents
- class synthpop.modules.metallicity._metallicity.Metallicity(sun: types.ModuleType = None, coord_trans: types.ModuleType = None, logger: types.ModuleType = None, **kwargs)
Bases:
abc.ABCMetallicity class for a Population class. he appropriate subclass is assigned based on the metallicity_func_kwargs through the “get_subclass” factory.
Attributes
- metallicity_func_namestr
name of the metallicity Class
(more attributes are specified in the subclasses)
Methods
- __init__(self,**kwargs)None
initialize the metallicity class
- draw_random_metallicity(self, N: int or None = None,
x: np.ndarray or float = None, y: np.ndarray or float = None, z: np.ndarray or float = None, ) : float, ndarray [[Fe/H]]
returns one or more random metallicity values in [Fe/H]. (specified in the subclasses)
- average_metallicity(self)float [[Fe/H]]
returns the average metallicity for the distribution in [Fe/H] (specified in the subclasses)
- logger = None
- sun
- coord_trans = None
- metallicity_func_name = 'None'
- abstract draw_random_metallicity(N: int or None = None, x: np.ndarray or float = None, y: np.ndarray or float = None, z: np.ndarray or float = None, age: np.ndarray or float = None) np.ndarray or float
Generate a random metallicity from the distribution
Parameters
- Nint, None, optional
if N is set to an integer, an array with N random metallicities is returned
- x, y, z,float, ndarray [kpc]
galactocentric cartesian coordinates has length N, or is a float if N == None
- agefloat, ndarray [Gyr]
age of the stars has length N, or is a float if N == None
Returns
- random_metallicityfloat, ndarray [[Fe/H]]
array of random metallicities
- likelyhood_distribution(met: numpy.ndarray) numpy.ndarray
analytic version of likelyhood_distribution. only used for the validating