Conversation
hpparvi
requested review from
cshanahan1,
kbwestfall,
kecnry and
tepickering
September 7, 2026 14:35
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #322 +/- ##
==========================================
+ Coverage 92.52% 92.61% +0.08%
==========================================
Files 18 18
Lines 2341 2396 +55
==========================================
+ Hits 2166 2219 +53
- Misses 175 177 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
looks like CI is only passing under python 3.14. |
Contributor
Author
|
Ohps, true... I'll take a look into this tomorrow morning. |
Contributor
|
also, see my other comments about 3.11 still in CI when 3.12 is now the minimum. should fix that in a separate PR and then rebase these once that's merged. |
…ask arrays were not aligned along with the trace correctly.
…ed from the model. - Changed the Horne extraction kernel to be the fitted Gaussian alone. - Changed the default behavior of ``HorneExtract(bkgrd_prof=None)``. This now fits the Gaussian profile without a background model.
…e kernel is now evaluated directly on the image grid at each pixel's offset from the trace instead of rolling the image by whole pixels. - Changed the spatial profile fit to work in trace-relative coordinates without resampling the image (Horne 1986, Sect. II.A). - Added a ``window`` argument to HorneExtract that restricts the profile fit and the extraction to pixels near the trace. - Vectorised the kernel evaluation, making the extraction about three times faster.
hpparvi
force-pushed
the
v110_horne_extraction_improvements
branch
from
September 23, 2026 09:28
449c8d5 to
eee2bd1
Compare
…o use explicit string literals.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a number of accuracy issues in
HorneExtractand makes it follow the trace at sub-pixel precision.Bug fixes
Non-flat traces: the flux was rolled to align the trace with the central row, but the variance and mask arrays were not, so the extraction weights came from the wrong pixels. This biased the flux and its uncertainty when variances were non-uniform or when pixels were masked.
Low flux bias with data-derived variances: weighting by the Poisson variance of the observed counts underweights upward fluctuations and biases the flux low by roughly the inverse of the counts per pixel. Following Horne, the variances are now re-estimated from the extraction model before the final extraction. The new
model_varianceargument (defaultTrue) controls this.Extraction kernel: the kernel is now the fitted Gaussian alone. The background model no longer leaks into the kernel and its normalisation, which could drive the flux towards zero far from the source.
bkgrd_prof=Nonenow fits the profile without a background model instead of silently substituting the default polynomial.Improvements
Sub-pixel trace following: the kernel is evaluated directly on the image grid at each pixel's offset from the trace instead of rolling the image by whole pixels. The profile is fit in trace-relative coordinates without resampling (Horne 1986, Sect. II.A).
windowargument restricts the profile fit and extraction to pixels near the trace, keeping other sources on the slit out of the fit.Vectorised the kernel evaluation, which makes the extraction about three times faster.
AI/LLM Disclaimer: The same as in #319. I've used Claude Code with Fable 5.1 to co-develop the PR, but I understand what the code does and how it works, and can explain it when needed.