diff --git a/CHANGES.rst b/CHANGES.rst index 28bd4548..577dc6d1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,9 @@ Other Changes and Additions Bug Fixes ^^^^^^^^^ +- Do not allow the first argument of ``subtract_overscan`` to be a plain numpy + array. [#867] + 2.4.3 (2025-01-15) ------------------ diff --git a/ccdproc/core.py b/ccdproc/core.py index eea5c03c..c5266c37 100644 --- a/ccdproc/core.py +++ b/ccdproc/core.py @@ -475,8 +475,8 @@ def subtract_overscan( Spaces are stripped out of the ``fits_section`` string. """ - if not (isinstance(ccd, CCDData) or isinstance(ccd, np.ndarray)): - raise TypeError("ccddata is not a CCDData or ndarray object.") + if not isinstance(ccd, CCDData): + raise TypeError("ccddata is not a CCDData object.") if (overscan is not None and fits_section is not None) or ( overscan is None and fits_section is None diff --git a/ccdproc/tests/test_ccdproc.py b/ccdproc/tests/test_ccdproc.py index b79883af..b2bc0ad6 100644 --- a/ccdproc/tests/test_ccdproc.py +++ b/ccdproc/tests/test_ccdproc.py @@ -305,6 +305,9 @@ def test_subtract_overscan_fails(): # Does a fits_section which is not a string raise an error? with pytest.raises(TypeError): subtract_overscan(ccd_data, fits_section=5) + # Do we raise an error if the input is a plain array? + with pytest.raises(TypeError): + subtract_overscan(np.zeros((10, 10)), fits_section="[1:10]") def test_trim_image_fits_section_requires_string():