Skip to content

Commit e39bf7c

Browse files
authored
Merge pull request #867 from mwcraig/fix-866
Remove plain numpy array as argument option
2 parents 541f59e + b7a32bb commit e39bf7c

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CHANGES.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Other Changes and Additions
1010
Bug Fixes
1111
^^^^^^^^^
1212

13+
- Do not allow the first argument of ``subtract_overscan`` to be a plain numpy
14+
array. [#867]
15+
1316
2.4.3 (2025-01-15)
1417
------------------
1518

ccdproc/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,8 @@ def subtract_overscan(
475475
Spaces are stripped out of the ``fits_section`` string.
476476
477477
"""
478-
if not (isinstance(ccd, CCDData) or isinstance(ccd, np.ndarray)):
479-
raise TypeError("ccddata is not a CCDData or ndarray object.")
478+
if not isinstance(ccd, CCDData):
479+
raise TypeError("ccddata is not a CCDData object.")
480480

481481
if (overscan is not None and fits_section is not None) or (
482482
overscan is None and fits_section is None

ccdproc/tests/test_ccdproc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ def test_subtract_overscan_fails():
305305
# Does a fits_section which is not a string raise an error?
306306
with pytest.raises(TypeError):
307307
subtract_overscan(ccd_data, fits_section=5)
308+
# Do we raise an error if the input is a plain array?
309+
with pytest.raises(TypeError):
310+
subtract_overscan(np.zeros((10, 10)), fits_section="[1:10]")
308311

309312

310313
def test_trim_image_fits_section_requires_string():

0 commit comments

Comments
 (0)