Skip to content

Use array-API dtype in Combiner; fix stale test#925

Open
karlhillx wants to merge 1 commit into
astropy:mainfrom
karlhillx:fix-924-jax-dtype
Open

Use array-API dtype in Combiner; fix stale test#925
karlhillx wants to merge 1 commit into
astropy:mainfrom
karlhillx:fix-924-jax-dtype

Conversation

@karlhillx
Copy link
Copy Markdown
Contributor

@karlhillx karlhillx commented Jun 5, 2026

Fixes #924.

Two changes:

  • ccdproc/combiner.py:603weights.astype("float64")xp.astype(weights, xp.float64). The actual JAX deprecation.
  • ccdproc/tests/test_image_collection.py:387-401ccds() raises ValueError in every backend except JAX, so the test branches: asserts the raise in numpy/dask, asserts a CCDData is returned in JAX. Same pattern as test_memory_use.py.

The py313-jax job still has 6 failures from np.result_type in astropy.nddata.mixins.ndarithmetic:769 when scaling CCDData. That's astropy code, not ccdproc, and predates this PR — worth a separate issue upstream.

cc @mwcraig

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.56%. Comparing base (16dcaa1) to head (a5f80d5).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #925   +/-   ##
=======================================
  Coverage   96.56%   96.56%           
=======================================
  Files           8        8           
  Lines        1571     1571           
=======================================
  Hits         1517     1517           
  Misses         54       54           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@karlhillx karlhillx force-pushed the fix-924-jax-dtype branch from 85fac1a to 0ab3a95 Compare June 5, 2026 00:41
@karlhillx karlhillx changed the title Use array-API-compatible dtype conversion in Combiner._weighted_sum Use array-API dtype in Combiner; fix stale test Jun 5, 2026
@karlhillx karlhillx force-pushed the fix-924-jax-dtype branch from 0ab3a95 to f18622c Compare June 5, 2026 00:46
Fixes astropy#924. The string-based weights.astype('float64') triggers a
DeprecationWarning in JAX's array API implementation, which is promoted
to a test failure in the py313-jax CI job.

Use xp.astype(weights, xp.float64) instead, where xp is the array
namespace already in scope at that point in the function. This works
across all array-API backends (numpy, jax, cupy, etc.) without
deprecation warnings.

The issue body also notes a 'stale' test in test_image_collection.py
(test_generator_ccds_without_unit) where it claims ImageFileCollection.ccds()
no longer raises ValueError. Verified locally against astropy 7.2.0 that
the test still passes as written — ccds() does still raise ValueError
when no unit is supplied (via CCDData.__init__ enforcing
_config_ccd_requires_unit). The 'stale test' part of the issue appears
to be based on a misreading of the current behavior, so the test is
left as-is.

No new tests needed: the JAX CI job is the verification for the array-API
dtype change.
@karlhillx karlhillx force-pushed the fix-924-jax-dtype branch from f18622c to a5f80d5 Compare June 5, 2026 00:53
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.

CI failure: JAX job fails due to dtype deprecation warning and stale test expectation

1 participant