IMFIntegrator¶
- class artpop.stars.IMFIntegrator(params, m_min=0.1, m_max=120.0)[source]¶
Bases:
object
A helper class for numerically integrating the IMF.
- Parameters
- paramsstr or dict
Which IMF to use, if str then must be one of pre-defined: ‘kroupa’, ‘scalo’ or ‘salpeter’. Can also specify broken power law as dict, which must contain either ‘a’ as a Float (describing the slope of a single power law) or ‘a’ (a list with 3 elements describing the slopes of a broken power law) and ‘b’ (a list with 2 elements describing the locations of the breaks).
- m_minfloat, optional
Minimum stellar mass.
- m_maxfloat, optional
Maximum stellar mass.
Methods Summary
func
(m)Wrapper function to calculate the un-normalized values of of the IMF (i.e.
integrate
([m_min, m_max, norm])"
m_func
(m)Wrapper function to calculate the un-normalized values of the mass times the IMF (i.e.
m_integrate
([m_min, m_max, norm])"
weights
(mass_grid[, norm_type, ...])Calculate the weights of the IMF at grid of stellar masses.
Methods Documentation
- func(m)[source]¶
Wrapper function to calculate the un-normalized values of of the IMF (i.e. dN / dM ) at grid of stellar masses.
- integrate(m_min=None, m_max=None, norm=False)[source]¶
” Function to calculate the integral under the IMF.
- Parameters
- m_minFloat
Lower stellar mass bound of integral.
- m_maxFloat
Upper stellar mass bound of integral.
- norm:Bool or Float
Whether or not to normalize the inegral, default False. If True will normalize by number of stars. If a Float is given, then will use that value as the normalization.
- Returns
- weightsFloat
Value of the integral of the IMF between m_min and m_mass.
- m_func(m)[source]¶
Wrapper function to calculate the un-normalized values of the mass times the IMF (i.e. dN / d logM ) at grid of stellar masses.
- m_integrate(m_min=None, m_max=None, norm=False)[source]¶
” Function to calculate the integral under mass times the IMF.
- Parameters
- m_minFloat
Lower stellar mass bound of integral.
- m_maxFloat
Upper stellar mass bound of integral.
- norm:Bool or Float
Whether or not to normalize the integral, default False. If True will normalize by the total stellar mass. If a Float is given, then will use that value as the normalization.
- Returns
- weightsFloat
Value of the integral of mass times the IMF between m_min and m_mass.
- weights(mass_grid, norm_type=None, norm_mass_min=None, norm_mass_max=None)[source]¶
Calculate the weights of the IMF at grid of stellar masses.
- Parameters
- mass_grid
ndarray
Stellar mass grid.
- norm_typestr, optional
How to normalize the weights: by ‘number’, ‘mass’, or the ‘sum’.
- norm_mass_minint or None, optional
Minimum mass to use for normalization. If None, use minimum of
mass_grid
will be used.- norm_mass_maxint or None, optional
Maximum mass to use for normalization. If None, use maximum of
mass_grid
will be used.
- mass_grid
- Returns
- weights
ndarray
The weights associated with each mass in the input
mass_grid
.
- weights