-
-
Notifications
You must be signed in to change notification settings - Fork 92
Adopt the array api #885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Adopt the array api #885
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #885 +/- ##
=======================================
Coverage ? 97.03%
=======================================
Files ? 8
Lines ? 1518
Branches ? 0
=======================================
Hits ? 1473
Misses ? 45
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
85625f0
to
04293b7
Compare
As a quick FYI I ran the test suite in this PR on a machine with a NVidia GPU with |
@@ -8,17 +8,19 @@ dynamic = ["version"] | |||
description = "Astropy affiliated package" | |||
readme = "README.rst" | |||
license = { text = "BSD-3-Clause" } | |||
requires-python = ">=3.8" | |||
requires-python = ">=3.11" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adopt Spec 0? Has that been adopted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, misread this -- what is Spectrum 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the move here would be to bump it up to 3.12?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.11 for a few more months. Then 3.12. I was also thinking about adding the badge saying "Spec 0", e.g. you can see in the README in https://github.com/GalacticDynamics/unxt
@@ -8,17 +8,19 @@ dynamic = ["version"] | |||
description = "Astropy affiliated package" | |||
readme = "README.rst" | |||
license = { text = "BSD-3-Clause" } | |||
requires-python = ">=3.8" | |||
requires-python = ">=3.11" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2fa76b7
to
3b2b9fc
Compare
These are necessary because upstream dependencies (astropy) explicitly check for numpy arrays rather than using the array API.
This is necessary because CCDData does not implement the array API currently.
One more fix FIx the fix
8137626
to
6af1e1e
Compare
Turns out there were several places where the functions in the array's namespace were not actually being used. This fixes that. Clean up uncertainty wrapper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mwcraig. LMK how I can be of help with reviews. This PR looks great, and it seems to be mostly down to small line-by-line suggestions.
Thanks, @nstarman! I'll want one last look once I've tied down a few loose ends. One thing I learned since the coordination meeting is that using I've switch to using I'll ping you when I'm confident that I have all of those cases fixed up. |
747d4a4
to
9afb5a6
Compare
The former is not part of the array API but the latter is.
Co-authored-by: Nathaniel Starkman <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR makes the necessary changes to adopt the array API across ccdproc. The implementation allows users to leverage different array libraries (JAX, Dask, CuPy) while maintaining backward compatibility with numpy. Key infrastructure is added to support array API operations without changing existing user interfaces.
- Comprehensive adoption of array API across core processing functions
- Testing infrastructure for multiple array libraries (numpy, JAX, dask)
- Updated documentation including new array API guide and examples
Reviewed Changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 6 comments.
Show a summary per file
File | Description |
---|---|
tox.ini | Adds test environments for JAX and Dask array libraries with proper configuration |
pyproject.toml | Updates dependencies to include array API packages and minimum version requirements |
docs/index.rst | Adds array API documentation section to table of contents |
docs/array_api.rst | New comprehensive guide explaining array API usage and library options |
ccdproc/core.py | Major refactoring to support array API operations throughout processing functions |
ccdproc/conftest.py | Test infrastructure for selecting array libraries via environment variables |
ccdproc/tests/*.py | Extensive test updates to work with array API and multiple backends |
Comments suppressed due to low confidence (1)
ccdproc/tests/test_combiner.py:746
- There is a spelling error: 'combiune' should be 'combine'.
"""
with `sparse`_. A `pull request <https://github.com/astropy/ccdproc/pulls>`_ to FIX | ||
that would be a welcome contribution to the project. | ||
|
||
What limitations shuold I be aware of? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a spelling error: 'shuold' should be 'should'.
What limitations shuold I be aware of? | |
What limitations should I be aware of? |
Copilot uses AI. Check for mistakes.
with `sparse`_. A `pull request <https://github.com/astropy/ccdproc/pulls>`_ to FIX | ||
that would be a welcome contribution to the project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The word 'FIX' appears to be a TODO placeholder that should be replaced with an actual link or removed.
with `sparse`_. A `pull request <https://github.com/astropy/ccdproc/pulls>`_ to FIX | |
that would be a welcome contribution to the project. | |
with `sparse`_. A `pull request <https://github.com/astropy/ccdproc/pulls>`_ to add | |
support for `sparse`_ would be a welcome contribution to the project. |
Copilot uses AI. Check for mistakes.
@@ -34,6 +34,7 @@ Detailed, step-by-step guide | |||
|
|||
In addition to the documentation here, a detailed guide to the topic of CCD | |||
data reduction using ``ccdproc`` and other `astropy`_ tools is available here: | |||
(TODO: FIX LINK BELOW) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a TODO comment indicating that the link below needs to be fixed. This should be addressed before merging.
(TODO: FIX LINK BELOW) |
Copilot uses AI. Check for mistakes.
@@ -334,6 +340,7 @@ def test_combiner_mask_average(): | |||
# are masked?! | |||
# assert ccd.data[0, 0] == 0 | |||
assert ccd.data[5, 5] == 1 | |||
# THE LINE BELOW IS CATCHING A REAL ERROR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] This comment suggests there may be an unresolved issue with the test. Consider adding more context about what error is being caught and whether it needs to be fixed.
# THE LINE BELOW IS CATCHING A REAL ERROR | |
# Ensure that the mask is correctly applied to pixels that are fully masked |
Copilot uses AI. Check for mistakes.
@@ -8,17 +8,19 @@ dynamic = ["version"] | |||
description = "Astropy affiliated package" | |||
readme = "README.rst" | |||
license = { text = "BSD-3-Clause" } | |||
requires-python = ">=3.8" | |||
requires-python = ">=3.11" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The minimum Python version has been increased from 3.8 to 3.11. This is a breaking change that should be clearly documented in the release notes.
Copilot uses AI. Check for mistakes.
@@ -47,10 +50,11 @@ deps = | |||
|
|||
# Remember to transfer any changes here to setup.cfg also. Only listing | |||
# packages which are constrained in the setup.cfg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The oldest supported numpy version has been changed from 1.24 to 1.26. This is a breaking change that should be documented.
# packages which are constrained in the setup.cfg | |
# packages which are constrained in the setup.cfg | |
# Note: The oldest supported version of NumPy has been updated from 1.24 to 1.26. | |
# This is a breaking change and should be taken into account when updating dependencies. |
Copilot uses AI. Check for mistakes.
This PR makes the necessary changes to adopt the array API. There are still some things to sort out:
.data_arr.mask
to.data_arr_mask
constitutes an API change. If it does (and I think it does) then patch things up so that.data_arr.mask
points to.data_arr_mask
array_api_extra
makes handling those easy)Once those are done the next step will be to find an outside reviewer for this...