ImageFileCollection.ccds(return_fname=True) does not return the header
- Dominant language
- Python
- Stars
- 93
- Forks
- 92
- Avg merge
- 14h 44m
- Merged PRs (30d)
- 30
Description
From the documentation for the method ImageFileCollection.ccds(), it seems that if return_fname=True, then it should return "the tuple (header, file_name)" instead of just header. I cannot figure out how to do that in practice.
Iterating like this:
`for ccd, fname in image_collection.ccds(return_fname=True) : `
does return the CCDData object in question, and its filename, but not the header. I can't figure out how to get the header. Instead I had to do a clunky workaround, that puts the data in a np array and then converts it to a CCDData object, since there doesn't seem to be a way to do hdu.ccd :
```python
for hdu, fname in image_collection.hdus(return_fname=True) :
header = hdu.header
data = hdu.data
data_ccd = CCDData(hdu.data, unit='MJy/sr', header=header) # clunky. Needed to iterate all of header, data, filename
subtracted = data_ccd.subtract(combined_image, handle_meta='first_found') # This saves the header from data_ccd
newname=sub('_cbcd.fits', '_bcbcd.fits', fname)
subtracted.write(outdir + newname, overwrite=True)
```
Contributor guide
Assessment
This issue has not been assessed yet.