MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: FITS format and Mathematica 6

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100845] Re: [mg100832] FITS format and Mathematica 6
  • From: "Scot Martin" <smartin at seas.harvard.edu>
  • Date: Tue, 16 Jun 2009 21:50:14 -0400 (EDT)
  • Organization: Harvard University
  • References: <gr0glf$96a$1@smc.vnet.net> <h0vtov$79r$1@smc.vnet.net> <200906150938.FAA24124@smc.vnet.net>
  • Reply-to: <scot_martin at harvard.edu>

Andres, 

I also use FITS data. However, I read FITS files with Import [], i.e., I
have never tried to write with Export[]. Nevertheless, I would offer a guess
that you need to do the following based on experience with some other
formats I have used for Export:

Export["test.fits",{"Data"->data,"Metadata"->header}]

If you try this and it works, I can explain why (I certainly have found the
Export syntax confusing at times myself).

Best, Scot

-----Original Message-----
From: anguzman at ing.uchile.cl [mailto:anguzman at ing.uchile.cl] 
Sent: Monday, June 15, 2009 05:38
To: mathgroup at smc.vnet.net
Subject: [mg100845] [mg100832] FITS format and Mathematica 6

Hello:
I am very puzzled by the way Mathematica imports and exports data in 
FITS format, I hope that somebody could give some guidance here.
I work with data in FITS format. For some reason, in the first release 
of Math 6 apparently there were no way of getting the full header of 
an image. This was fixed in the  6.0.2 version which I have now (I=B4m 
not sure about the numeration) with the "Metadata" option in Import, 
option that it is documentated only in the webpage, not in my 
Documentation Center.

Well, whatever, going to my question:
How can I write a fits file with my own header?
This does not work:

    header=Import["file1.fits","Metadata"];
    data=Table[0.,{10},{10}];
    Export["test.fits",data,"Metadata"->header]

where the variable "header" is the "Metadata" of another fits file
Actually, I can not export any fits file with a  header different 
respect to the default one. (You can examine the header of a fits file 
in a text editor)
Maybe "Metadata" is not an "Element" of the file..?? but:

    Import["file1.fits","Elements"]
    {"Airmass", "Author", "BitDepth", "ColorSpace", "Comments", "Data", \
     "DataType", "Declination", "Device", "Equinox", "ExposureTime", \
     "Graphics", "History", "HourAngle", "ImageSize", "Metadata", \
     "Object", "ObservationDate", "Observer", "Organization", "Plaintext", \
     "Range", "RawData", "Reference", "RightAscension", "SiderealTime", \
     "TableData", "TableHeaders", "TableUnits", "Telescope"}


Thanks in advance for any help.
Atte. Andres Guzman
$Version   6.0 for Microsoft Windows (32-bit) (February 7, 2008)
$System
ps. by the way, these features where handled (not very neatly, but 
effectively) in version 5.2 with  ConversionOptions->{"Verbose"->True}






----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.





  • Prev by Date: Re: How to use R within Mathematica
  • Next by Date: Re: weird escaping problem with StringPattern inside Module[]
  • Previous by thread: FITS format and Mathematica 6
  • Next by thread: Time for an integration