synthpop.modules.population_density._population_density
This file contains the base class for the population density distributions.
Classes
This is the Parent Class for population densities functions |
Module Contents
- class synthpop.modules.population_density._population_density.PopulationDensity(sun: types.ModuleType = None, coord_trans: types.ModuleType = None, gamma_flare: float = None, h_flare: float = None, radius_flare: float = 0, logger: types.ModuleType = None, **kwargs)
Bases:
abc.ABCThis is the Parent Class for population densities functions
Attributes
- population_density_namestr
name of the population density
- density_unitstr
specifier if density profile returns “number”-, “mass”- or “init_mass”-density
(more attributes are specified in the subclasses)
Methods
- __init__() :
Initialize the PopulationDensity class
- density(r: ndarray, theta, ndarray, z: ndarray)ndarray
estimate the density at (r,theta,z) (specified in the subclasses)
- average_mass = None
- average_mass_coor = None
- logger = None
- sun = None
- population_density_name = 'None'
- density_unit = "one of 'mass', 'init_mass', or 'number'"
- coord_trans = None
- gamma_flare = 0
- h_flare = None
- radius_flare = 0
- abstract density(r: numpy.ndarray, phi_rad: numpy.ndarray, z: numpy.ndarray) numpy.ndarray
Estimates the density at the given position
Parameters
- rndarray [‘kpc’]
Distance to z axis
- phi_radndarray [‘rad’]
azimuth angle of the stars. phi_rad = 0 is pointing towards sun.
z : height above the galactic plane (corrected for warp of the galaxy)
Returns
- rhondarray [M_sun/kpc^3 or #/kpc^3]
density at the given location, either in number density evolved mass density or initial mass density should be specified in density_unit.
- get_kappa_flare(r_kpc: np.ndarray or float, gamma_flare: float = None, h_flare: float = None, radius_flare: float = None) np.ndarray or float
Estimates the correction factor for the Warp. The scale height should then be multiplied by kappa_flare
Parameters
- r_kpcfloat or ndarray
galactocentric radii
- gamma_flare: float or None
slope of the flare if None use the default value from const
- radius_flare: float or None
radius when the flare starts if None use the default value from const
Returns
- kappa_flarendarray:
correction factor for the scale height
- gradient(r_kpc: np.ndarray or float, phi_rad: np.ndarray or float, z_kpc: np.ndarray or float, eps: Tuple[float] = (0.001, 0.0001, 0.001)) Tuple[np.ndarray or float, np.ndarray or float, np.ndarray or float]
return the gradient at the given location
Parameters
- r_kpcfloat, ndarray [kpc]
Radius in kpc
- phi_radfloat, ndarray [rad]
polar angle follows the rotation of the galaxy zero point is at the sun.
- z_kpcfloat, ndarray [kpc]
height above/below the galactic plane
- eps: Tuple(float,float,float)
difference used to estimate the gradient
Returns
- dRho_dRfloat, ndarray
Gradient in Radius
- dRho_dPhifloat, ndarray
Gradient in polar angle direction
- dRho_dzfloat, ndarray
Gradient in z direction