You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand that there is a method for retrieving the comments and history cards of a FITS header, I would suggest that for compatibility with cfitsio, those cards should be also be returned by Header.Keys().
In addition, it seems that astrogo/cfitsio assumes that in a given HDU there is only one card of type HISTORY or COMMENT. This is not the case with cfitsio.
In case it matters, for my tests I'm using cfitsio v3.370.
An example of a file with several COMMENT cards in the same HDU can be found at:
this begs the question as whether we shouldn't just return the []Card, or have a method to retrieve the n-th card (otherwise, we'd always get the first occurence of COMMENT or HISTORY via the Header.Get(name string) method...
or rename the currrent Get(string) into GetByName(string) and introduce Get(int).
but Header.Cards() []Card SGTM (carefully documenting one shouldn't mess with modifying their content.)
For my use case, which basically consists of scanning all the cards in all header units of a given file and perform some actions depending on the value of some of them, Header.Cards() []Card would be perfect and much more efficient indeed that to repeatedly call Header.Get(key). A note in the documentation could remind the users that they should consider the returned Card slice data as read-only.
In that case, Header.Cards() []Card should return all the cards (including SIMPLE, COMMENT, HISTORY, END) and preserve their order as found in the file.
I would suggest to keep Header.Get(key) which is convenient and modify Header.Comments() []string (note the plural) to return several values, instead of just one value as they currently does. I don't know for sure if a well formed FITS file is supposed to have several HISTORY cards: if that's the case, Header.History() could also become Header.Comments() []string.
The returned value of
Header.Keys()
does not include cards of typeEND
,COMMENT
,HISTORY
:fitsio/header.go
Line 323 in 0221d1a
I understand that there is a method for retrieving the comments and history cards of a FITS header, I would suggest that for compatibility with
cfitsio
, those cards should be also be returned byHeader.Keys()
.In addition, it seems that
astrogo/cfitsio
assumes that in a given HDU there is only one card of typeHISTORY
orCOMMENT
. This is not the case withcfitsio
.In case it matters, for my tests I'm using
cfitsio v3.370
.An example of a file with several
COMMENT
cards in the same HDU can be found at:ftp://legacy.gsfc.nasa.gov/fits_info/sample_files/images/rosat_pspc_rdf2_3_bk1.fits
The text was updated successfully, but these errors were encountered: