build_galaxy

artpop.stars.build_galaxy(stellar_mass, num_stars_iter=100000.0, m_min=0.08, m_max=120, imf='kroupa', num_mass_bins=100000, random_state=None, imf_kw={})[source]

Build galaxy of a given stellar mass.

Parameters
stellar_massfloat or Quantity

Stellar mass of galaxy. If float is given, the units are assumed to be solar masses.

num_stars_iterint

Number of stars to generate at each iteration. Lower this number (at the expense of speed) to get a more accurate total mass.)

num_starsint

Number of stars to sample.

m_minfloat, optional

Minimum stellar mass.

m_maxfloat, optional

Maximum stellar mass.

imfstr 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).

num_mass_binsint, optional

Number of mass bins in logarithmic spaced mass grid.

random_stateNone, int, list of ints, or RandomState

If None, return the RandomState singleton used by numpy.random. If int, return a new RandomState instance seeded with the int. If RandomState, return it. Otherwise raise ValueError.

imf_kwdict, optional

Keyword arguments for the imf function.

Returns
——-
starsndarray

Stellar masses of all the stars.