|
|||
NRAO Home > CASA > CASA Toolkit Reference Manual |
|
image.tofits - Function
1.1.1 Convert the image to a FITS file
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 the internal native format. 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. Alternatively, if you use velocity=F and wavelength=T, the spectral axis will be written in wavelength.
The FITS definition demands equal increment pixels. Therefore, if you write wavelength or optical velocity information as primary, 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 if the spectral bins are not originally equidistant in wavelength. Images generated by the CASA clean task have spectral axes which are always equidistant in frequency.
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 using the default minpix and maxpix. 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. If you want to specifically only drop a degenerate Stokes axis, use the dropstokes argument.
If you want to place degenerate axes last in the FITS header, use the deglast argument. If you want to make sure that the Stokes axis is placed last in the FITS header, use the stokeslast argument.
Arguments
Inputs |
| ||
outfile |
| FITS file name. Default is input name + ’.fits’
| |
| allowed: | string |
|
| Default: |
|
|
velocity |
| prefer velocity (rather than frequency) as primary
spectral axis?
| |
| allowed: | bool | |
| Default: | false |
|
optical |
| use the optical (rather than radio) velocity convention?
| |
| allowed: | bool | |
| Default: | true |
|
bitpix |
| Bits per pixel, -32 (floating point) or 16 (integer)
| |
| allowed: | int | |
| Default: | -32 |
|
minpix |
| Minimum pixel value for BITPIX=16, Default is to
autoscale if minpix > maxpix.
| |
| allowed: | double | |
| Default: | 1 |
|
maxpix |
| Maximum pixel value for BITPIX=16, Default is to
autoscale if maxpix < minpix.
| |
| allowed: | double | |
| Default: | -1 |
|
region |
| Region selection. See ”help par.region” for details.
Default is to use the full image.
| |
| allowed: | any |
|
| Default: | variant
|
|
mask |
| Mask to use. See help par.mask. Default is none.
| |
| allowed: | any |
|
| Default: | variant
|
|
overwrite |
| Overwrite (unprompted) pre-existing output file?
| |
| allowed: | bool |
|
| Default: | false |
|
dropdeg |
| Drop degenerate axes?
| |
| allowed: | bool |
|
| Default: | false |
|
deglast |
| Put degenerate axes last in header?
| |
| allowed: | bool |
|
| Default: | false |
|
dropstokes |
| Drop Stokes axis?
| |
| allowed: | bool |
|
| Default: | false |
|
stokeslast |
| Put Stokes axis last in header?
| |
| allowed: | bool |
|
| Default: | true |
|
wavelength |
| Write spectral axis in units of wavelength (instead of
velocity or frequency)?
| |
| allowed: | bool |
|
| Default: | false |
|
airwavelength |
| When wirting the spectral axis in units of wavelength,
use air wavelength instead of vacuum wavelength?
| |
| allowed: | bool |
|
| Default: | false |
|
async |
| Run asynchronously?
| |
| allowed: | bool |
|
| Default: | false |
|
stretch |
| Stretch the mask if necessary and possible? See help
par.stretch. Default False
| |
| allowed: | bool |
|
| Default: | false |
|
history |
| Write the image history to the FITS file? Default True
| |
| allowed: | bool |
|
| Default: | true |
|
bool
Example
"""
#
print "\t----\t tofits Ex 1 \t----"
ia.maketestimage()
ok = ia.tofits(’MYFILE.FITS’,overwrite=true)
# write FITS image file
ok = ia.tofits(’MYFILE2.FITS’, bitpix=16, overwrite=true)
# Write as scaled 16 bit integers
ia.close()
#
"""
__________________________________________________________________
More information about CASA may be found at the
CASA web page
Copyright © 2016 Associated Universities Inc., Washington, D.C.
This code is available under the terms of the GNU General Public Lincense
Home |
Contact Us |
Directories |
Site Map |
Help |
Privacy Policy |
Search