Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

IMF sampling

San Diego State University

progenax provides four canonical IMF parameterisations, each appropriate to a different use case. This page samples from all four, plots them, and explains when to use each.

Setup

import jax
import jax.numpy as jnp
import matplotlib.pyplot as plt
from progenax.imf import PowerLawIMF, Maschberger, ChabrierIMF

key = jax.random.PRNGKey(0)
key_salp, key_kroupa, key_chab, key_masch = jax.random.split(key, 4)
N = 100_000   # Large enough for smooth histograms
m_grid = jnp.logspace(-1.5, 2.0, 100)   # 0.03 - 100 M_sun

The four IMFs

Salpeter (single power law)

salpeter = PowerLawIMF(
    exponents=[2.35],
    breakpoints=[],
    m_min=0.1,
    m_max=100.0,
)
masses_salp = salpeter.sample(key_salp, N)

Kroupa (multi-segment broken power law)

kroupa = PowerLawIMF.kroupa()
masses_kroupa = kroupa.sample(key_kroupa, N)

Chabrier (lognormal + power law)

chabrier = ChabrierIMF(m_c=0.22, sigma=0.57, alpha=2.3)
masses_chab = chabrier.sample(key_chab, N)

Maschberger (smooth, default)

maschberger = Maschberger(alpha=2.3, beta=1.4, mu=0.2)
masses_masch = maschberger.sample(key_masch, N)

Plotting

fig, ax = plt.subplots(figsize=(8, 5))
for name, masses in [
    ("Salpeter", masses_salp),
    ("Kroupa", masses_kroupa),
    ("Chabrier", masses_chab),
    ("Maschberger", masses_masch),
]:
    log_masses = jnp.log10(masses)
    ax.hist(log_masses, bins=50, density=True, alpha=0.5, label=name)
ax.set_xlabel("log₁₀(M / M☉)"); ax.set_ylabel("dN/dlogM")
ax.set_yscale("log"); ax.legend()
plt.savefig("imf_comparison.png", dpi=120)

Expected: all four IMFs agree closely above 1M\sim 1\,\Msun (the Salpeter regime) and differ in the low-mass turnover. Salpeter has no turnover; Kroupa breaks at 0.5 M\Msun; Chabrier and Maschberger are smooth.

Choosing the right IMF

Choose

When

Maschberger

Default for new code. Closed-form inverse-CDF, smooth, HMC-friendly. progenax production default

Salpeter

High-mass-only studies; comparison with classical work

Kroupa

Backwards compatibility with prior cluster modelling

Chabrier

Unresolved-population integrated colours

For binary-aware inference, the IMF combines with the Moe & Di Stefano (2017) multiplicity statistics — see Binary-aware IMF recovery.

For environment-dependent IMF (top-heavy in dense / metal-poor populations), see Environment-dependent IMFs.

Next step

Glossary defines every term you’ve seen in the tutorial path. After that, drop into Theory & methods for the full theory section, Architecture & design for design rationale, or API reference for the full API reference.

References
  1. Moe, M., & Di Stefano, R. (2017). Mind your Ps and Qs: The interrelation between period (P) and mass-ratio (Q) distributions of binary stars. The Astrophysical Journal Supplement Series, 230, 15. 10.3847/1538-4365/aa6fb6