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.

Mass segregation validation

San Diego State University

1. ΛMSR\Lambda_{\mathrm{MSR}} diagnostic — validated against analytic ground truth

progenax.diagnostics.compute_lambda_msr (Allison et al. 2009; ΛMSR=random/massive\Lambda_{\mathrm{MSR}}=\langle\ell_{\mathrm{random}}\rangle/\ell_{\mathrm{massive}}, definition verified against the held ApJ 700 L99 PDF — see Allison et al. (2009)). Tests in tests/validation/test_mass_segregation_physics.py:

The three regimes below are rearrangements of one shared, realistic baseline cluster (a centrally concentrated Plummer sphere): only the massive-star positions change, so the panels are an honest like-for-like comparison, the massive stars are spatially resolved, and the segregated Λ\Lambda sits in the observed range (Allison et al. 2009 measure Λ\Lambda \sim a few for segregated young clusters such as the ONC). The unbounded behaviour of Λ\Lambda — useful as a mathematical limit but not a physical configuration — is checked separately (the delta-core row), so it never sets the headline number.

Check

Construction

Expected

Measured

Unsegregated

random masses on the baseline cluster

Λ1\Lambda \approx 1

1.00±0.111.00 \pm 0.11

Segregated (realistic)

massive stars in a resolved central core (0.2\sim0.2 pc)

Λ\Lambda \sim a few

4.8±0.74.8 \pm 0.7

Inverse

massive stars on the outer half of the same cluster

Λ<1\Lambda < 1

0.80±0.100.80 \pm 0.10

Estimator limit (delta core)

near-point massive core, Lmassive ⁣ ⁣0L_{\mathrm{massive}}\!\to\!0

Λ\Lambda \to \infty (unbounded)

390\sim 390 (scale-set, not physical)

Exact (Nmassive=2N_{\mathrm{massive}}=2)

vs independent scipy.pdist enumeration

exact ratio

3.047 vs 3.046

Estimator convergence

σ(Λ)\sigma(\Lambda) vs NrandomN_{\mathrm{random}}

1/N\propto 1/\sqrt{N}

confirmed

Binary caveat

tight massive pair, Nmassive=2N_{\mathrm{massive}}=2

spurious inflation

103\sim 10^3104×10^4\times

\Lambda_{\mathrm{MSR}} on three states of one shared Plummer cluster (same grey
“all stars” distribution, same axes): (a) unsegregated (\Lambda=1.05) — massive stars
follow the field; (b) segregated (\Lambda=5.70) — the N_{\mathrm{massive}} stars (▲)
sit in a resolved central core, a value in the observed range, not a scale-arbitrary
extreme; (c) inverse (\Lambda=0.73) — massive stars on the cluster outskirts. ▲ marks
the N_{\mathrm{massive}} set used for \ell_{\mathrm{massive}}.

Figure 1:ΛMSR\Lambda_{\mathrm{MSR}} on three states of one shared Plummer cluster (same grey “all stars” distribution, same axes): (a) unsegregated (Λ=1.05\Lambda=1.05) — massive stars follow the field; (b) segregated (Λ=5.70\Lambda=5.70) — the NmassiveN_{\mathrm{massive}} stars (▲) sit in a resolved central core, a value in the observed range, not a scale-arbitrary extreme; (c) inverse (Λ=0.73\Lambda=0.73) — massive stars on the cluster outskirts. ▲ marks the NmassiveN_{\mathrm{massive}} set used for massive\ell_{\mathrm{massive}}.

Left: \Lambda rises monotonically with segregation. Right: convergence to the exact value,
\sigma(\Lambda)\propto 1/\sqrt{N_{\mathrm{random}}}.

Figure 2:Left: Λ\Lambda rises monotonically with segregation. Right: convergence to the exact value, σ(Λ)1/Nrandom\sigma(\Lambda)\propto 1/\sqrt{N_{\mathrm{random}}}.

The documented binary caveat, quantified: a tight massive pair drives
\Lambda \propto 1/\text{separation} (use binary centre-of-mass positions to avoid).

Figure 3:The documented binary caveat, quantified: a tight massive pair drives Λ1/separation\Lambda \propto 1/\text{separation} (use binary centre-of-mass positions to avoid).

2. Primordial (energy-ordered) generator — physics suite + end-to-end check

progenax.cluster.mass_segregation.energy_sorted_segregation is the PRIMORDIAL segregation generator: it assigns the most massive stars to the most bound orbits of an equilibrium pool, in the spirit of Baumgardt et al. (2008) and McLuster (Küpper et al. 2011). One deliberate, documented departure from the published recipe: Baumgardt+2008 draw orbits randomly within cumulative-mass bins; progenax uses a deterministic isotonic rounding of the bin-centre targets, which guarantees a distinct orbit per star for ANY mass spectrum — the random per-bin sampler collapsed below one orbit per bin for steep IMFs, producing coincident stars and V=V = -\infty (the orbit-reuse bug, fixed in this arc and regression-locked below). Realisation variety comes from re-drawing the random pool.

Physics suite tests/validation/test_segregation_equilibrium_physics.py (ported in the 2026-06 redesign from the retired blend’s suite onto the protocol-API composition; see the test dashboard for the live count):

Property

Tolerance (as tested)

Anchor

Full (S=1S=1) ordering is a per-group equilibrium: seed-averaged maxjQj0.5\max_j |Q_j - 0.5| over 4 mass groups, 10 seeds

drift <0.08< 0.08

each mass group is an energy shell of the parent Plummer equilibrium, hence individually virial — the same budget the λ=1\lambda = 1 endpoint carried before the blend’s retirement

Global virial after finalisation

Q0.5<0.02|Q - 0.5| < 0.02

exact rescale by construction

Orbit-reuse regression (steep Kroupa IMF)

VV finite; min pair separation >106> 10^{-6}

pre-fix: coincident stars, V=V = -\infty

Segregation signal

ΛMSRseg>ΛMSRunseg\Lambda_{\mathrm{MSR}}^{\rm seg} > \Lambda_{\mathrm{MSR}}^{\rm unseg}

the independently validated §1 diagnostic

End-to-end via scripts/validate_cluster_ic.py §3 (re-run 2026-06-10, PASS): applying the generator to an unsegregated Kroupa Plummer pool drives the independently validated ΛMSR\Lambda_{\mathrm{MSR}} from 1.404.741.40 \to 4.74 and yields Spearman ρ(m,E)=0.92\rho(m,E) = -0.92 (massive stars in the most-bound orbits). (Earlier versions of this page quoted 1.4014.31.40 \to 14.3, ρ=0.84\rho = -0.84 — numbers from before the orbit-reuse fix changed the deterministic assignment.)

energy_sorted_segregation produces real, \Lambda_{\mathrm{MSR}}-detectable
segregation: \Lambda_{\mathrm{MSR}} = 1.40 \to 4.74, \rho(m,E) = -0.92
(scripts/validate_cluster_ic.py §3, 2026-06-10 run).

Figure 4:energy_sorted_segregation produces real, ΛMSR\Lambda_{\mathrm{MSR}}-detectable segregation: ΛMSR=1.404.74\Lambda_{\mathrm{MSR}} = 1.40 \to 4.74, ρ(m,E)=0.92\rho(m,E) = -0.92 (scripts/validate_cluster_ic.py §3, 2026-06-10 run).

```{admonition} The lambda_seg blend is retired — the equilibrium route is Engine A :class: important The historical partial-segregation knob lambda_seg (a linear phase-space blend between the unsegregated and fully-ordered catalogs) was retired in the 2026-06 unified redesign: its intermediate states drift from per-mass-group virial balance (drift peaking 0.05\sim 0.05 at λ=0.5\lambda = 0.5 in the Phase-0 error-budget study). The differentiable segregation knob is now MultiComponentCluster.from_mass_segregation(delta) — the multi-mass lowered-isothermal family with wj=μjδw_j = \mu_j^{-\delta}, a true shared-potential equilibrium at every δ\delta (theory Qj=0.5Q_j = 0.5 exactly; segregation ratio 1.02.61.0 \to 2.6 over δ[0,0.6]\delta \in [0, 0.6]). Validation: Multi-mass LIMEPY equilibrium (Engine A). energy_sorted_segregation survives as the labeled primordial (non-equilibrium, non-differentiable) generator above.


## 3. Mass-weighted substructure metric (experimental, repo-only)

`gravoturb.diagnostics.mass_density` — Maschberger & Clarke (2011) local surface density
$\Sigma=(k-1)/(\pi r_k^2)$, $k=6$ (Eq. 4, verified vs the held PDF —
[](../99-bibliography/per-paper/maschberger-clarke-2011.md)) + the $m$–$\Sigma$ plane. Robust to
substructure (a *local* density), unlike CW04 $\mathcal{Q}$ on small massive subsets. Validated in
`tests/experimental/unit/test_mass_density.py` (6 tests: exact Eq. 4 formula; uniform-density
recovery; dense $>$ sparse; random masses $\to \rho\approx 0$; **primordial correlation detected**
$\rho(m,\Sigma)>0.5$ when massive stars are placed in dense clumps via
`gravoturb.realization.mass_assignment.correlated_mass_assignment`; reproducible).

## 4. Differentiability status — generator parameter vs. observable

There are **two distinct** "differentiable segregation" questions, and conflating them is
easy:

```{list-table}
:header-rows: 1

* - Quantity
  - Kind
  - Differentiable?
  - Use
* - Equipartition $\delta$ (`MultiComponentCluster.from_mass_segregation`)
  - forward-model **parameter**
  - **Yes** (AD $=$ FD through the table-backed solve, $2.15\times10^{-4}$)
  - dial *equilibrium* segregation strength into a model;
    $\partial(\text{model})/\partial\delta$ — see [](multimass-equilibrium.md)
* - Generator `energy_sorted_segregation` (primordial)
  - forward-model generator
  - No (`argsort`, floor — discrete assignment, by design)
  - labeled primordial route (§2); use $\delta$ for gradients
* - `compute_lambda_msr` (Allison)
  - **observable** (measurement)
  - No (SciPy MST + `argsort`)
  - validated diagnostic / oracle
* - $m$–$\Sigma$ metric, correlated placement
  - **observable**
  - No (kNN / ranking)
  - experimental diagnostic
* - **`segregation_approx`** (§5)
  - **observable** (measurement)
  - **Yes** ($\partial/\partial\mathbf{x}$, $\partial/\partial m_{\mathrm{cut}}$)
  - gradient-based / HMC inference *from* positions+masses

The forward-model parameter route is differentiable: the equipartition δ\delta flows through the coupled multi-mass Poisson solve and the jax.lax.scan sampler (Multi-mass LIMEPY equilibrium (Engine A)). (The retired lambda_seg blend was also differentiable — what it lacked was per-group equilibrium, which is why δ\delta replaced it.) What was missing on the measurement side was a differentiable observable: a function f(positions,masses)Rf(\text{positions},\text{masses})\to\mathbb{R} whose gradient is usable, so segregation can enter a likelihood / HMC without a samplable forward model. That gap is now closed by §5 — mirroring how the differentiable q_approx surrogate closed the same gap for CW04 Q\mathcal{Q} substructure geometry.

5. Differentiable segregation observables (released core)

progenax.diagnostics.segregation_approx provides three differentiable observables that mimic the segregation estimators observers actually report, all sharing one soft mass-cut kernel wi=σ ⁣((mimcut)/τ)w_i=\sigma\!\big((m_i-m_{\mathrm{cut}})/\tau\big) (the observer’s “massive bin”; τ0\tau\to0 recovers the hard indicator 1[mi>mcut]\mathbb{1}[m_i>m_{\mathrm{cut}}]):

All default to 2D-projected positions (observer-faithful), with a 3D flag. Validated in tests/validation/test_segregation_approx_physics.py + tests/unit/diagnostics/ (see the test dashboard for live per-suite counts).

Property

Tolerance (as tested)

Measured

Anchor

soft radial CC \to exact (τ0\tau\to0)

softexact<103|\text{soft}-\text{exact}|<10^{-3}

9.8×10129.8\times10^{-12}

hard mass-cut radial ratio

soft Σ\Sigmamm \to exact (τ0\tau\to0)

<102<10^{-2}

4.1×10114.1\times10^{-11}

SciPy cKDTree kk-NN Σ\Sigma

soft Λ\Lambda \to exact NN-ratio (τ,β0\tau,\beta\to0)

<5×102<5\times10^{-2}

5.6×1035.6\times10^{-3}

hard 1-NN ratio

monotonic response (Spearman vs strength)

ρ>0.8|\rho|>0.8

C:0.99C{:}\,0.99, S:0.98S{:}\,0.98, Λ:0.81\Lambda{:}\,0.81

core-tightness sweep

rank-correlation vs exact ΛMSR\Lambda_{\mathrm{MSR}}

ρ>0.8|\rho|>0.8

0.98 (Allison oracle)

compute_lambda_msr

Fisher information I(θ)\mathcal{I}(\theta)

finite, >0>0

C:649C{:}\,649, S:143S{:}\,143, Λ:132\Lambda{:}\,132

autodiff dμ/dθ\mathrm{d}\mu/\mathrm{d}\theta, Var

(obs)/mcut\partial(\text{obs})/\partial m_{\mathrm{cut}} (AD vs FD)

max <103<10^{-3}

8×1010\le 8\times10^{-10}

central finite-difference

segregation recovery (gradient descent)

Δθ<0.03|\Delta\theta|<0.03

0.1200.1200.120\to0.120

exact recovery

The five figures below are read in order: first that the surrogates are faithful (§5.1), then that they are physically meaningful segregation proxies (§5.2), then which one is best to infer with (§5.3–5.4), and finally that they are usable in gradient-based inference (§5.5). Each figure is followed by its physical interpretation and a correctness verdict.

5.1 Hard-limit convergence — are the surrogates faithful?

The central correctness claim. Absolute error |\text{soft}-\text{exact}| vs the
softness, as \tau (and \beta for \Lambda) \to 0 (axis runs sharp-to-the-right).
Radial C (orange) and \Sigma–m S (green) reach \sim10^{-11}; soft
\Lambda_{\mathrm{MSR}} (blue) reaches 5.6\times10^{-3}.

Figure 5:The central correctness claim. Absolute error softexact|\text{soft}-\text{exact}| vs the softness, as τ\tau (and β\beta for Λ\Lambda) 0\to 0 (axis runs sharp-to-the-right). Radial CC (orange) and Σ\Sigmamm SS (green) reach 1011\sim10^{-11}; soft ΛMSR\Lambda_{\mathrm{MSR}} (blue) reaches 5.6×1035.6\times10^{-3}.

Interpretation. A differentiable surrogate is only trustworthy if it reduces to the estimator it claims to approximate when the smoothing is removed. That is exactly what this figure tests, and the three curves behave differently for a physically meaningful reason:

Verdict: physically correct. The hierarchy (exact \to aggregation-limited \to softmin-limited) is precisely what the construction predicts. In practice one calibrates at a small but finite τ,β\tau,\beta (as calibrate_segregation_approx does), trading a known 1%\lesssim1\% bias for clean gradients.

5.2 Response to segregation — are they meaningful proxies?

Monotonic, literature-consistent response. Each observable (normalised to [0,1],
sign-flipped for C so “up” = more segregated) vs segregation strength 1-\theta
(massive-star core tightness), with the exact Allison+2009 \Lambda_{\mathrm{MSR}} (dashed)
overlaid. Spearman \rho: C\,0.99, S\,0.98, \Lambda\,0.81; all rank-correlate with
the exact \Lambda_{\mathrm{MSR}} at \rho=0.98.

Figure 6:Monotonic, literature-consistent response. Each observable (normalised to [0,1][0,1], sign-flipped for CC so “up” == more segregated) vs segregation strength 1θ1-\theta (massive-star core tightness), with the exact Allison+2009 ΛMSR\Lambda_{\mathrm{MSR}} (dashed) overlaid. Spearman ρ\rho: C0.99C\,0.99, S0.98S\,0.98, Λ0.81\Lambda\,0.81; all rank-correlate with the exact ΛMSR\Lambda_{\mathrm{MSR}} at ρ=0.98\rho=0.98.

Interpretation. As the massive stars are concentrated into a tighter core, each observable responds in the physically correct direction: the massive population sits at smaller radii (CC\downarrow, plotted inverted so it rises), in locally denser regions (SS\uparrow), and with shorter nearest-neighbour spacing (Λ\Lambda\uparrow). All three are therefore genuine monotonic segregation proxies, and — critically — they are rank-consistent with the field-standard Allison+2009 ΛMSR\Lambda_{\mathrm{MSR}} (ρ=0.98\rho=0.98), which is the validated oracle (§1). The radial measure (orange) is the steepest and smoothest; the local NN-based Λ\Lambda (blue) is the noisiest and shallowest — a direct preview of the Fisher ranking in §5.3. (The axis is normalised per-curve, so this panel compares shape and monotonicity, not absolute scale.)

Verdict: physically correct and meaningful. Every curve moves the right way and tracks the published diagnostic; the differences in steepness are real information content, not artefacts.

5.3 Fisher information — which observable should you infer with?

Identifiability ranking. Fisher information
\mathcal{I}(\theta)=(\mathrm{d}\mu/\mathrm{d}\theta)^2/\mathrm{Var} in the segregation
strength, evaluated at \theta=0.3 with \mathrm{d}\mu/\mathrm{d}\theta from autodiff
over 40 cluster realisations. Radial concentration \mathcal{I}=649 vs soft
\Lambda_{\mathrm{MSR}}\,132 and \Sigma–m\,143.

Figure 7:Identifiability ranking. Fisher information I(θ)=(dμ/dθ)2/Var\mathcal{I}(\theta)=(\mathrm{d}\mu/\mathrm{d}\theta)^2/\mathrm{Var} in the segregation strength, evaluated at θ=0.3\theta=0.3 with dμ/dθ\mathrm{d}\mu/\mathrm{d}\theta from autodiff over 40 cluster realisations. Radial concentration I=649\mathcal{I}=649 vs soft ΛMSR132\Lambda_{\mathrm{MSR}}\,132 and Σ\Sigmam143m\,143.

Interpretation. Fisher information is the inverse of the smallest achievable posterior variance: Var(θ^)1/I\mathrm{Var}(\hat\theta)\gtrsim1/\mathcal{I} (Cramér–Rao). A higher bar means a tighter, more confident inference of the segregation strength from that one number. The ranking has a clean physical reading:

This is the concrete, quantitative payoff of differentiability: the gradient dμ/dθ\mathrm{d}\mu/\mathrm{d}\theta is computed exactly by autodiff rather than by noisy finite differencing, so the identifiability comparison is itself trustworthy.

Verdict: meaningful, with stated scope. The ranking is evaluated at a single operating point (θ=0.3\theta=0.3, N=400N=400, bimodal masses); the ordering (global \gg local) is robust and physically expected, but the absolute factors are configuration-dependent and should be re-measured for a specific survey/cluster regime before being quoted as a forecast.

5.4 Projection: 2D vs 3D — how much segregation signal survives?

Projection bias and information loss. (a) Each observable in 3D (solid) vs 2D-projected
(dashed), normalised to its own 3D range. (b) The 2D/3D Fisher ratio — the fraction of
segregation information surviving projection: radial C keeps 0.50, \Sigma–m 0.32,
soft \Lambda 1.19 (dotted line = no loss).

Figure 8:Projection bias and information loss. (a) Each observable in 3D (solid) vs 2D-projected (dashed), normalised to its own 3D range. (b) The 2D/3D Fisher ratio — the fraction of segregation information surviving projection: radial CC keeps 0.50, Σ\Sigmamm 0.32, soft Λ\Lambda 1.19 (dotted line = no loss).

Interpretation. Observers never see 3D positions — they see the cluster projected on the sky. This figure quantifies, per observable, how much segregation information that projection destroys, using the 2D/3D Fisher ratio as “fraction of signal surviving”:

Verdict: physically correct. Global, line-of-sight-sensitive measures lose the most (Σ\Sigmamm >> radial); the dimensionless local ratio loses least. This is the expected ordering, and it directly motivates the research question below.

5.5 Differentiability and end-to-end recovery

Gradients are exact and usable. (a) Autodiff \partial(\text{obs})/\partial
m_{\mathrm{cut}} (lines) vs central finite-difference (points) for all three observables —
agreement to \lesssim10^{-9}. (b) Gradient descent on the radial observable recovers the
true segregation strength \theta=0.12 exactly.

Figure 9:Gradients are exact and usable. (a) Autodiff (obs)/mcut\partial(\text{obs})/\partial m_{\mathrm{cut}} (lines) vs central finite-difference (points) for all three observables — agreement to 109\lesssim10^{-9}. (b) Gradient descent on the radial observable recovers the true segregation strength θ=0.12\theta=0.12 exactly.

Interpretation. Panel (a) is the differentiability certificate: autodiff and finite-difference gradients coincide to machine precision, so the observables can be dropped into a gradient-based optimiser or HMC sampler with confidence. The shapes are themselves informative — C/mcut\partial C/\partial m_{\mathrm{cut}} and Λ/mcut\partial\Lambda/\partial m_{\mathrm{cut}} peak near 34M4\,M_\odot, because that is where the mass cut sweeps through the bimodal mass gap and the “massive bin” membership changes fastest, while S/mcut0\partial S/\partial m_{\mathrm{cut}}\approx0 (flat green) because the Σ\Sigmamm correlation is insensitive to exactly where the cut falls inside the gap. Panel (b) closes the loop: descending on a single differentiable observable recovers the generating segregation strength exactly — the minimal end-to-end demonstration that gradient-based inference of segregation now works (the observable-side complement of the differentiable forward-model knob δ\delta in MultiComponentCluster.from_mass_segregation).

Verdict: correct. Gradients are exact; inference through the observable succeeds.

5.6 Reading the results — recommendations

Question

Answer (from the figures)

Are the surrogates faithful?

Yes — each \to its exact estimator as τ,β0\tau,\beta\to0 (§5.1).

Are they physically meaningful?

Yes — monotonic in segregation and rank-consistent with Allison+2009 ΛMSR\Lambda_{\mathrm{MSR}} (ρ=0.98\rho=0.98, §5.2).

Which to use for HMC inference?

Radial concentration5×\sim5\times more identifiable (§5.3) and the most projection-robust global measure (§5.4).

What does projection cost?

50%\sim50\% of the radial signal, 68%\sim68\% of Σ\Sigmamm; the local Λ\Lambda ratio is essentially unaffected (§5.4).

Are they usable in gradients?

Yes — autodiff matches finite-difference to 109\lesssim10^{-9}; segregation strength is recovered exactly (§5.5).

Run it yourself

# (1) Λ_MSR diagnostic — analytic validation tests (released core)
pytest tests/validation/test_mass_segregation_physics.py -v

# (2) differentiable observables — validation + unit tests, and the 5 figures
pytest tests/validation/test_segregation_approx_physics.py tests/unit/diagnostics/ -v
python scripts/validate_segregation_approx.py     # -> seg_*.png (5 figures, PASS/FAIL)

# (3) primordial generator — physics suite, Λ_MSR diagnostic figures, end-to-end
pytest tests/validation/test_segregation_equilibrium_physics.py -v
python scripts/validate_mass_segregation.py     # -> lambda_msr_*.png
python scripts/validate_cluster_ic.py           # -> cluster_ic_*.png
#   figures land in validation/plots/; the curated copies embedded here live in
#   docs/website/50-validation/figures/

# (4) the EQUILIBRIUM mass-segregation route (Engine A, differentiable delta)
#     -> see multimass-equilibrium.md
python scripts/validate_multimass_equilibrium.py

# (5) experimental mass-weighted Σ metric + density-correlated placement
PYTHONPATH=src:src/experimental pytest tests/experimental/unit/test_mass_density.py tests/experimental/unit/test_masses.py -v

References

Theory at Mass segregation. Diagnostic Allison et al. (2009); energy-ordered generator Baumgardt et al. (2008); mass-weighted local-Σ\Sigma Maschberger & Clarke (2011). The differentiable-observables design is recorded in the repository’s planning notes.

References
  1. Baumgardt, H., De Marchi, G., & Kroupa, P. (2008). Evidence for primordial mass segregation in globular clusters. The Astrophysical Journal, 685, 247–253. 10.1086/590488
  2. Allison, R. J., Goodwin, S. P., Parker, R. J., Portegies Zwart, S. F., de Grijs, R., & Kouwenhoven, M. B. N. (2009). Using the minimum spanning tree to trace mass segregation. Monthly Notices of the Royal Astronomical Society, 395, 1449–1454. 10.1111/j.1365-2966.2009.14508.x
  3. Maschberger, T., & Clarke, C. J. (2011). Global mass segregation in hydrodynamical simulations of star formation. Monthly Notices of the Royal Astronomical Society, 416, 541–546. 10.1111/j.1365-2966.2011.19067.x