Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1488
News FAQ
Search Home


next up previous contents index
Next: image.toascii - Function Up: image - Tool Previous: image.summary - Function


image.tofits - Function



Package general
Module images
Tool image


Convert the image to a FITS file


Synopsis
tofits(outfile, velocity, optical, bitpix, minpix, maxpix, region, mask, overwrite, dropdeg, deglast, async)


Arguments

outfile in FITS file name
    Allowed: String
    Default: Input name + `.fits'
velocity in prefer velocity (rather than frequency) as primary spectral axis?
    Allowed: Bool
    Default: F
optical in use the optical (rather than radio) velocity convention?
    Allowed: Bool
    Default: T
bitpix in Bits per pixel
    Allowed: -32 (floating point) or 16 (integer)
    Default: -32
minpix in Minimum pixel value for BITPIX=16
    Allowed: Float
    Default: Autoscale
maxpix in Maximum pixel value for BITPIX=16
    Allowed: Float
    Default: Autoscale
region in The region of interest
    Allowed: Region tool
    Default: Whole image
mask in OTF mask
    Allowed: Boolean LEL expression or mask region
    Default: None
overwrite in Overwrite (unprompted) pre-existing output file ?
    Allowed: T or F
    Default: F
dropdeg in Drop degenerate axes ?
    Allowed: T or F
    Default: F
deglast in Put degenerate axes last in header ?
    Allowed: T or F
    Default: F
async in Run asynchronously?
    Allowed: Bool
    Default: !dowait


Returns
T or fail


Description

This function converts the image into a FITS file.

If the image has a rest frequency associated with it, it will always write velocity information into the FITS file. By default the frequency information will be primary as it is better defined than velocity information. If you select velocity=T then by default the velocity is written in the optical convention, but if optical=F it will use the radio convention instead.

The FITS definition demands equal increment pixels. Therefore, if you write velocity information as primary and use the optical velocity definition, the increment is computed at the spectral reference pixel. If the bandwidth is large, this may incur non-negligible coordinate calculation errors far from the reference pixel.

By default the image is written as a floating point FITS file (bitpix= -32). Under rare circumstances you might want to save space and write it as scaled 16 bit integers (bitpix = 16). You can have tofits calculate the scaling factors by unsetting minpix and maxpix (the default). If you set minpix and maxpix, values outside of that range will be truncated. This can be useful if all of the FITS images dynamic range is being used by a few high or low values and you are not interested in preserving those values exactly. Besides the factor of two space savings you get by using 16 instead of 32 bits, integer images usually also compress well (for example, with the standard GNU software facility gzip).

If the specified region-of-interest extends beyond the image, it is truncated.

The output mask is the combination (logical OR) of the default input pixel mask (if any) and the OTF mask.

Sometimes it is useful to drop axes of length one (degenerate axes) because not all FITS readers can handle them. Use the dropdeg argument if you want to do this.



Example
- ok := im.tofits('MYFILE.FITS')             # write FITS image file
- ok := im.tofits('MYFILE2.FITS', bitpix=16) # Write as scaled 16 bit integers





next up previous contents index
Next: image.toascii - Function Up: image - Tool Previous: image.summary - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-08-01