Repository navigation
Change to Anderson-Darling for testing. - #11
Conversation
…s. Fix that and update the docs. Double check the masking for the signal subtraction.
…n of asinh binning.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11 +/- ##
==========================================
+ Coverage 78.87% 78.90% +0.02%
==========================================
Files 6 6
Lines 923 948 +25
==========================================
+ Hits 728 748 +20
- Misses 195 200 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
There was a problem hiding this comment.
🔵 Needs a closer look
The scientific fitting objective and numerical interpolation changes warrant final domain-expert validation.
0 open findings
What changed in this PR
Replaces CDF chi-square fitting with an Anderson–Darling objective while incorporating RA-averaged signal-subtraction improvements from #10.
Changes:
- Adds the Anderson–Darling objective and analytical gradient.
- Improves RA-averaged PDF grids, validation, and interpolation.
- Expands numerical tests and updates signal-subtraction documentation.
| File | Description |
|---|---|
kingmaker/fitting.py |
Implements Anderson–Darling fitting. |
kingmaker/pdf.py |
Improves marginalized PDF grids and validation. |
kingmaker/utils.py |
Computes RA averages using adaptive grids. |
kingmaker/wrapper.py |
Clarifies RA-averaged output semantics. |
tests/test_fitting.py |
Tests the objective and gradient. |
tests/test_king_pdf.py |
Tests normalization, accuracy, and clamping. |
README.md |
Updates signal-subtraction terminology. |
docs/signal_subtraction.rst |
Documents RA averaging and grid behavior. |
docs/examples.rst |
Updates examples and terminology. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Using a chi2 fit to the CDF has always been a little gross and ugly. The chi2 isn't a great measure and it can lead to some parts of the distribution being overly important in the fit. A better choice would be to use something actually designed to run on CDFs instead. Here, I swap out the chi2 for an Anderson-Darling test, which seems to significantly improve the fits for the previously-worst bins. Most bins aren't affected here since they were fitting well anyway. Bias tests aren't showing much impact either, probably because most bins aren't changing.
Here's the worst bins from DNNCascades-ICEMAN along with their best-fits under chi2 (red) and AD (blue).
And the same for NorthernTracks v5.4

Note: this is branched off of mlarson/sigsub in #10 , so I have to merge that one first.