JuliaAstro / FITSIO.jl

Flexible Image Transport System (FITS) file support for Julia
http://juliaastro.org/FITSIO.jl/
MIT License
55 stars 29 forks source link

Add FITSHeader type and associated methods #11

Closed kbarbary closed 10 years ago

kbarbary commented 10 years ago

This PR does the following:

FITSHeader is sort of like an ordered dictionary, but it also stores comments for each item. It makes it possible to read a header, access the values as if it were a dictionary, and write it back while keeping all the comments. e.g.,

header = readheader(f[1])
header["KEYWORD"]  # returns value
header["KEYWORD"] = 1  # set value
setcomment!(header, "KEYWORD", "this is a comment")  # set the comment field

Later on you can write the header back to a file (in a new extension) and all the original comments (and any changes) will be reflected:

write(f, data; header=header)  # writes header, then image data to disk

Apologies for smashing everything into a single commit; my development on this was quite scattered. It's a bit hard to see what's going on from the diff; I can upload the built docs somewhere if anyone wants to see it before merging.

ziotom78 commented 10 years ago

Thanks a lot for your work!