IMF#
- class agabpylib.simulation.imf.IMF#
Bases:
ABC
Abstract base class for implementations of initial mass function simulations.
Methods Summary
cdf
(mass, min_mass, max_mass)Evaluate the IMF in its cumulative form for the input set of masses.
gen_masses
(n, min_mass, max_mass, rng)Generate random masses from this IMF.
getinfo
()- returns:
info -- String with information about the IMF.
getmeta
()- returns:
meta -- Metadata about the IMF.
lnpdf
(mass, min_mass, max_mass)Evaluate the IMF (the probability density as a function of mass) for the input set of masses.
Methods Documentation
- abstract cdf(mass, min_mass, max_mass)#
Evaluate the IMF in its cumulative form for the input set of masses.
- Parameters:
mass (float or float array) – The mass value or array of mass values for which to evaluate the cumulative mass distribution function.
min_mass (float) – Minimum mass of interval over which to evaluate the IMF.
max_mass (float) – Maximum mass of interval over which to evaluate the IMF.
- Returns:
cdfval – Value of the cumulative mass distribution function for each of the input masses
- Return type:
float array
- abstract gen_masses(n, min_mass, max_mass, rng)#
Generate random masses from this IMF.
- Parameters:
n (int) – Number of random mass values to generate.
min_mass (float) – Minimum mass of interval over which to evaluate the IMF.
max_mass (float) – Maximum mass of interval over which to evaluate the IMF.
rng (numpy.random.Generator) – Random number generator. This is provided separately to enable user control over the random number sequence.
- Returns:
masses – Array of random mass values.
- Return type:
float array
- abstract getinfo()#
- Returns:
info – String with information about the IMF.
- Return type:
str
- abstract getmeta()#
- Returns:
meta – Metadata about the IMF.
- Return type:
dict
- abstract lnpdf(mass, min_mass, max_mass)#
Evaluate the IMF (the probability density as a function of mass) for the input set of masses.
- Parameters:
mass (float or float array) – The mass value or array of mass values for which to evaluate the IMF.
min_mass (float) – Minimum mass of interval over which to evaluate the IMF.
max_mass (float) – Maximum mass of interval over which to evaluate the IMF.
- Returns:
lnpdf_val – Value of the natural logarithm of the IMF for each of the input masses.
- Return type:
float array