|AHELP for CIAO 4.9||
Adaptively group an array by signal to noise.
grpAdaptiveSnr( PyArray_Type countsArray, Double_Type snr ) grpAdaptiveSnr( PyArray_Type countsArray, Double_Type snr, Integer_Type maxLength ) grpAdaptiveSnr( PyArray_Type countsArray, Double_Type snr, Integer_Type maxLength, Array_Type tabStops ) grpAdaptiveSnr( PyArray_Type countsArray, Double_Type snr, Integer_Type maxLength, PyArray_Type tabStops, PyArray_Type errorCol ) Returns: ( PyArray_Type grouping, PyArray_Type quality )
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 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 Python program, it must be loaded using the Python import function:
from group import *, or import group
>>> (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.
>>> x = numpy.arange(0.5, 6.0, 0.05) >>> y = 3 + 30 * numpy.exp( - (x-2.0)**2 / 0.1 ) >>> (g,q) = grpAdaptiveSnr( y, 5 ); >>> ysum = grpGetGroupSum( y, g ); >>> nchan = grpGetChansPerGroup( g ); >>> i = numpy.where( g == 1 ) >>> yavg = ysum[i] / nchan[i];
Here we take the function
y = 3 + 30 * numpy.exp( - (x-2.0)**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.
To see more examples of optional parameters and keywords in the parameter list, please see ahelp grpadaptive
See the bugs page for the group library on the CIAO website for an up-to-date listing of known bugs.
Refer to the CIAO bug pages for an up-to-date listing of known issues.