Open jasonmold opened 4 years ago
@jasonmold thanks for highlighting this, and apologies for the troubles here. Several USC students have been working on improvements to sndrizpipe, and in the process we've uncovered some peculiarities in the fits structure of certain drizzled images produced by DrizzlePac, which is the problem you've identified here. I've raised this as a bug with the DrizzlePac developers, but they've indicated that the cure may not suit the ailment. There are two options for you in the short term:
adopt my fork of DrizzlePac wherein I have made the bug fix proposed in the thread linked above. This fork will not keep up with the development of DrizzlePac from STScI, but it will work with sndrizpipe now. (this is what my students have done locally)
adjust sndrizpipe so that it fixes the fits headers, either by adding a 'sci' extension to the _drz_sci.fits files whenever it is missing or by deleting 'EXTVER' from the primary header if 'EXTNAME' is not present in your files. This latter is the solution proposed from mcara at STScI.
We may be able to do the latter fix eventually, but since we've gotten past this with fix 1 it will be on the back burner for us. If you do make it work, then please issue a pull request and we'll be happy to adopt it in this original repository.
I removed EXTVER from the science files and confirm this fixes the bug. Why not implementing this simple fix into sndrizpipe?
Since the pipeline only looks for the colfax dataset I let it run the test, which actually failed:
Version Information
Python Version [Clang 9.0.1 ] 3.7.6 | packaged by conda-forge | (default, Mar 5 2020, 15:03:29) numpy Version -> 1.18.1 astropy Version -> 4.0 stwcs Version -> 1.5.3
Finding shifts for: colfax_f160w_e01_12443_1B_nat_drz_sci.fits
=== Source finding for image 'colfax_f160w_e01_12443_1B_nat_drz_sci.fits': Trailer file written to: tweakreg.log Traceback (most recent call last): .... .... File "/Users/jason/anaconda2/envs/astroconda/lib/python3.7/site-packages/astropy/io/fits/hdu/hdulist.py", line 742, in index_of raise KeyError(f'Extension {key!r} not found.') KeyError: "Extension ('', 1) not found."