NRAO Home > CASA > CASA Toolkit Reference Manual
image.fromshape - 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. One may create either an image with float valued pixels (type=’f’) or a complex valued image (type=’c’).

If outfile is given, the image is written to the specified disk file. If outfile is unset, the Image tool is associated with a temporary image. This temporary image may be in memory or on disk, depending on its size. When you close the Image tool (with the close function) this temporary image is deleted.

The Coordinate System, provided as a Coordsys tool, is optional. If you provide it, it must be dimensionally consistent with the shape that you specify (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.

The method returns True if successful, False otherwise.

Arguments





Inputs

outfile

Name of output image file. Default is unset.

allowed:

string

Default:

shape

Shape of image. Must be specified.

allowed:

intArray

Default:

0

csys

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
bool

Example

 
 
"""  
#  
print "\t----\t fromshape Ex 1 \t----"  
ia.fromshape(’test2.data’, [64,64,128], overwrite=true)  
mycs = ia.coordsys(axes=[0,2])  
ia.close()  
ia.fromshape(shape=[10, 20], csys=mycs.torecord())  
mycs.done()  
ia.close()  
#  
"""  
 
 
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 test.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