Closed jmasters closed 10 years ago
thanks for looking at this.
I haven't put much work into history, comment yet. I could use some help in this area, as it isn't my use case. Is this something you are interested in looking at?
I was serious; I would really appreciate your help if you have time. This should be a simple tweak to the FITSHDR class
I have implemented correct handling of COMMENT and HISTORY fields. Please git pull from master and give it a try.
The BLANK keyword seems to be updated somehow internally, I'm not sure what do do with it. I could use some advice on that.
I just happened to look at this thread again today and saw your last few comments! I didn't mean to ignore them but I don't think I was ever notified because I hadn't subscribed to the thread. I think I am now. Anyhow, thanks a ton for updating the comment/history code. This does seem to have improved, however I just did a simple
fh = fitsio.read_header("infile.fits")
fitsio.write("outfile.fits", np.array([1]), header=fh)
and noticed a small issue where the COMMENT keywords get duplicated. For example,
COMMENT FITS (Flexible Image Transport System) format is defined in 'Astronomy
COMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H
becomes
COMMENT FITS (Flexible Image Transport System) format is defined in 'Astronomy
COMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H
COMMENT FITS (Flexible Image Transport System) format is defined in 'Astronomy
COMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H
Those comments are written by cfitsio automatically. The only way to avoid the duplicate would be to do a full match of the entire comment and remove it from any input header. That would work as long as cfitsio doesn't change it's comment.
OK. Thanks for letting me know and thanks for continuing to improve this great library.
I'm re-opening this, because I think it is worthwhile to explore matching those entries.
I think this is somewhat annoying but hard to fix because these comments cross multiple entries. I'm going to close again, but let me know if the annoyance factor gets too high.
Is this fitsio module able to add multiple HISTORY, COMMENT or BLANK keywords to a header? I've tried adding with the write_key() method. I appears I can append values to a single HISTORY entry (for example), but then I have trouble reading it using the read_header() method.