ccdproc icon indicating copy to clipboard operation
ccdproc copied to clipboard

ccdproc.subtract_dark incorrectly raises TypeError on CCDData objects

Open RLWagner opened this issue 6 years ago • 6 comments

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 <module>
    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.

RLWagner avatar Jun 05 '19 14:06 RLWagner

Hi @RLWagner and thank you for the report.

I will have a look at this later. But could you check what CCDData is ccdproc.core.CCDData returns?

MSeifert04 avatar Jun 05 '19 15:06 MSeifert04

I couldn't reproduce this with the provided versions. It would be very helpful if you could provide the output of CCDData is ccdproc.core.CCDData. I assume that somehow your installed ccdproc has a different CCDData class.

MSeifert04 avatar Jun 07 '19 06:06 MSeifert04

CCDData is ccdproc.core.CCDData returns True. Rick

---------- Original Message ---------- From: Michael Seifert [email protected] Date: June 7, 2019 at 2:20 AM

I couldn't reproduce this with the provided versions. It would be very helpful if you could provide the output of CCDData is ccdproc.core.CCDData. I assume that somehow your installed ccdproc has a different CCDData class. —You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

 

RLWagner avatar Jun 07 '19 12:06 RLWagner

@MSeifert04 -- do you have time to follow up on this or should I take a look later today?

mwcraig avatar Jun 12 '19 13:06 mwcraig

@mwcraig It would be great if you could follow up on this. I'm a bit at a loss what might cause the issue.

MSeifert04 avatar Jun 12 '19 14:06 MSeifert04

@RLWagner -- sorry for the delay. I'm not able to reproduce the bug, but I'm not on Ubuntu (not that it should make any difference).

Could you please send (or post here) the output of conda env export so I can try to reproduce your environment?

mwcraig avatar Jun 23 '19 04:06 mwcraig