Skip to the navigation links
Last modified: December 2009

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

grpAdaptiveSnr

Context: group

Synopsis

Adaptively group an array by signal to noise.

Syntax

grpAdaptiveSnr( Array_Type countsArray, Double_Type snr )
grpAdaptiveSnr( Array_Type countsArray, Double_Type snr, Integer_Type
maxLength )
grpAdaptiveSnr( Array_Type countsArray, Double_Type snr, Integer_Type
maxLength, Array_Type tabStops )
grpAdaptiveSnr( Array_Type countsArray, Double_Type snr, Integer_Type
maxLength, Array_Type tabStops, Array_Type errorCol )

Returns: ( Array_Type grouping, Array_Type quality )

Description

This function returns the grouping and quality arrays that represent the input data (countsArray) after it has been adaptively grouped so that the signal to noise of each group is at least equal to the snr parameter. The optional parameters maxLength and tabStops represent the maximum number of elements that can be combined into a group and an array representing those elements that should be ignored, respectively. 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.

The errorCol array gives the error for each element of the original array: if it is not supplied then the error is taken to be the square root of the element value.

This function provides the same functionality as the ADAPTIVE_SNR 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) = grpAdaptiveSnr( y, 5 );

This example calculates the grouping and quality arrays that represent the input data (here the contents of the y array) after it has been adaptively grouped to have a signal to noise of at least 5 per group.

Example 2

slsh> x = [0.5:6.0:0.05];
slsh> y = 3 + 30 * exp( - (x-2.0)^2 / 0.1 );
slsh> (g,q) = grpAdaptiveSnr( y, 5 );
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 adaptively group it so that the signal-to-noise of the group is at least 5.

Unlike the simple grouping done by grpSnr() - where only the end element(s) may have non-zero quality values - the adaptive grouping scheme can create groups with non-zero quality anywhere in the array.

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