Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ccdproc.subtract_dark incorrectly raises TypeError on CCDData objects #668

Open
RLWagner opened this issue Jun 5, 2019 · 6 comments
Open

Comments

@RLWagner
Copy link

RLWagner commented Jun 5, 2019

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.
@MSeifert04
Copy link
Contributor

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
Copy link
Contributor

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.

@RLWagner
Copy link
Author

RLWagner commented Jun 7, 2019 via email

@mwcraig
Copy link
Member

mwcraig commented Jun 12, 2019

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

@MSeifert04
Copy link
Contributor

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

@mwcraig
Copy link
Member

mwcraig commented Jun 23, 2019

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants