Skip to the navigation links
Last modified: December 2009

URL: http://cxc-newtest.cfa.harvard.edu/ciao4.2/grpbin.html
AHELP for CIAO 4.2

grpBin

Context: group

Synopsis

Group an array using low and high boundaries.

Syntax

grpBin( Array_Type axisArray, Array_Type binLowArray, Array_Type
binHighArray )
grpBin( Array_Type axisArray, Array_Type binLowArray, Array_Type
binHighArray, Array_Type tabStops )

Returns: ( Array_Type grouping, Array_Type quality )

Description

This function returns the grouping and quality arrays for a set of groups defined by the low (binLowArray) and high (binHighArray) boundaries when applied to the axis values of the data (axisArray). The optional parameter tabStops is an array of those elements that should be ignored. The tabStops array must be the same length as the channels array. A value of 0 means no tab; a value of 1 means that there is a tab stop.

This function provides the same functionality as the BIN option of dmgroup.

The group 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("group");

Example 1

slsh> (g,q) = grpBin( x, xl, xh );

This example calculates the grouping and quality arrays that represent the input data (here the contents of the x array) after it has been grouped using the group boundaries specified by the xl and xh arrays.

Example 2

slsh> x = [0.5:6.0:0.05];
slsh> y = 3 + 30 * exp( - (x-2.0)^2 / 0.1 );
slsh> xl = [ 0.5, 1.0, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 3.0, 3.5 ];
slsh> xh = [ 1.0, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 3.0, 3.5, 6.0 ];
slsh> (g,q) = grpBin( x, xl, xh );
slsh> ysum = grpGetGroupSum( y, g );
slsh> nchan = grpGetChansPerGroup( g );
slsh> i = where( g == 1 );
slsh> yavg = ysum[i] / nchan[i];

Here we take the function

y = 3 + 30 * exp( -(x-2)^2 / 0.1 )

and apply an irregular set of group boundaries, specified by the xl and xh arrays.

Bugs

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

See Also

group
grpadaptive, grpadaptivesnr, grpbin, grpbinfile, grpbinwidth, grpgetchanspergroup, grpgetgroupsum, grpgetgrpnum, grpmaxslope, grpminslope, grpnumbins, grpnumcounts, grpsnr
modules
group_slang

Last modified: December 2009