Skip to content

Test suite: test_subtract_overscan calls numpy-only .copy() on array-API arrays #969

Description

@mwcraig

Under CCDPROC_ARRAY_LIBRARY=array-api-strict, all 6 parametrized variants of test_subtract_overscan fail with the same error:

ccdproc/tests/test_ccdproc.py:174: in test_subtract_overscan
    science_data = ccd_data.data[science_region].copy()
E   AttributeError: 'Array' object has no attribute 'copy'

Offending codeccdproc/tests/test_ccdproc.py:174-175 (branch array-api-strict-triage-tooling):

science_data = ccd_data.data[science_region].copy()
overscan_data = 0 * ccd_data.data[oscan_region].copy() + oscan

Root cause: the Array API standard does not include a .copy() method on arrays; the portable spelling is xp.asarray(..., copy=True).

This is test-only. The library code is not implicated: core.py's subtract_overscan only calls .copy() on a CCDData object, which is unaffected. The fix belongs in the test suite:

science_data = xp.asarray(ccd_data.data[science_region], copy=True)
overscan_data = 0 * xp.asarray(ccd_data.data[oscan_region], copy=True) + oscan

(the xp namespace is already available in the test function).

Part of the array-API triage in #941; found with the array-api-strict tooling from #937/#939. Verified at branch tip d329ac5 (2026-08-01). Related test-suite cleanup of the same kind: raw np.zeros_like calls, tracked separately.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions