NRAO Home > CASA > CASA Toolkit Reference Manual
image.newimagefromfile - Function

1.1.1 Construct a new image analysis tool using the specified image. (Also known as newimage.)


Description

This method returns an image analysis tool associated with the specified image. Constructing a image analysis tool in addition to the default ia tool allows the user to operate on multiple images without having to close one before opening another. All ia.newimagefrom*() methods share this functionality.

The parameter infile may refer to a CASA image, a Miriad image, or a FITS image. FITS images of types Float, Double, Long, and Short are supported.

When finished with the newly created tool, the user should close it to free up system resources (eg memory).

ia.newimage() is an alias for this method.

Arguments





Inputs

infile

Input image file name

allowed:

string

Default:

Returns
image

Example

 
# This is one way to copy a FITS image into an already extant CASA image  
# of the same shape (ia.subimage() is more effecient, but this example is  
# meant to demonstrate ia.newimagefromfile()  
 
# note that the ia tool is not attached to an image after the first command,  
# the fitsimage tool is  
fitsimage = ia.newimagefromfile("myimage.fits")  
# now attach the target CASA image to the ia tool  
ia.open("myimage.im")  
# copy pixel values  
ia.putchunk(fitsimage.getchunk())  
# copy the coordinate system  
ia.setcoordsys(fitsimage.coordsys().torecord())  
# copy other miscellaneous things  
ia.setbrightnessunit(fitsimage.getbrightnessunit())  
ia.setmiscinfo(fitsimage.miscinfo())  
# be sure to call done() on both tools to free up memory  
ia.done()  
fitsimage.done()  
 

__________________________________________________________________


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