About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/grpbin.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 grpBin Context: group

Synopsis

Group an array using low and high boundaries.

Syntax

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

Returns: ( Array_Type grouping, Array_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.

Example 1

chips> (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

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

Bugs

See the bugs page for the group library on the CIAO website for an up-to-date listing of known bugs.

Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.