WavelengthSolution1D.resample bug fixes and improvements - #319
Open
hpparvi wants to merge 4 commits into
Open
Conversation
…multiplying the per-pixel flux by the pixel wavelength width before dividing by the bin width. The output was labelled as a flux density but was numerically off by the local dispersion and did not conserve the integrated flux. I really thought I fixed this months ago already...
…is does not start at pixel zero, and for solutions where the wavelength decreases with pixel number (the output is now always ascending in wavelength). - Changed `WavelengthSolution1D.resample` to propagate the input mask, copy the input metadata, and return no uncertainty instead of a fabricated zero-valued one when the input has none.
…ally used on the output spectral axis, so spectral_axis.bin_edges is exact for non-uniform bin grids instead of being inferred from the bin centres.
hpparvi
requested review from
cshanahan1,
kbwestfall,
kecnry and
tepickering
September 5, 2026 15:48
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #319 +/- ##
==========================================
+ Coverage 92.52% 92.54% +0.02%
==========================================
Files 18 18
Lines 2341 2348 +7
==========================================
+ Hits 2166 2173 +7
Misses 175 175 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 several bugs in the
WavelengthSolution1D.resamplemethod and improves the method's overall functionality.Bug fixes
Changes
spectral_axis.bin_edgesis exact for non-uniform grids and integrating the flux over those edges recovers the input counts exactly.AI and LLM use disclaimer: I'm systematically going through the specreduce codebase with Claude Code (Fable 5.1) to identify bugs, issues, and any room for (non-breaking) improvements in the existing functionality before the specreduce 2.10 release. The first, rather serious, bug I was aware of beforehand, but I remembered I had it already fixed several months ago. I also used Claude Code to implement most of the changes. I understand the code and the changes and could have implemented them myself, but it would have taken significantly longer than the 2-3 hours of continuous work it took to create this PR.