Skip to content

SED: CCM89/O'Donnell joined to a fitted near-IR power law, sed.nir_alpha (dust stack PR 5, 8.9.2) - #610

Merged
jdeast merged 1 commit into
masterfrom
feat/nir-power-law
Nov 18, 2026
Merged

jdeast merged 1 commit into
masterfrom
feat/nir-power-law

Conversation

@jdeast

@jdeast jdeast commented Nov 18, 2026

Copy link
Copy Markdown
Owner

What

Dust stack PR 5 (review 8.9.2, ruled by JDE 2026-11-09). Under sed: {fit_rv_dust: true} the SED's extinction law becomes:

x >= 1.1 / micron   A_lam/A_V = a(x) + b(x)/R_V                      CCM89 + O'Donnell 94 (unchanged)
x <  1.1 / micron   A_lam/A_V = [a(1.1) + b(1.1)/R_V] (x/1.1)**alpha  near-IR power law

Here x = 1/lambda, the join is at 0.909 micron (CCM's own segment boundary), and alpha is a new sampled sight-line parameter, sed.nir_alpha ~ N(1.85, 0.25) on [1.2, 3.0]. Every star, the red clump and both layers of #604's near/far R_V split share that one alpha. Each layer keeps its own R_V. The law is still linear in 1/R_V at fixed alpha, so the near/far mix stays exact.

Why: toward the bulge one CCM R_V cannot match the red clump's optical and near-IR ratios at once. Nataf et al. (2016) show that the bulge curve needs at least two degrees of freedom. Every bulge near-IR slope that has been measured is also steeper than CCM's 1.61 (Nishiyama et al. 2009, about 2.0). With this change, R_V carries A_I/E(V-I) and alpha carries E(I-J)/E(V-I) and A_V/A_Ks.

The table mode (the default) is untouched. Its BCs are tabulated at the shipped law, which has no alpha.

Details

  • Continuity at the join. The power law starts from the optical polynomial's value at x = 1.1, so the law is continuous there in value. Its slope is not continuous, as at any segment boundary. CCM89 itself is NOT continuous at x = 1.1: its IR segment and its optical polynomial disagree there by 0.05% of A_lam/A_V at R_V 3.1 and 0.34% at R_V 1.5. As a result, alpha = 1.61 reproduces the old law exactly blueward of the join, and redward it gives the old law times that one constant. The ruling asked for both continuity and an exact identity at 1.61. Both cannot hold at once, so this PR keeps continuity. tests/test_nir_power_law.py pins both statements.
  • Gradient safety. Per bin, k = (a + b/R_V) * exp(alpha * L). Blueward of the join, L = 0 and (a, b) are CCM's values. Redward, L = ln(x/1.1) and (a, b) are the values at the join. There is no mask, no branch and no pt.where. Values and gradients (in R_V, alpha and A_V) are finite and agree between the C and JAX backends at alpha 1.2/1.61/1.85/3.0 and R_V 1.5/6.0, with the I passband straddling the join.
  • Seam for Nataf's Roman-band bulge curve. It has been announced for late 2026. SpectralBC consumes only the per-bin (a, b, L) that extinction.ccm89_nir_basis returns, so a published table can enter as another basis builder with its own law name. The swap point is marked in extinction.py and described in sed.md. This PR adds no stub code.
  • Plumbing. SED.bc_node / bc_np / appmag_np take alpha and raise without it under fit_rv_dust. nir_alpha_node(system) builds the parameter lazily, the way the R_V nodes are built. The red clump's context nodes, its start seed and checks, the dust_anchor_band inversion, the dilution start solver and the SED figure all read the same alpha.
  • errscale count. nir_alpha counts once toward the errscale pin, as sed.rv_dust does, unless it is pinned with sigma: 0.
  • Mid-IR warning. A WARNING names any fitted filter whose mean wavelength is past 3 micron (WISE, IRAC). There the power law is extrapolated, and measured laws are grayer.
  • Near-layer prior. The rv_dust_near prior (Schlafly et al. 2016's R' mapped through our spectral path) was remapped under the new law at alpha 1.85: N(2.88, 0.19) -> N(2.84, 0.18).
  • Prose and bib. The draft prose names the law. The bib gains Nataf:2016.

What the law gives

Measured on the real R = 3000 runtime grid, with the red-clump reference spectrum (4700 K, logg 2.5, [Fe/H] 0), band-integrated, at A_V = 3. "av" is the model's A_V parameter (the extinction at 0.5495 micron).

R_V alpha A_I/E(V-I) E(I-J)/E(V-I) E(J-Ks)/E(V-I) A_V(band)/A_Ks av/A_Ks av/E(J-Ks) A_I/av
1.946 1.61 1.197 0.712 0.287 11.04 11.31 7.86 0.532
1.946 1.85 1.197 0.746 0.289 13.57 13.91 7.79 0.532
3.1 1.61 1.739 0.941 0.471 8.37 8.50 5.91 0.625
Nataf+2016 means 1.197 0.746 0.297 13.44 (median) 7.41

R_V = 1.946 is where A_I/E(V-I) meets Nataf+2016's mean. At alpha 1.85 the other three ratios match to +0.0%, -2.5% and +1.0%. In VISTA Ks, av/A_Ks = 13.76. The ratio av/A_Ks is flat in A_V: 13.90, 13.91 and 13.92 at A_V = 1, 3 and 8. Band-integrated A_I/A_V(band) is 0.545.

Consistency with #609 (exozippy-mkdust)

They are not consistent. #609 converts map values to A_V by hand with Nataf+2013's bulge means: A_V = 15.30 A_Ks and A_V = 6.458 E(J-Ks).

At the prior center, this law gives:

alpha does not close the E(J-Ks) gap: J and Ks both lie in the power law, so E(J-Ks)/E(V-I) barely moves with alpha. That gap is the known 15% disagreement between Nataf+2013 and Nataf+2016 in E(J-Ks)/E(V-I). This law follows 2016, and no law joined at 0.909 micron reaches 2013's 0.343.

#609 itself says its Ks lines "become the better choice once the near-infrared slope is fitted". Now that the slope is fitted, the consistent route is to write the map value in its own band with sed: {dust_anchor_band: 2MASS/2MASS.Ks} (or VISTA Ks), so the fit's law, alpha included, does the conversion. A new test checks that this inversion follows alpha. This PR does not change #609 and is based on master, not on #609.

Shipped examples

No shipped example sets fit_rv_dust, so none should move. I built all 27 shipped configs that carry an SED on origin/master and on this branch, and compared the start logp and every per-term logp at initial_point(). The 27 configs are every non-DC2018 SED config plus the four DC2018/configs ones; the DC2018 sweep and ablation trees were skipped as harness directories.

All 27 are bit-identical: Delta logp = 0 and max |Delta term| = 0, with the same free variables. The configs are KMT-2019-BLG-1806 (x3), KMT-2021-BLG-1122L, MOA-2008-BLG-379, gj1214, hat3 (x5), hd80606 (x3), kelt17 (x3), kelt4 (x2), ob140939_today, toi3919 (x2), wasp18 and DC2018_128 (x4). No acceptance fixture changes.

Tests

  • New tests/test_nir_power_law.py covers:
    • alpha 1.61 against CCM;
    • continuity at the join;
    • alpha moves only the near-IR;
    • exact two-layer mixing;
    • finite values and gradients in C and JAX at the join and the bounds;
    • alpha must be a scalar and is required;
    • the parameter separation on a clump-like spectrum;
    • the system declaring and sampling sed.nir_alpha with its prior;
    • the errscale count;
    • a Ks anchor converting through the fitted alpha (marked slow).
  • test_sed_fit_rv_dust.py: the inventory count is now 1 + 4 + 1 + 1, and the graph test passes alpha.
  • test_redclump_recovery.py: the truth is generated at alpha 1.85.
  • test_sed_fit_rv_dust.py, test_redclump.py, test_dust_profile.py and test_inspect_start.py pass locally (-n0, not slow).

🤖 Generated with Claude Code

https://claude.ai/code/session_01AWjnwpYHm56hSpKBzbPhrG

…pha (8.9.2)

Under fit_rv_dust the SED's extinction law is now CCM89 + O'Donnell (1994)
blueward of 0.909 micron (x = 1.1/micron, CCM's own segment boundary),
unchanged, and A_lam ~ lambda**-alpha redward, continuous at the join. alpha
is one sampled sight-line parameter, sed.nir_alpha ~ N(1.85, 0.25) on
[1.2, 3.0] (JDE ruling 2026-11-09), shared by every star, the red clump and
both layers of the dust profile's near/far R_V split.

- extinction.py: ccm89_nir_basis gives per-wavelength (a, b, L) so that
  k = (a + b/R_V) exp(alpha L); no mask, no branch, no pt.where. Still
  linear in 1/R_V at fixed alpha, so the near/far mix stays exact. The power
  law starts from the optical polynomial's value at x = 1.1 (continuity);
  CCM89 itself jumps there by 0.05% (R_V 3.1) to 0.34% (R_V 1.5), so
  alpha = 1.61 is CCM exactly blueward and times that constant redward.
  A marked seam for Nataf's announced Roman-band bulge curve.
- spectral_bc.py: law "ccm89" -> "ccm89_nir", bc_node/bc_np take alpha.
- sed.py: declares nir_alpha with rv_dust; bc_node/bc_np/appmag_np take
  alpha; nir_alpha_node / nir_alpha_start; the errscale count adds it once
  unless pinned; the figure reddens with it; a WARNING names filters past
  3 micron, where the power law is extrapolated; prose updated.
- red clump and the dust anchor (dust_anchor_band) read the same alpha.
- rv_dust_near prior remapped through the new law at alpha 1.85:
  N(2.88, 0.19) -> N(2.84, 0.18).
- Nataf:2016 bib entry. Docs: sed.md "The near-infrared slope",
  redclump.md, CLAUDE.md map line.

Measured on the real R = 3000 grid (clump spectrum, A_V = 3): at R_V 1.946
(Nataf+2016's A_I/E(V-I)) and alpha 1.85, av/A_Ks = 13.9 (2MASS), 13.8
(VISTA), A_I/av = 0.532; the four Nataf+2016 bulge ratios to 2.5%.

Table mode is untouched; no shipped example sets fit_rv_dust.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AWjnwpYHm56hSpKBzbPhrG
@jdeast
jdeast merged commit 4a74de9 into master Nov 18, 2026
36 of 38 checks passed
@jdeast
jdeast deleted the feat/nir-power-law branch November 18, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant