Skip to content

Fixes for signal subtraction - #10

Merged
mjlarson merged 6 commits into
mainfrom
mlarson/sigsub
Oct 9, 2026
Merged

mjlarson merged 6 commits into
mainfrom
mlarson/sigsub

Conversation

@mjlarson

@mjlarson mjlarson commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Apparently my understanding of csky's signal subtraction was wrong. I thought it needed the RA-integrated PDF renormalized in sin(dec). Apparently it wants the RA-averaged PDF? So update the code to do that and fix all of the many, many references...

Edit: Ah, right. It's a unit thing. The integrated version has different units than the standard PDFs, so we have to use the average here to get back to 1/sr.

…s. Fix that and update the docs. Double check the masking for the signal subtraction.
Copilot AI balanced review requested due to automatic review settings October 6, 2026 05:11
@codecov-commenter

codecov-commenter commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.31034% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.85%. Comparing base (981e816) to head (61d9559).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
kingmaker/utils.py 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #10      +/-   ##
==========================================
- Coverage   78.87%   78.85%   -0.02%     
==========================================
  Files           6        6              
  Lines         923      946      +23     
==========================================
+ Hits          728      746      +18     
- Misses        195      200       +5     
Flag Coverage Δ
test_basic 14.69% <13.79%> (+0.06%) ⬆️
test_fitting 37.63% <13.79%> (-0.51%) ⬇️
test_king_pdf 29.17% <79.31%> (+1.22%) ⬆️
test_template_smeared_king_pdf 25.89% <13.79%> (-0.22%) ⬇️
test_utils 16.27% <13.79%> (+0.02%) ⬆️
test_wrapper 38.90% <58.62%> (+0.43%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Public README, examples, and notebook references still describe the obsolete RA-integrated quantity.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Corrects signal-subtraction PDFs to use RA-averaged, per-steradian densities.

Changes:

  • Applies the correct RA-average normalization and optimized integration bounds.
  • Expands interpolation bounds and clamps out-of-grid parameters.
  • Adds normalization, accuracy, and clamping tests.
File Description
kingmaker/​utils.py Computes RA-averaged grids.
kingmaker/​pdf.py Updates interpolation, defaults, and terminology.
kingmaker/​wrapper.py Corrects API documentation.
tests/​test_king_pdf.py Tests averaging and clamping.
docs/​signal_subtraction.rst Documents the corrected normalization.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/signal_subtraction.rst
Copilot AI balanced review requested due to automatic review settings October 6, 2026 05:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Near-pole quadrature can be substantially inaccurate, and valid fitted alpha values are clamped incorrectly.

Review effort: Balanced
Findings: 2 High severity · 1 Low severity

Open (3)

Comment thread kingmaker/pdf.py
Comment on lines +494 to +501
if np.any((params < lower) | (params > upper)):
warnings.warn(
"alpha or beta outside the marginalization grid; clamping to grid edges. "
"Widen points_alpha or points_beta to avoid this.",
RuntimeWarning,
stacklevel=3,
)
np.clip(params, lower, upper, out=params)
Comment thread kingmaker/utils.py Outdated
Copilot AI balanced review requested due to automatic review settings October 8, 2026 13:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Clamping currently accepts mathematically invalid King parameters instead of rejecting them.

3 open findings
1 resolved since last review

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread kingmaker/pdf.py
Copilot AI balanced review requested due to automatic review settings October 8, 2026 15:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation, numerical tests, units, and documentation consistently reflect the corrected RA-averaged formulation.

2 open findings
1 resolved since last review

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@mjlarson
mjlarson merged commit 4438756 into main Oct 9, 2026
11 checks passed
@mjlarson
mjlarson deleted the mlarson/sigsub branch October 9, 2026 16:10
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.

3 participants