|AHELP for CIAO 4.2||
Group an array by the number of counts per group using an adaptive scheme.
grpAdaptive( Array_Type countsArray, Integer_Type numCounts ) grpAdaptive( Array_Type countsArray, Integer_Type numCounts, Integer_Type maxLength ) grpAdaptive(Array_Type countsArray, Integer_Type minCounts, Integer_Type maxLength, Array_Type tabStops ) Returns: ( Array_Type grouping, Array_Type quality )
This function returns the grouping and quality arrays that represent the input data (countsArray) after it has been adaptively grouped so that each group contains at least numCounts counts. The optional parameters maxLength and tabStops represent the maximum number of elements that can be combined 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.
This function provides the same functionality as the ADAPTIVE 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:
slsh> (g,q) = grpAdaptive( y, 20 );
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 at least 20 counts per group.
slsh> x = [0.5:6.0:0.05]; slsh> y = 3 + 30 * exp( - (x-2.0)^2 / 0.1 ); slsh> (g,q) = grpAdaptive( y, 15 ); 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 by 15 counts per group.
Unlike the simple grouping done by grpNumCounts() - 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.
See the bugs page for the group library on the CIAO website for an up-to-date listing of known bugs.