In my script, I load all files in a ccdproc collection and try to iterate on it like this:
for img, fname in collection.ccds(return_fname=True):
But then I get the following error:
ValueError: a unit for CCDData must be specified.
From what I've read
here
, this seems to be due to a missing BUNIT header in the FITS file. So I've wrote the following workaround:
for hdu in collection.hdus(overwrite=True):
hdu.header['bunit'] = 'adu'
hdu.header.pop('radecsys', None)
hdu.header['radesys'] = 'FK5'
The problem is that it somehow resets the "created at" value of the FITS file and generally feels like bad practice.
So my question(s) is (are): Are we really missing a BUNIT header or is my code wrong? If we're missing it, is there a way to tell Ekos to write it in?
Bonus question: Say I wanted to run each newly acquired FITS file through a simple pipeline (write the BUNIT value and update the WCS with a freshly solved one), what would be the best way to do it?