NRAO Home > CASA > CASA Toolkit Reference Manual
regionmanager.concatenation - Function

1.1.2 Concatenate world regions along a new axis


Description

This function (short-hand name concat) creates a region which is the concatenation along a new axis of the given world regions.

This function is similar to the extension function. The concatenation function allows you to take many world regions, and concatenate them along one axis (rather than take one region and extend it along many axes which is what function extension does).

For example, you may have generated a different polygonal region for each spectral pixel of a spectral-line cube and you wish to concatenate them together to form the overall region for use in a deconvolution application.

The axis to concatenate along is specified as a 1-dimensional world box. The shape of the 1D box must contain as many pixels (although you don’t have to specify it in pixels) as there are regions to concatenate.

Because this function is most likely to be used in a script, the interface takes a record containing region records, Python dictionaries, as there might be a lot of them.

Arguments





Inputs

box

The axis to concatenate along

allowed:

any

Default:

variant

world box region

regions

World regions

allowed:

any

Default:

variant

Record containing world regions

comment

A comment stored with the region

allowed:

string

Default:

String

Returns
record

Example

 
 
- ia.open(’cube’)  
- csys = ia.coordsys()  
- rg.setcoordinates(csys.torecord(), verbose=False) # Don’t tell us each time  
                                                    # private coordinates used  
- box = rg.wbox(blc="20pix", trc="25pix", pixelaxes=[2])  
- bb = ia.boundingbox(box)  
-  
- regs = {};  
- local x, y;  
- for i in bb.blc[3]:bb.trc[3]:  
+ # Some code in function ‘mypolygon’ generates the  
+ # x and y vectors for this spectral pixel, perhaps interactively  
+  
+    mypolygon(x,y);  
+    regs["reg"+str(j)] = rg.wpolygon(x,y,[0,1])  
- rc = rg.concatenation(box, regs)  
-  
- ia.statistics(region=rc, axes=[1,2])  
Plane Freq         Npts Sum            Mean           Rms            Sigma          Minimum        Maximum  
20    1.413724e+09 25   -4.778154e+00  -1.911262e-01  2.578399e-01   1.766359e-01   -4.252437e-01  1.820721e-01  
21    1.413744e+09 40   -7.476902e+00  -2.990761e-01  3.692736e-01   2.210687e-01   -6.073643e-01  1.634156e-01  
22    1.413763e+09 32   -2.696485e+00  -1.078594e-01  1.916686e-01   1.617070e-01   -3.295788e-01  1.422531e-01  
23    1.413783e+09 77   4.889158e-01   1.955663e-02   3.148451e-02   2.518293e-02   -3.671944e-02  6.521463e-02  
24    1.413803e+09 25   -1.337832e+00  -5.351327e-02  6.296221e-02   3.385893e-02   -1.232493e-01  1.014871e-02  
25    1.413823e+09 15   1.091297e+00   4.365189e-02   7.252339e-02   5.910932e-02   -6.364560e-02  1.630955e-01  
 
 
 
In this example, we create a 1D box and use it to concatenate 2D xy  
polygons along the z axis.  We then ask for the statistics of each plane  
in the region.  There is a differerent number of pixels per plane  
as each polygon is different.  
 

__________________________________________________________________


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