Next: , Previous: , Up: Internal Routines   [Contents][Index]


15.5.239 fits_write

fits_write, data, file [, header, slice] [, /vocal]

fits_write(data, file [, header, slice] [, /vocal])

Writes the numerical data array and optional string header to the indicated file in FITS format, with optional data compression. data must be of a real (i.e., not complex) data type. header may be a single string or a string array. If /vocal is specified, then a message is printed to the screen if compression was requested but for some reason did not succeed.

The value of integer slice determines if data compression is attempted. If slice is zero, then the data is not compressed. If slice is positive, then lossless Rice compression is attempted, as with crunch. If slice is negative, then lossless Rice compression with run-length encoding is attempted, as with crunchrun. In either case, the magnitude of slice is a compression parameter that can be tweaked to get the best compression, similar to !crunch_slice. It should not be greater than the number of bits per data value.

For a description of the FITS format adopted for LUX data, see LUX FITS File Format.

For uncompressed data, the following information is written into the header of the FITS file: the standard simple, and the bitpix and naxes lines that indicate the data type and dimensions, and also the user-specified header, if any.

For compressed data, the same entries are included, but the bitpix and naxes entries refer to the data after compression, i.e., as included in the FITS file. The following lines come after the last naxes entry: one with keyword compress and value 'RICE ' or 'RICE rle ' for straight and run-length-encoded Rice compression, respectively; one ubitpix line, and unaxes lines, corresponding to bitpix and naxes but referring to the uncompressed data.

The treatment of the user-specified header depends on its contents. If the 9th character of the first (or only) string in header is an equal sign (=), then the header is assumed to contain a proper FITS header. If header is a string array, then each string element is copied into one or more 80-character chunks of the output file, so the elements do not themselves have to be 80 characters in size. If header is a string, then it is assumed to contain 80 characters for each FITS record. Any excess characters after the last full 80-character record are discarded.

If the header does not look like a proper FITS header, then it is taken to be a general comment on the data. If header is a string, then it is chopped into 70-character parts and each part is written to its own FITS record after a comment = keyword. If header is a string array, then each element is written to one or more of its own comment lines.


Next: , Previous: , Up: Internal Routines   [Contents][Index]