synthpop.modules.population_density.density_from_grid

Density function that interpolates over a grid

Classes

density_from_grid

Generic PopulationDensity subclass to interpolate over a grid

Module Contents

class synthpop.modules.population_density.density_from_grid.density_from_grid(moment_file=None, density_unit='mass', abs_z=True, **kwargs)

Bases: synthpop.modules.population_density._population_density.PopulationDensity

Generic PopulationDensity subclass to interpolate over a grid

Attributes

moment_filestr

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_unitstr

“mass” or “number” to specify units for the provided density

interpolate_rho
density_unit = 'mass'
abs_z = True
density(r, theta, z)

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.