Skip to content

Adopt Form K_reg photon fit; remove polyethylene xfails#22

Merged
shimwell merged 1 commit into
mainfrom
photon-fit-k-reg
May 1, 2026
Merged

Adopt Form K_reg photon fit; remove polyethylene xfails#22
shimwell merged 1 commit into
mainfrom
photon-fit-k-reg

Conversation

@shimwell
Copy link
Copy Markdown
Member

@shimwell shimwell commented May 1, 2026

Summary

Pulls in rad_point_kernel_core PR #16 (Form K_reg photon fit). Bumps the core dep >=4.1.0 -> >=4.2.0.

The previously-xfailed assertions in tests/test_polyethylene_buildup_fit.py (Property 1 for dose-AP-coupled-photon and dose-AP-total) now pass cleanly — K_reg captures the late-stage exponential growth that Power × saturator could not. xfail markers removed.

Changes

File What changed
pyproject.toml core dep >=4.1.0>=4.2.0
tests/test_polyethylene_buildup_fit.py xfail markers removed; extrapolation upper bound loosened 30 → 1000 (see below)
verification_and_validation/photon_fit_test_suite.py new — 21-material cross-validation harness used to design K_reg
verification_and_validation/photon_fit_cache.json new — MC anchor library (6 train + 1 holdout per material)
docs/vnv/photon_fit_quality.md new — V&V documentation for the harness
docs/vnv/index.md adds entry for the new harness
.gitignore excludes /outputs/ (transient)

Extrapolation bound update

test_extrapolation_is_bounded previously asserted 0.1 < B_total < 30 at t=300/350/400 cm of polyethylene. With the broken Power × saturator, predicted B_total at 400 cm was ~0.9 (saturated). With K_reg correctly tracking the late-stage growth in the data, B_total at 400 cm reaches ~56 — physically right, since an independent MC run at 350 cm gives B_p ≈ 82. The new bound 0 < B < 1000 still catches numerical blow-up but accommodates the real growth.

V&V harness

photon_fit_test_suite.py is the regression-testing tool used to design K_reg. It loads 21 materials' worth of MC anchors, fits every candidate form in CANDIDATES, and reports per-material training + holdout z-scores. Future fit-form changes can be gated through it.

The 21 materials span:

  • Hydrogenous moderators: polyethylene, polyethylene_deep, borated_poly, lih, d2o, h2o_water
  • Mixed light/heavy composites: WC + 20/50/70 vol% water, WB + 20/50/70 vol% water (peak-and-decay shapes)
  • Saturating heavy attenuators: concrete, steel, ss316, tungsten, lead, magnetite, b4c, aluminum, concrete_steel10

Test plan

  • All 145 wrapper tests pass against new core (0 failed, 0 xfailed, 0 skipped)
  • V&V harness runs end-to-end and writes the dataset CSV + plot
  • CI green (will fail until core 4.2.0 publishes to PyPI; rerun then)

Will be red until core 4.2.0 lands on PyPI; standard sequence.

Pulls in the K_reg photon-fit form from rad_point_kernel_core 4.2.0:

  worst holdout z (21 materials): 54.3 -> 36.6
  mean  holdout z:                14.7 ->  6.0
  median holdout z:                7.1 ->  2.4

The 3 previously-xfailed assertions in test_polyethylene_buildup_fit.py
(Property 1 for dose-AP-coupled-photon and dose-AP-total) now pass on
the original 6-anchor polyethylene fixture: K_reg captures the late-
stage exponential growth that Power x saturator could not. xfail
markers removed.

The test_extrapolation_is_bounded upper bound is loosened from 30 to
1000. The previous bound was calibrated against the broken Power x
saturator's conservative extrapolation; with K_reg correctly tracking
late growth, B_total can legitimately reach 3 digits at 4 m of poly
(an independent MC scan at 350 cm gives B_p ~= 82). The new bound
still catches genuine numerical blow-up.

Adds the cross-material regression harness used to design and tune
K_reg as a V&V artifact:

  verification_and_validation/photon_fit_test_suite.py
  verification_and_validation/photon_fit_cache.json
  docs/vnv/photon_fit_quality.md

The harness loads 21-material MC anchors, fits all candidate forms,
and reports per-material training and holdout z-scores. Re-runnable
to gate any future fit-form change.

Bumps rad_point_kernel_core dep to >=4.2.0.
@shimwell shimwell force-pushed the photon-fit-k-reg branch from 4f114ca to 972a185 Compare May 1, 2026 17:35
@shimwell shimwell merged commit e456c78 into main May 1, 2026
13 of 23 checks passed
@shimwell shimwell deleted the photon-fit-k-reg branch May 1, 2026 19:48
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