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_state
None
, int, list of ints, orRandomState
If
None
, return theRandomState
singleton used bynumpy.random
. Ifint
, return a newRandomState
instance seeded with theint
. IfRandomState
, return it. Otherwise raiseValueError
.- imf_kwdict, optional
Keyword arguments for the imf function.
- Returns
- ——-
- stars
ndarray
Stellar masses of all the stars.
- stellar_massfloat or