num_particles_from_mtot_given_mass_func

amuse_util.ic.utils.num_particles_from_mtot_given_mass_func(target_mass: unit<MSun>, imf_func: Callable, imf_args: list = [], imf_kwargs: dict = {}, tolerance: float = 0.01, random=0) → Tuple[int, Any, Any][source]

Finds the number of particles in a cluster of mass target_mass.

Parameters
target_mass: amuse units.MSun

target mass of cluster

imf_func: function

the function that generates the IMF signature: imf_func(number_of_particles, *args, **kwargs)

imf_args: list

list of arguments for imf_func should NOT include number_of_particles

imf_kwargs: dict

keyword arguments for imf_func should NOT include random

tolerance: float

fractional error between target_mass and mass(imf(N))

random: number

the random seed for reproducibility

Returns
N: int

number of stars in cluster

M: amuse units.MSun

mass of stars in cluster

err: float

fractional error between M and target_mass