|
|||
NRAO Home > CASA > CASA Toolkit Reference Manual |
|
image.newimagefromfits - Function
1.1.1 Construct a CASA image by conversion from a FITS image file
Description
This function is used to convert a FITS disk image file (Float, Double, Short,
Long are supported) to an CASA image file. If outfile is given, the image
is written to the specified disk file. If outfile is unset, the on-the-fly Image
tool returned by this function is associated with a temporary image. This
temporary image may be in memory or on disk, depending on its size. When
you destroy the on-the-fly Image tool (with the done function) this
temporary image is deleted.
This function reads from the FITS primary array (when the image is at the beginning of the FITS file; whichhdu=0), or an image extension (when the image is elsewhere in the FITS file, whichhdu > 0).
By default, any blanked pixels will be converted to a mask value which is false, and a pixel value that is NaN. If you set zeroblanks=T then the pixel value will be zero rather than NaN. The mask will still be set to false. See the function replacemaskedpixels if you need to replace masked pixel values after you have created the image.
Arguments
Inputs |
| ||
outfile |
| Output image file name. Default is unset.
| |
| allowed: | string |
|
| Default: |
| |
infile |
| Input FITS disk file name. Required.
| |
| allowed: | string |
|
| Default: |
| |
whichrep |
| If this FITS file
contains multiple coordinate representations, which one
should we read | |
| allowed: | int |
|
| Default: | 0 |
|
whichhdu |
| If this FITS file contains multiple images, which one
should we read (0-based).
| |
| allowed: | int |
|
| Default: | 0 |
|
zeroblanks |
| If there are blanked pixels, set them to zero instead of
NaN
| |
| allowed: | bool |
|
| Default: | false |
|
overwrite |
| Overwrite (unprompted) pre-existing output file?
| |
| allowed: | bool |
|
| Default: | false |
|
image
Example
"""
#
print "\t----\t newimagefromfits Ex 1 \t----"
# Assume we can find test fits file using
# CASAPATH environment variable
pathname=os.environ.get("CASAPATH")
pathname=pathname.split()[0]
datapath=pathname+’/data/demo/Images/imagetestimage.fits’
im1=ia.newimagefromfits(’./myimage’, datapath, overwrite=true)
print im1.summary()
print im1.miscinfo()
print ’fields=’, im1.miscinfo().keys()
im1.done()
#
"""
The FITS image is converted to a \casa\ \imagefile\ and access is
provided via the \imagetool\ called {\stf im1}. Any FITS header
keywords which were not recognized or used are put in the
miscellaneous information bucket accessible with the miscinfo function. In
the example we list the names of the fields in this record.
__________________________________________________________________
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