NRAO Home > CASA > CASA Toolkit Reference Manual
##### regionmanager.makeunion - Function

1.1.2 Create a union of world regions

Description

This function takes a minimum of two world regions and creates a region which is the union of the given regions. The input regions can themselves be compound regions (such as the union or intersection etc). The input regions must be a Pythion dictionary of at leat two regions (see examples).

Arguments

 Inputs regions World regions and comment allowed: any Default: variant Record/dict of regions to be unionized (the key names are immaterial) comment A comment stored with the region allowed: string Default:
Returns
record

Example

- ia.open(’onno’)
- csys = ia.coordsys()
- x = qa.quantity([3,6,9,6,5,5,3],’pix’)
- y = qa.quantity([3,4,7,9,7,5,5],’pix’)
- r1 = rg.wpoly(x,y,[1,2],csys.torecord())
-
- blc = "17:42:29.303 -28.59.18.600"
- trc = "17:42:28.303 -28.59.10.600"
- r2 = rg.wbox(blc,trc,[0,1],csys.torecord())
-
- regions= {’region1’:r1, ’region2’:r2}
- r3 = rg.makeunion(regions,’The mysteries of CASA’)
-
- ia.shape()
[155 178 256]
- ia.boundingbox(r1)
[blc=[3 3 1] , trc=[9 9 256] , inc=[1 1 1] , bbShape=[7 7 256] ,
regionShape=[7 7 256] , imageShape=[155 178 256] ]
- ia.boundingbox(r2)
[blc=[90 90 1] , trc=[103 98 256] ,  inc=[1 1 1] , bbShape=[14 9 256] ,
regionShape=[14 9 256] , imageShape=[155 178 256] ]
- ia.boundingbox(r3)
[blc=[3 3 1] , trc=[103 98 256] ,  inc=[1 1 1] , bbShape=[101 96 256] ,
regionShape=[101 96 256] , imageShape=[155 178 256] ]
-
- ia.statistics(region=r1)
Selected bounding box [3, 3, 1] to [9, 9, 256]
Number points = 6400
-
- ia.statistics(region=r2)
Selected bounding box [90, 90, 1] to [103, 98, 256]
Number points = 32256
-
- ia.statistics(region=r3)
Selected bounding box [3, 3, 1] to [103, 98, 256]
Number points = 38656

When the polygon only is applied, it is auto extended along the third
axis.  The {\stff statistics} function finds 6400 pixels in the region,
which is \$6400/256=25\$ pixels per plane.  Likewise, when the box only is
applied, the {\stff statistics} function finds 32256 pixels in the
region, which is \$32256/256=126\$ pixels per plane.  When the union is
applied, the {\stff statistics} function finds 38656 pixels in the
region.  First it finds the union of the polygon and box (which are
specified only in the XY plane) and that union is extended.  Thus we
expect \$(25+126)*256=38656\$ pixels in the region of the union, as found.

Example

- ia.open(’onno’)
- csys = ia.coordsys()
- x = qa.quantity([3,6,9,6,5,5,3],’pix’)
- y = qa.quantity([3,4,7,9,7,5,5],’pix’)
-
- regions = {}
- regions[’poly’] = rg.wpoly(x,y,[0,1],csys.torecord())
-
- blc = "17:42:29.303 -28.59.18.600"
- trc = "17:42:28.303 -28.59.10.600"
- regions[’box’] = rg.wbox(blc,trc,[0,1],csys.torecord())
-
- r3 = rg.union(regions,’The mysteries of CASA’)

This example is the same as the prevoius one, except the regions are
provided to the union function in a record, rather than directly in the
call sequence.

__________________________________________________________________

More information about CASA may be found at the CASA web page

Copyright © 2016 Associated Universities Inc., Washington, D.C.

Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search