synthpop.modules.initial_mass_function ====================================== .. py:module:: synthpop.modules.initial_mass_function Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/synthpop/modules/initial_mass_function/_initial_mass_function/index /autoapi/synthpop/modules/initial_mass_function/chabrier/index /autoapi/synthpop/modules/initial_mass_function/kroupa/index /autoapi/synthpop/modules/initial_mass_function/piecewise_powerlaw/index Classes ------- .. autoapisummary:: synthpop.modules.initial_mass_function.InitialMassFunction Package Contents ---------------- .. py:class:: InitialMassFunction(min_mass=None, max_mass=None, logger: types.ModuleType = None) Bases: :py:obj:`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 .. py:attribute:: F_imf :type: Callable :value: None .. py:attribute:: F_imf_inverse :type: Callable :value: None .. py:attribute:: grid_min :type: float .. py:attribute:: grid_max :type: float .. py:attribute:: mass_grid :type: numpy.ndarray :value: None .. py:attribute:: prob_dens :type: numpy.ndarray :value: None .. py:attribute:: logger :value: None .. py:attribute:: min_mass :value: None .. py:attribute:: max_mass :value: None .. py:method:: imf(m: Union[numpy.ndarray, float]) -> Union[numpy.ndarray, float] :abstractmethod: .. py:method:: 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 .. py:method:: average_mass(min_mass: Union[numpy.ndarray, float, None] = None, max_mass: Union[float, None] = None) -> float Returns the average mass for the IMF .. py:method:: draw_random_mass(min_mass: Union[numpy.ndarray, float, None] = None, max_mass: Union[float, None] = None, N: Union[float, None] = None) -> Union[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