Skip to content

Commit

Permalink
Merge pull request #867 from mwcraig/fix-866
Browse files Browse the repository at this point in the history
Remove plain numpy array as argument option
  • Loading branch information
mwcraig authored Feb 7, 2025
2 parents 541f59e + b7a32bb commit e39bf7c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
------------------

Expand Down
4 changes: 2 additions & 2 deletions ccdproc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions ccdproc/tests/test_ccdproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit e39bf7c

Please sign in to comment.