synthpop.modules.population_density.density_from_grid ===================================================== .. py:module:: synthpop.modules.population_density.density_from_grid .. autoapi-nested-parse:: Density function that interpolates over a grid Classes ------- .. autoapisummary:: synthpop.modules.population_density.density_from_grid.density_from_grid Module Contents --------------- .. py:class:: density_from_grid(moment_file=None, density_unit='mass', abs_z=True, **kwargs) Bases: :py:obj:`synthpop.modules.population_density._population_density.PopulationDensity` Generic PopulationDensity subclass to interpolate over a grid Attributes ---------- moment_file : str name of the file containing a grid with 3 required columns: r, z, and rho units must be kpc, kpc, and Msun/pc^3 file must be whitespace delimited and have comments marked with '#' density_unit : str "mass" or "number" to specify units for the provided density .. py:attribute:: interpolate_rho .. py:attribute:: density_unit :value: 'mass' .. py:attribute:: abs_z :value: True .. py:method:: density(r, theta, z) Estimates the density at the given position Parameters ---------- r : ndarray ['kpc'] Distance to z axis phi_rad : ndarray ['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 ------- rho : ndarray [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.