Group an array by the number of counts per group.
grpNumCounts( Array_Type countsArray, Double_Type numCounts )
grpNumCounts( Array_Type countsArray, Double_Type numCounts,
Integer_Type maxLength )
grpNumCounts( Array_Type countsArray, Double_Type numCounts,
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 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.
This function provides the same functionality
as the NUM_CTS option of dmgroup.
chips> (g,q) = grpNumCounts( 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 grouped to at least 20 counts per
group.
chips> x = [0.5:6.0:0.05]
chips> y = 3 + 30 * exp( - (x-2.0)^2 / 0.1 )
chips> (g,q) = grpNumCounts( y, 15 )
chips> ysum = grpGetGroupSum( y, g )
chips> nchan = grpGetChansPerGroup( g )
chips> i = where( g == 1 )
chips> yavg = ysum[i] / nchan[i]
chips> curve( x, y )
chips> simpleline
chips> curve( x[i], yavg )
chips> symbol square
chips> symbol red
Here we take the function
y = 3 + 30 * exp( -(x-2)^2 / 0.1 )
and group it by 15 counts per group.
The plot shows the original data (the solid line and the
crosses) and the grouped data (as the
red squares); the latter has been normalised by the
width of each group and is displayed at the left-edge
of each group.
In this example we have ignored the quality array; the
last group (corresponding to the last 3 elements of
the x and y arrays) has a quality value of 2, indicating
that the total number of counts for the group
(9) is less than 15. The code below identifies this
element as the solid-yellow circle.
chips> i = where( g == 1 )
chips> j = where( q[i] != 0 )
chips> curve( x[i][j], yavg[j] )
chips> symbol bigpoint
chips> symbol yellow
- group
-
grpadaptive,
grpadaptivesnr,
grpbin,
grpbinfile,
grpbinwidth,
grpgetchanspergroup,
grpgetgroupsum,
grpgetgrpnum,
grpmaxslope,
grpminslope,
grpnumbins,
grpnumcounts,
grpsnr
- modules
-
group
|