| AHELP for CIAO 4.2 | region |
Context: modules |
Synopsis
The S-Lang interface to the CXC region library
Description
The 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 module
The following functions are provided by the module; use "ahelp <function>" to get a detailed description of a function:
| Return type | Function name | Arguments |
|---|---|---|
| Region_Type | regParse | String_Type |
| Short_Type | regInsideRegion | Region_Type, Double_Type, Double_Type |
| Array_Type | regInsideRegion | Region_Type, Array_Type, Array_Type |
| Double_Type | regArea | Region_Type |
| Double_Type | regArea | Region_Type, Double_Type, Double_Type, Double_Type, Double_Type, Double_Type |
| Double_Type, Double_Type, Double_Type, Double_Type | regExtent | Region_Type |
| String_Type | regRegionString | Region_Type |
| none | regPrintRegion | Region_Type |
Using Region_Type variables
The 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)Bugs
See the bugs page for the region library on the CIAO website for an up-to-date listing of known bugs.
See Also
- region
- regarea, regextent, reginsideregion, regparse, regprintregion, regregionstring
![[CIAO Logo]](../imgs/ciao_logo_navbar.gif)