esheldon / fitsio

A python package for FITS input/output wrapping cfitsio
GNU General Public License v2.0
133 stars 57 forks source link

Modifying existing entries in an existing header doesn't work #318

Open DavidT3 opened 3 years ago

DavidT3 commented 3 years ago

In my specific case I wish to update some headers in a binary table HDU, within a file with multiple HDUs.

The keywords that I wish to modify already exist, and then when my code attempts to modify them using write_key or write_keys what seems to happen is that rather than the existing entry in the header list being replaced, another dictionary is added with the same name and a different value entry.

I don't know then know how cfitsio writes that out to the file, but the tools I commonly use for analysis (topcat and XSPEC for instance) only see the original entry.

Perhaps I'm simply using fitsio wrong, but I can't figure out any way to force it to replace the existing entry, or delete the original so I can add a new entry without conflicts

esheldon commented 3 years ago

Thanks for the report. Can you please post an example that reproduces?