Last modified: December 2013

URL: https://cxc.cfa.harvard.edu/ciao/ahelp/grpbin.html
Jump to: Description · Examples · Bugs · See Also


AHELP for CIAO 4.15

grpBin

Context: group

Synopsis

Group an array using low and high boundaries.

Syntax

grpBin( PyArray_Type axisArray, PyArray_Type binLowArray, PyArray_Type
binHighArray )
grpBin( PyArray_Type axisArray, PyArray_Type binLowArray, PyArray_Type
binHighArray, PyArray_Type tabStops )

Returns: ( PyArray_Type grouping, PyArray_Type quality )

Description

This function returns the grouping and quality arrays for a set of groups defined by the low (binLowArray) and high (binHighArray) boundaries when applied to the axis values of the data (axisArray). The optional parameter tabStops is an array of those elements that should be ignored.

This function provides the same functionality as the BIN 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

Examples

Example 1

(g,q) = grpBin( x, xl, xh )

This example calculates the grouping and quality arrays that represent the input data (here the contents of the x array) after it has been grouped using the group boundaries specified by the xl and xh arrays.

Example 2

>>> x = numpy.arange(0.5, 6.0, 0.05)
>>> y = 3 + 30 * numpy.exp( - (x-2.0)**2 / 0.1 )
>>> xl = numpy.array([ 0.5, 1.0, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6,
3.0, 3.5 ])
>>> xh = numpy.array([ 1.0, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 3.0,
3.5, 6.0 ])
>>> (g,q) = grpBin( x, xl, xh )
>>> 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 apply an irregular set of group boundaries, specified by the xl and xh arrays.


Bugs

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.

See Also

group
group, grpadaptive, grpadaptivesnr, grpbin, grpbinfile, grpbinwidth, grpgetchanspergroup, grpgetgroupsum, grpgetgrpnum, grpmaxslope, grpminslope, grpnumbins, grpnumcounts, grpsnr