nraonrao
 
 NRAO Home > CASA > CasaDocument
image.calc - Function

1.1.1 Image calculator
Description

This function is used to evaluate a mathematical expression involving CASA images, assigning the result to the current (already existing) image. It complements the imagecalc function which returns a newly constructed on-the-fly image tool. See note 223 which describes the the syntax and functionality in detail.

If the expression, supplied via the pixels argument, is not a scalar, the shapes and coordinates of the image and expression must conform.

If the image (that associated with the tool) has a pixel mask, then only pixels for which that mask is good will be changed. See the function maskhandler for managing image pixel masks.

See the related functions set and putregion.

Arguments





Inputs

pixels

LEL expression

allowed:

string

Default:

Returns
bool

Example

"""  
#  
print "\t----\t calc Ex 1 \t----"  
ia.maketestimage(’aF’, overwrite=true)  
ia.calc(’min(aF, (min(aF)+max(aF))/2)’)  
ia.calc(’1.0’)  
ia.close()  
#  
"""

The first example shows that there are 2 min functions. One with a single argument returning the minimum value of that image. The other with 2 arguments returning an image containing “aF” data clipped at the value of the 2nd argument. The second example sets all good pixels to unity.

"""  
#  
print "\t----\t calc Ex 2 \t----"  
ia.maketestimage(’aD’, overwrite=true)       # create some  
ia.close()  
ia.maketestimage(’aF’, overwrite=true)       # image files  
ia.close()  
ia.maketestimage(’bF’, overwrite=true)       # for use  
ia.close()  
ia.maketestimage(’aC’, overwrite=true)       # in  
ia.close()  
ia.maketestimage()  
ia.calc(’sin(aD)+(aF*2)+min(bF)+real(aC)’)   # the example  
ia.close()  
#  
"""

This shows a mixed type expression. The real part of the complex image “aC” is used in an expression that otherwise uses Float type.

Please send any comments or questions about CASA or AIPS++ to aips2-requests@nrao.edu

Copyright © 2007 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

Updated daily during alpha development.