NRAO Home > CASA > CASA Toolkit Reference Manual
imager.regiontoimagemask - Function

2.3.1 union a mask image with various regions


Description

This function is very similar to regionmask function except that the mask image has to be existant already and this is an independent helper function (i.e does not care about the state of the imager tool... e.g does not need imager to have an attached ms).

Arguments





Inputs

mask

name of mask image

allowed:

string

Default:

region

Region record usually from regionmanager

allowed:

record

Default:

unset

boxes

list of 4 elements lists e.g [[xblc1, yblc1, xtrc1, ytrc1], [[xblc2, yblc2, xtrc2, ytrc2]]

allowed:

any

Default:

variant

circles

list of 3 elements lists e.g [[rad0, xcen0, ycen0], [rad1,xcen1, ycen1], .....]

allowed:

any

Default:

variant

value

Value to set the mask to

allowed:

double

Default:

1.0

Returns
bool

Example

 
 
 
Makes a mask  then cleans using it.  
 
a=[100.0, 100.0, 200, 200.0]  
b=[50, 50, 80, 80]  
im.regiontoimagemask(mask=’bigmask’, boxes=[a,b])  
im.clean(mask=’bigmask’, model=’3C273XC1.clean.masked’, niter=1000)  
 
Another example using rg.wbox function:  
ia.open(’dirty’)  
cs = ia.coordsys()  
rg.setcoordinates(cs.record())  
r1 = dg.wbox(blc=[’173pix’, ’347pix’], trc=[’183pix’, ’370pix’])  
im.regionmask(mask=’bigmask’,region=r1)  
 
Or using a dict of regions:  
 
r2=rg.wbox(blc=[’180pix’, ’344pix’], trc=[’191pix’, ’369pix’])  
r3=rg.wbox(blc=[’189pix’, ’341pix’], trc=[’204pix’, ’364pix’])  
regs={"reg1"’:r1, "reg2":r2, "reg3":r3}  
rec=rg.makeunion(regs)  
im.regionmask(mask=’bigmask’,region=rec)  
 
If quantities are to be used to define regions the following is a an example  
 
im.regionmask(mask=’joetest’,boxes=[’15:23:32.902’,’+05.19.32.089’,’15:22:28.631’,’+05.28.52.474’])  
 
 
 
 

__________________________________________________________________


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