Skip to content

Practical improvements - #1

Merged
ysBach merged 6 commits into
mainfrom
practical_improvements
Sep 5, 2026
Merged

Practical improvements#1
ysBach merged 6 commits into
mainfrom
practical_improvements

Conversation

@ysBach

@ysBach ysBach commented Sep 5, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 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_pix to accept scalar masks, broadcastable masks, and full-frame masks (including explicit CCDData mask usage).
  • Ensure cutout_from_ap trims cutouts at image boundaries consistently across methods while preserving WCS and dtype expectations.
  • Make imstat.give_stats handle 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.

@ysBach
ysBach merged commit 50aba7f into main Sep 5, 2026
1 check passed
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.

2 participants