Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: December 2013

URL: http://cxc.harvard.edu/ciao/ahelp/grpmaxslope.html
Jump to: Description · Examples · Bugs · See Also


AHELP for CIAO 4.9

grpMaxSlope

Context: group

Synopsis

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

Syntax

grpMaxSlope( PyArray_Type axisArray, PyArray_Type dataArray,
Double_Type slope )
grpMaxSlope( PyArray_Type axisArray, PyArray_Type dataArray,
Double_Type slope, Integer_Type maxLength )
grpMaxSlope( PyArray_Type axisArray, PyArray_Type dataArray,
Double_Type slope, Integer_Type maxLength, PyArray_Type tabStops )

Returns: ( PyArray_Type grouping, PyArray_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 less 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 MAX_SLOPE 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

In addition, in order to create arrays, the Python module numpy must be loaded using the Python import function:

  import numpy

Example 1

>>> (g,q) = grpMaxSlope( 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 more than 2.

Example 2

>>> x = numpy.arange(1,11)
>>> y = numpy.array([1, 2, 10, 1, 1, 20, 40, 80, 20, 2 ])
>>> (g,q) = grpMaxSlope( x, y, 2 )
>>> ysum = grpGetGroupSum( y, g )
>>> nchan = grpGetChansPerGroup( g )
>>> i = numpy.where( g == 1 )
>>> yavg = ysum[i] / nchan[i]

Here we take a dataset and group it so that the resulting groups differ by a slope at least 2.

Example 3

To see more examples of optional parameters and keywords in the parameter list, please see ahelp grpadaptive

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

Last modified: December 2013
Smithsonian Institute Smithsonian Institute

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