Keep clip_extrema indices in the array namespace - #954
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #954 +/- ##
=======================================
Coverage 95.82% 95.83%
=======================================
Files 8 8
Lines 1629 1631 +2
=======================================
+ Hits 1561 1563 +2
Misses 68 68 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Can you please go ahead and make this non-draft when you have a chance to look it over? |
|
@nomad3 -- is this one ready for review? |
Fixes astropy#928 Signed-off-by: Simon Aguilera <saguilera1608@gmail.com>
Signed-off-by: Simon Aguilera <saguilera1608@gmail.com>
Signed-off-by: Simon Aguilera <saguilera1608@gmail.com>
aa5beee to
8860623
Compare
Signed-off-by: Simon Aguilera <saguilera1608@gmail.com>
|
Yes—thank you for checking. I have personally reviewed the rebased diff and fresh validation, corrected the changelog placement, and marked it ready for review. All completed exact-head CI jobs are green; the remaining Dask+Bottleneck matrix job is still queued. |
mwcraig
left a comment
There was a problem hiding this comment.
This review was drafted by Claude Code and is being posted on behalf of @mwcraig, who reviewed and approved its contents.
Thanks @nomad3 — this is a careful fix and an unusually well-constructed test.
I verified the replacement arithmetic by hand: the accumulation loop over shape[1:] is exactly C-order ravel_multi_index, and the strict=True zip guards against a coordinate/shape mismatch. Two quiet improvements ride along: argsorted[(i, ...)] removes the old hardcoded assumption of a 3D stack (which also violated array-api-strict indexing rules for 3D-image stacks), and creating mg on the data device removes the implicit host-to-device transfer that #928 was about. I also recomputed the test's hardcoded flat indices and expected mask for the 3×2×3 data and they're correct.
One optional suggestion — happy to merge as-is if you'd rather not:
- The test builds the
Combinerviaobject.__new__and sets_xp/_data_arr/_data_arr_maskdirectly, which couples it to private internals for every backend even though only array-api-strict needs the bypass (it can't stack a list of arrays). If you're willing, branching so that non-strict backends construct theCombinernormally (from a list ofCCDData) and only strict uses the bypass would make the test more robust against future changes toclip_extrema's internals. Entirely non-blocking.
Signed-off-by: Simon Aguilera <saguilera1608@gmail.com>
Summary
ravel_multi_indexwith equivalent C-order arithmetic in the selected array namespaceFixes #928
Validation
python -m pytest ccdproc -q— 380 passed, 29 skippedpython -m pytest ccdproc/tests/test_combiner.py -q— 87 passed with NumPy and 87 passed with Daskarray-api-stricton a non-default device — 1 passedgit diff --check, andgit show --check— passedarray-api-strictdeliberately excludes integer-array assignment, so the focused strict regression replaces only the finalxpx.atupdate with a test spy. The production update path is exercised by the NumPy, Dask, and JAX runs; strict verifies that the exact C-order indices are computed in the selected namespace and remain on the data device.Checklist
AUTHORS.rstfile? (The entry is already present on current main, so it is intentionally not duplicated here.)[skip ci]? (Not a documentation-only change.)CHANGES.rstfile?Fixes #928?AI assistance disclosure
OpenAI Codex was used for source inspection, test design, implementation, and automated review. I have personally reviewed the current diff and validation evidence and take responsibility for this contribution.