| AHELP for CIAO 4.2 | grpMinSlope |
Context: group |
Synopsis
Group an array so that its absolute gradient is below a user-defined limit.
Syntax
grpMinSlope( Array_Type axisArray, Array_Type dataArray, Double_Type slope ) grpMinSlope( Array_Type axisArray, Array_Type dataArray, Double_Type slope, Integer_Type maxLength ) grpMinSlope( Array_Type axisArray, Array_Type dataArray, Double_Type slope, Integer_Type maxLength, Array_Type tabStops ) Returns: ( Array_Type grouping, Array_Type quality )
Description
In this routine, groups are created when the absolute value of the slope of the input data (the axisArray and binArray arguments) is more than the threshold value (the slope argument). The slope is calculated as
delta[dataArray] / delta[axisArray]
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 MIN_SLOPE 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) = grpMinSlope( x, y, 2 );
This example calculates the grouping and quality arrays that represent the input data (here the contents of the x and y arrays) in groups in which the slope is less than 2.
Example 2
slsh> x = [1:10]; slsh> y = [1, 2, 1, 10, 1, 2, 1, 2, 1, 2 ]; slsh> (g,q) = grpMinSlope( x, y, 2 ); slsh> ysum = grpGetGroupSum( y, g ); slsh> nchan = grpGetChansPerGroup( g ); slsh> i = where( g == 1 ); slsh> yavg = ysum[i] / nchan[i];
Here we take a dataset that is essentially flat, except for one point, and group it so that the resulting groups differ by a slope of no more than 2.
Bugs
See the bugs page for the group library on the CIAO website for an up-to-date listing of known bugs.
![[CIAO Logo]](../imgs/ciao_logo_navbar.gif)