Skip to the navigation links
Last modified: December 2009

AHELP for CIAO 4.2


Context: modules


The S-Lang interface to the CXC region library


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:


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".


slsh> require("region");
slsh> circle_var = regParse("circle(10,10,4)");
slsh> in_circle = regInsideRegion(circle_var, 10, 10);
slsh> print(in_circle);
slsh> in_circle = regInsideRegion(circle_var, 5, 5);
slsh> print(in_circle);
slsh> circle_area = regArea(circle_var);
slsh> print(circle_area);
slsh> print(PI*4*4);
slsh> regPrintRegion(circle_var);
1 Circle(10.000000, 10.000000, 4.000000) (Pos: pixel, Size: pixel)


See the bugs page for the region library on the CIAO website for an up-to-date listing of known bugs.

See Also

regarea, regextent, reginsideregion, regparse, regprintregion, regregionstring

Last modified: December 2009