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

Synopsis

Group an array so that its absolute gradient is below a user-defined limit.

Syntax

grpMinSlope( Array_Type axisArray, Array_Type dataArray, Double_Type
slope )
grpMinSlope( Array_Type axisArray, Array_Type dataArray, Double_Type
slope, Integer_Type maxLength )
grpMinSlope( Array_Type axisArray, Array_Type dataArray, Double_Type
slope, Integer_Type maxLength, Array_Type tabStops )

Returns: ( Array_Type grouping, Array_Type quality )

Description

In this routine, groups are created when the absolute value of the slope of the input data (the axisArray and binArray arguments) is more than the threshold value (the slope argument). The slope is calculated as

delta[dataArray] / delta[axisArray]

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 MIN_SLOPE option of dmgroup.

Example 1

chips> (g,q) = grpMinSlope( x, y, 2 )

This example calculates the grouping and quality arrays that represent the input data (here the contents of the x and y arrays) in groups in which the slope is less than 2.

Example 2

chips> x = [1:10]
chips> y = [1, 2, 1, 10, 1, 2, 1, 2, 1, 2 ]
chips> (g,q) = grpMinSlope( x, y, 2 )
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 a dataset that is essentially flat, except for one point, and group it so that the resulting groups differ by a slope of no more than 2. 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.