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

1.1.1 Construct an empty CASA image from a shape


Description

This function creates a CASA image file with the specified shape. All the pixel values in the image are set to 0. Both float valued and complex valued images are supported; the data type of the image is specified via the type parameter.

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.

The Coordinate System, provided as a record describing a Coordsys tool (created via coordsys.torecord(), for instance), is optional. If you provide it, it must be dimensionally consistent with the pixels array you give (see also coordsys).

If you don’t provide the Coordinate System, a default Coordinate System is made for you. If linear=F (the default) then it is a standard RA/DEC/Stokes/Spectral Coordinate System depending exactly upon the shape (Stokes axis must be no longer than 4 pixels and you may find the spectral axis coming out before the Stokes axis if say, shape=[64,64,32,4]). Extra dimensions are given linear coordinates. If linear=T then you get a linear Coordinate System.

Arguments





Inputs

outfile

Name of output image file. Default is unset.

allowed:

string

Default:

shape

Shape of image. Required.

allowed:

intArray

Default:

0

csys

Record describing Coordinate System. Default is unset.

allowed:

record

Default:

linear

Make a linear Coordinate System if csys not given?

allowed:

bool

Default:

false

overwrite

Overwrite (unprompted) pre-existing output file?

allowed:

bool

Default:

false

log

Write image creation messages to logger

allowed:

bool

Default:

true

type

Type of image. ’f’ means Float, ’c’ means complex.

allowed:

string

Default:

f

Returns
image

Example

 
 
"""  
#  
print "\t----\t newimagefromshape Ex 1 \t----"  
im1=ia.newimagefromshape(’test2.data’, [64,64,128], overwrite=true)  
cs1 = im1.coordsys(axes=[0,2])  
im1.done()  
im2 = ia.newimagefromshape(shape=[10, 20], csys=cs1.torecord())  
cs1.done()  
im2.done()  
#  
"""  
 
 
The first example creates a zero-filled \imagefile\ named {\sff  
test.data} of shape [64,64,128].  If you examine the header with  
{\stff ia.summary()} you will see the RA/DEC/Spectral coordinate  
information.  In the second example, a Coordinate System describing  
the first and third axes of the image {\sff test2.data} is created and  
used to create a 2D temporary image.  

__________________________________________________________________


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