Message Boards Message Boards

Errors of exporting FITS file

Could anyone help? Always getting errors when export simple data to FITS format. I'm using Macbook Air, OS X 10.8.4. Not sure if it's machine dependent.   

 d = First@
 Export["image.fits", d]
 ConstantArray::ilsmn: Single or list of non-negative machine-sized integers expected at position 2 of ConstantArray[32,{-17}]. >>
 Join::heads: Heads List and ConstantArray at positions 1 and 3 are expected to be the same. >>
 BinaryWrite::nocoerce: Join[{83,73,77,80,76,69,32,32,61,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,84,32,47,32,78,111,114,109,97,108,32,70,73,84,83,32,102,105,108,101,32,<<750>>},<<3>>,{32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,<<13>>,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,<<27>>}] cannot be coerced to the specified format. >>
3 years ago

It worked for me using Mathematica9 under Windows 7.  Here is the header dump of the exported file using DS9:

SIMPLE = T / Normal FITS file
BITPIX = 16 / Bits/pixel, negative is floating point
NAXIS = 2 / Dimensionality of data
NAXIS1 = 561
NAXIS2 = 561
EXTENDED= T / Extensions may be present
PCOUNT = 0 / Deprecated
GCOUNT = 1 / Deprecated
BSCALE = 1 / Scale factor
BZERO = 0 / Zero factor real=tape*bscale+bzero
CREATOR = 'Created by Wolfram Mathematica 9.0 :'

Let me know if you want it tried using Mathematica8 (under Windows). 
POSTED BY: Frank Iannarilli
3 years ago
I have the same problem exporting FITS files. I'm running Mathematica 9 on Ubuntu 12.04 LTS (KDE). The error message when I export a known good FITS file is:
ConstantArray::ilsmn: "Single or list of non-negative machine-sized integers expected at position 2 of ConstantArray[32,{-17}]"
POSTED BY: Jonathan Aguilar
3 years ago

Did you ever find the solution? I have the same error, even in the help documentation. I'm on Mathematica 10 - I've never encountered the error before.

POSTED BY: James Hagan
1 year ago


I just tried the OP's test code again, this time on Mathematica 10.1 under Win7 64-bit. It worked again.

One suggestion is to modify the Export statement to be so:

Export["image1.fits", d, "Data"]

Here's a reminder that I use: (* !! FITS: Export[] "Data", Import "RawData" !! *)

POSTED BY: Frank Iannarilli
1 year ago

Hmm... I still get the error on Mathematica 10.1 under OSX Yosemite, even using the Export["image1.fits", d, "Data"] line. I can't seem to find any more documentation on this issue.

Thanks for the reply though.

POSTED BY: James Hagan
1 year ago

Group Abstract Group Abstract