scopesim_templates.stellar.imf.IMF

scopesim_templates.stellar.imf.IMF#

class scopesim_templates.stellar.imf.IMF(mass_limits=None, multiplicity=None)#

Bases: object

IMF base class.

The mass sampling and multiplicity implementation is here.

Notes

Code author: J. Lu.

Original code was taken from libimf package written by Jan Pflamm-Altenburg (`Pflamm-Altenburg & Kroupa 2006

and has been modified only marginally, though more convinient and general purpose functions have been added. The libimf code was licensed under a GNU General Public License.

Parameters:
  • mass_limits (2 element array; optional) – Define the minimum and maximum stellar masses in the IMF, in solar masses. First element is taken as the min, second element the max (e.g. mass_limits = [min_mass, max_mass]).

  • multiplicity (SPISEA Multiplicity object or None) – If None, no multiplicity is assumed. Otherwise, use multiplicity object to create multiple star systems.

__init__(mass_limits=None, multiplicity=None)#

Methods

__init__([mass_limits, multiplicity])

calc_multi(newMasses, compMasses, ...)

Calculate multiples more efficiently.

generate_cluster(totalMass[, seed])

Generate a cluster of stellar systems with the specified IMF.

calc_multi(newMasses, compMasses, newSystemMasses, newIsMultiple, CSF, MF)#

Calculate multiples more efficiently.

Helper function; We will use array operations as much as possible.

generate_cluster(totalMass, seed=None)#

Generate a cluster of stellar systems with the specified IMF.

Randomly sample from an IMF with specified mass limits until the desired total mass is reached. The maximum stellar mass is not allowed to exceed the total cluster mass. The simulated total mass will not be exactly equivalent to the desired total mass; but we will take one star above or below (whichever brings us closer to the desired total) the desired total cluster mass break point.

Primary stars are sampled from the IMF, companions are generated based on the multiplicity properties provided.

Parameters:
  • totalMass (float) – The total mass of the cluster (including companions) in solar masses.

  • seed (int) – If set to non-None, all random sampling will be seeded with the specified seed, forcing identical output. Default None

Returns:

  • masses (numpy float array) – List of primary star masses.

  • isMultiple (numpy boolean array) – List of booleans with True for each primary star that is in a multiple system and False for each single star.

  • companionMasses (numpy float array) – List of