astropy / astropy/ccdproc

ccdproc.subtract_dark incorrectly raises TypeError on CCDData objects

Open
#668 6 comments 0 reactions 0 assignees View on GitHub
bug ccdproc needs more info
Dominant language
Python
Stars
93
Forks
92
Avg merge
14h 44m
Merged PRs (30d)
30

Description

I am trying to automate my image reduction. I use the individual ccdproc functions (subtract_bias, subtract_dark, etc) since I need to do an image linearization between the bias and dark subtractions. I always get a TypeError from ccdproc.subtract_dark() saying that both image and dark need to be type CCDData. However, as you can see in the code below I've implemented the exact test from subtract_dark before calling and it never triggers. Bias subtraction works fine. If I comment out the isinstance test in ccdproc.subtract_dark everything works fine.
I can provide the images (~11MB total) and/or FITS headers if that would help.

Linux Fedora 27
Python 3.6.8 | Anaconda
astropy 3.1.2
ccdproc 1.3.0.post1
numpy 1.16.3

```
from astropy.nddata import CCDData
from astropy import units as u
# from astropy.time import Time, TimeDelta
# from astropy.utils import iers
# from astropy import coordinates as coord
import ccdproc

img = CCDData.read('UV_Hya-001B400s.fit', unit='adu')
dark = CCDData.read('Master_Dark_1_1600x1200_Bin1x1_Temp-15C_ExpTime400s.fit', unit='adu')
if not (isinstance(img, CCDData) and isinstance(dark, CCDData)):
raise TypeError("This error never triggers")
img_dark = ccdproc.subtract_dark(img,dark,exposure_time='EXPOSURE',exposure_unit=u.s, scale=True)
```
Trace:
```
File "./darktester.py", line 19, in
img_dark = ccdproc.subtract_dark(img,dark,exposure_time='EXPOSURE',exposure_unit=u.s, scale=True)
File "/usr/lib/python3.6/site-packages/ccdproc/log_meta.py", line 70, in wrapper
result = func(*args, **kwd)
File "/usr/lib/python3.6/site-packages/ccdproc/core.py", line 616, in subtract_dark
raise TypeError("ccd and master must both be CCDData objects.")
TypeError: ccd and master must both be CCDData objects.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.