Practical improvements - #1
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The changes are covered by targeted new tests and the updated implementations look consistent with the intended edge/mask behaviors.
Pull request overview
This PR improves robustness and correctness across several image/photometry helpers by hardening mask handling, edge-trimming behavior, and metadata extraction, with new regression tests covering the updated behavior.
Changes:
- Extend
radprof_pixto accept scalar masks, broadcastable masks, and full-frame masks (including explicit CCDData mask usage). - Ensure
cutout_from_aptrims cutouts at image boundaries consistently across methods while preserving WCS and dtype expectations. - Make
imstat.give_statshandle unequal-sized sections and masks more flexibly, and raise a clear error when no finite unmasked pixels remain.
File summaries
| File | Description |
|---|---|
| tests/phot/test_radprof.py | Adds coverage for radprof_pix mask semantics (full-frame, scalar, broadcastable, explicit CCDData mask). |
| tests/phot/test_aperture.py | Adds edge/boundary cutout tests (shape, coordinate round-trips, WCS consistency) and dtype preservation. |
| tests/imutil/test_imstat.py | Adds tests for unequal statsecs, integer masks, slice-style sections, and empty/invalid selections. |
| src/astroimred/phot/radprof.py | Implements more flexible mask handling in radprof_pix and uses reducers for min/max initialization. |
| src/astroimred/phot/center.py | Improves masked-weight handling and adds a clearer failure mode when no source is detected for 2D Gaussian init. |
| src/astroimred/phot/aperture.py | Switches to trimmed Cutout2D with WCS propagation and aligns non-bbox data to trimmed regions. |
| src/astroimred/imutil/imstat.py | Refactors section/mask sampling logic, supports mixed section sizes, and raises on empty finite selection. |
| src/astroimred/imutil/_util_fits.py | Makes stack metadata extraction more robust when inputs are CCDData by using .data.ndim/.shape. |
| src/astroimred/fitsmgmt/table.py | Avoids mutating caller-provided DataFrames and makes regex matching safer for non-string/NA values. |
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
No description provided.