In combine() (ccdproc/combiner.py:1055-1059) the requested array package is handled with
if array_package is not None:
try:
xp = array_api_compat.array_namespace(array_package)
except TypeError:
xp = array_package
array_api_compat.array_namespace() takes arrays, not modules, so for a module it always raises TypeError (module is not a supported array type — verified for numpy and dask.array) and the fallback hands the raw module through unchanged. The intent was clearly to normalise to the array-api-compat namespace; as written the normalisation never happens.
A raw module then reaches code that uses array-API-only features (xp.bool, the device= keyword in xp.asarray/xp.zeros, xp.astype, ...) and fails, e.g. combine(files, array_package=dask.array) dies with TypeError: from_array() got an unexpected keyword argument 'device' (on main before #976 it died one call later in clip_extrema with module 'dask.array' has no attribute 'argsort').
PR #976 fixed the same problem in Combiner.__init__ by normalising with
xp = array_api_compat.array_namespace(xp.asarray(0))
combine() should do the same so the two entry points agree on what array_package / xp may be, and the array_package docstring should say a plain module is accepted and converted.
Regression test: combine([...numpy CCDData...], array_package=np) and, ideally, array_package=dask.array on a FITS-file input so the CCDData.read branch that converts data/mask/uncertainty into xp is exercised.
Follow-up from the review of #976.
In
combine()(ccdproc/combiner.py:1055-1059) the requested array package is handled witharray_api_compat.array_namespace()takes arrays, not modules, so for a module it always raisesTypeError(module is not a supported array type— verified fornumpyanddask.array) and the fallback hands the raw module through unchanged. The intent was clearly to normalise to the array-api-compat namespace; as written the normalisation never happens.A raw module then reaches code that uses array-API-only features (
xp.bool, thedevice=keyword inxp.asarray/xp.zeros,xp.astype, ...) and fails, e.g.combine(files, array_package=dask.array)dies withTypeError: from_array() got an unexpected keyword argument 'device'(onmainbefore #976 it died one call later inclip_extremawithmodule 'dask.array' has no attribute 'argsort').PR #976 fixed the same problem in
Combiner.__init__by normalising withcombine()should do the same so the two entry points agree on whatarray_package/xpmay be, and thearray_packagedocstring should say a plain module is accepted and converted.Regression test:
combine([...numpy CCDData...], array_package=np)and, ideally,array_package=dask.arrayon a FITS-file input so theCCDData.readbranch that converts data/mask/uncertainty intoxpis exercised.Follow-up from the review of #976.