I'm dealing with .fits (.fit) files with Mathematica, and these files are Fermi LAT GRBs data. We can import one of them by Import["https://heasarc.gsfc.nasa.gov/FTP/fermi/data/gbm/triggers/ 2017/bn170306588/current/glg_trigdat_all_bn170306588_v01.fit"] for example.

Every fit file has its header imformation, and we can read it via fv, and it looks just like that:

header of fits file

I cannot find any way to read the header of FITS file in Mathematica. So my question is this:

Is there any way to read FITS header information ?


2 Answers 2



file = "https://heasarc.gsfc.nasa.gov/FTP/fermi/data/gbm/triggers/2017/bn170306588/current/glg_trigdat_all_bn170306588_v01.fit";

you can try

Import[file, "RawMetaInformation"]

You can find out about other accessible import elements with

Import[file, "Elements"]

{"Airmass", "Author", "BitDepth", "Channels", "ColorSpace", "Comments", "Data", "DataType", "Declination", "Device", "Dimensions", "Equinox", "ExposureTime", "Extensions", "Graphics", "HDUCount", "History", "HourAngle", "Image", "ImageSize", "IndexedAssociation", "MetaInformation", "Object", "ObservationDate", "Observer", "Organization", "Plaintext", "Range", "RawData", "RawMetaInformation", "Reference", "RightAscension", "SiderealTime", "Summary", "SummarySlideView", "TableData", "TableHeaders", "TableUnits", "Telescope"}


yields a massive nested Association containing the headers for this rather complicated file.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.