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/grpgetgrpnum.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 grpGetGrpNum Context: group

Synopsis

Calculate the group number for each element in the array.

Syntax

Integer_Type grpnum = grpGetGrpNum( Array_Type grouping )

Description

This function calculates which group each element in the input array belongs to, where the groups are numbered from 1. The return value is an array whose length equals that of the input data (the grouping argument) and each element within a group contains the same value. As an example,

grpGetGrpNum( [1,-1,1,-1,1,1] )

will return the array

[1,1,2,2,3,4]

since the groups consist of the first two elements, then the next two elements, with the last two elements being un-grouped.

Example 1

chips> igrp = grpGetGrpNum( grp )

The igrp array will contain the group number for each element of the input array, for the grouping scheme stored in the grp array, and has the same size as the grp array.

Example 2

chips> x = [0.5:6.0:0.05]
chips> y = 3 + 30 * exp( - (x-2.0)^2 / 0.1 )
chips> ( grp, qual ) = grpNumCounts( y, 15 )
chips> yavg = grpGetGroupSum( y, grp ) / grpGetChansPerGroup( grp )
chips> igrp = grpGetGrpNum( grp )
chips> i = where( grp == 1 and qual == 0 )
chips> split 2
chips> curve( x, y )
chips> d 2
chips> curve( igrp[i], yavg[i] )

Here we take the function

y = 3 + 30 * exp( -(x-2)^2 / 0.1 )

and group it by 15 counts per group. Two plots are created: the upper plot is the original dataset and the lower plot is the grouped data (averaged by the width of each group) plotted as a function of the group number.

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.