diff --git a/CHANGES.rst b/CHANGES.rst index 3b571709..eabe559d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,14 @@ +2.5.2 (unreleased) +------------------ + +Bug Fixes +^^^^^^^^^ + +- Fix dtype conversion in ``Combiner._weighted_sum`` to use the array-API + namespace form ``xp.astype(weights, xp.float64)`` instead of the deprecated + string-based ``.astype("float64")``. This resolves the ``DeprecationWarning`` + that was being promoted to a test failure in the JAX CI job. [#924] + 2.5.1 (2025-07-05) ------------------ diff --git a/ccdproc/combiner.py b/ccdproc/combiner.py index 6cc704f9..ac15a028 100644 --- a/ccdproc/combiner.py +++ b/ccdproc/combiner.py @@ -600,7 +600,7 @@ def _weighted_sum(self, data, sum_func, xp=None): # Turns out bn.nansum has an implementation that is not # precise enough for float32 sums. Doing this should # ensure the sums are carried out as float64 - weights = weights.astype("float64") + weights = xp.astype(weights, xp.float64) weighted_sum = sum_func(data * weights, axis=0) return weighted_sum, weights diff --git a/ccdproc/tests/test_image_collection.py b/ccdproc/tests/test_image_collection.py index 22ab819d..dea0e8a0 100644 --- a/ccdproc/tests/test_image_collection.py +++ b/ccdproc/tests/test_image_collection.py @@ -385,12 +385,19 @@ def test_generator_data(self, triage_setup): assert isinstance(img, np.ndarray) def test_generator_ccds_without_unit(self, triage_setup): + from ccdproc.conftest import testing_array_library + + using_jax = testing_array_library.__name__ == "jax.numpy" + collection = ImageFileCollection( location=triage_setup.test_dir, keywords=["imagetyp"] ) - - with pytest.raises(ValueError): - _ = next(collection.ccds()) + if using_jax: + ccd = next(collection.ccds()) + assert isinstance(ccd, CCDData) + else: + with pytest.raises(ValueError): + _ = next(collection.ccds()) def test_generator_ccds(self, triage_setup): collection = ImageFileCollection(