imf
eventlab.imf
Helpful functions to renormalize samples constructed with different IMFs.
build_broken_pwr_law_imf(alphas, mcuts)
Build a normalized, continuous, piecewise power-law IMF.
Each "piece" i is a power law m**alphas[i] valid between
mcuts[i] and mcuts[i+1]. The pieces are scaled relative to
each other so the resulting function is continuous at every
breakpoint, and the whole function is divided by its total integral
so that it is a properly normalized probability density function
(i.e. it integrates to 1 over [mcuts[0], mcuts[-1]]).
This follows the same construction used in COSMIC's
Sample.sample_primary for kroupa93, kroupa01, and
salpeter55.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alphas
|
array - like
|
Power law exponents for each piece, e.g. |
required |
mcuts
|
array-like, units of Msun
|
Mass breakpoints separating each piece, e.g. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
imf |
callable
|
A function |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> imf = build_broken_pwr_law_imf([-1.3, -2.3], [0.08, 0.5, 150.0])
>>> imf(1.0)
Source code in src/eventlab/imf.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
get_mean_mass(imf_fn, mlow, mhigh)
Compute the mean stellar mass for an IMF over a mass range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
imf_fn
|
callable
|
Initial mass function, |
required |
mlow
|
float
|
Lower mass bound of the integration. |
required |
mhigh
|
float
|
Upper mass bound of the integration. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
mean_mass_result |
float
|
Mean stellar mass, computed as the integral of
m |
Source code in src/eventlab/imf.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
kroupa_01(m)
Kroupa (2001) initial mass function, normalized between 0.08 and 150 Msun.
See Kroupa (2001) <https://arxiv.org/abs/astro-ph/0009005>_. Matches
the kroupa01 option in COSMIC's Sample.sample_primary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m
|
float or array - like
|
Stellar mass (or masses), in Msun. |
required |
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Normalized probability density at mass |
Source code in src/eventlab/imf.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
salpeter_55(m)
Salpeter (1955) initial mass function, normalized between 0.08 and 150 Msun.
See Salpeter (1955) <http://adsabs.harvard.edu/abs/1955ApJ...121..161S>_.
Matches the salpeter55 option in COSMIC's Sample.sample_primary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m
|
float or array - like
|
Stellar mass (or masses), in Msun. |
required |
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Normalized probability density at mass |
Source code in src/eventlab/imf.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |