|
|
|
|
SynopsisThe S-Lang interface to the CXC region library DescriptionThe region module is the interface between the S-Lang interpreter (see "ahelp slang") and the CXC region library (see "ahelp dmregions"). This document provides an overview of the features of the region module, and tips for using it efficiently in a S-Lang program. Detailed descriptions of each function are provided by individual ahelp pages. The region module is not available by default; to use it in a S-Lang program, it must be loaded using the S-Lang require() function: require("region");Functions provided by the moduleThe following functions are provided by the module; use "ahelp <function>" to get a detailed description of a function:
Using Region_Type variablesThe region module defines a new variable type, Region_Type, which has a complex internal structure that cannot be printed using the S-lang print() command. To see the components of a Region_Type variable, use the regRegionString() or regPrintRegion() routines. Region_Type variables can be defined using the regParse command, which converts a CIAO region string into a Region_Type variable. Note that the region module does not have any intrinsic knowledge of WCS coordinates, so cannot be directly used to match pointed Chandra observations to specific regions. To convert between the various Chandra detector coordinates, read "ahelp pixlib". Example
slsh> require("region");
slsh> circle_var = regParse("circle(10,10,4)");
slsh> in_circle = regInsideRegion(circle_var, 10, 10);
slsh> print(in_circle);
1
slsh> in_circle = regInsideRegion(circle_var, 5, 5);
slsh> print(in_circle);
0
slsh> circle_area = regArea(circle_var);
slsh> print(circle_area);
50.2655
slsh> print(PI*4*4);
50.2655
slsh> regPrintRegion(circle_var);
1 Circle(10.000000, 10.000000, 4.000000) (Pos: pixel, Size: pixel)BugsSee the bugs page for the region library on the CIAO website for an up-to-date listing of known bugs. |
![]() |
The Chandra X-Ray
Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA. Email: cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2004. All rights reserved. |