synthpop.modules.initial_mass_function._initial_mass_function

This file contains the base class for the initial mass function.

Classes

InitialMassFunction

The initial mass function (IMF) class for Population class.

Module Contents

class synthpop.modules.initial_mass_function._initial_mass_function.InitialMassFunction(min_mass=None, max_mass=None, logger: types.ModuleType = None)

Bases: abc.ABC

The initial mass function (IMF) class for Population class. A keyword name is given upon initialization to select the form of the initial mass function. Also, can be initialized with preselected minimum and maximum masses

Methods:

imf(mass) - returns fraction of stars at the initial mass? random_mass() - returns a random mass drawn from the selected imf average_mass(min_mass, max_mass) - calculate the average mass from

the selected imf with options for restricting range

positional_kwargs

F_imf: Callable = None
F_imf_inverse: Callable = None
grid_min: float
grid_max: float
mass_grid: numpy.ndarray = None
prob_dens: numpy.ndarray = None
logger = None
min_mass = None
max_mass = None
abstract imf(m: numpy.ndarray | float) numpy.ndarray | float
interpolate_F(min_mass: float, max_mass: float) None

integrate and interpolator the imf This allows that any function can be given as IMF F_imf and F_inf_inverse can be given by the child class, this can speed up the process

average_mass(min_mass: numpy.ndarray | float | None = None, max_mass: float | None = None) float

Returns the average mass for the IMF

draw_random_mass(min_mass: numpy.ndarray | float | None = None, max_mass: float | None = None, N: float | None = None) numpy.ndarray | float

Draw N random masses between minimum mass min_mass and maximum mass max_mass if N is None returns the mass as a float Evaluate the density profile along a grid of step 1e-4 use the trapezoids along the grid as integral use a cubic interpolation to get the inverse function