    Return the grouping array for a PHA data set.

get_grouping(id=None, bkg_id=None)
id - int or str, optional
bkg_id - int or str, optional

The function returns the grouping value for each channel in the PHA data set.

Copy the grouping array from the default data set to data set 2:

>>> grp1 = get_grouping() >>> set_grouping(2, grp1)

Return the grouping array of the background component labelled 2 for the 'histate' data set:

>>> grp = get_grouping('histate', bkg_id=2)

PARAMETERS

The parameters for this function are:

Parameter
Definition
id
The identifier for the data set to use. If not given then the default identifier is used, as returned by

`get_default_id` .
bkg_id
Set if the grouping flags should be taken from a background associated with the data set.

The return value from this function is:

grouping -- A value of 1 indicates the start of a new group, and -1

indicates that the bin is part of the group. This array is not filtered - that is, there is one element for each channel in the PHA data set. Changes to the elements of this array will change the values in the dataset (it is a reference to the values used to define the quality, not a copy).

Notes

The meaning of the grouping column is taken from the OGIP standard which says that +1 indicates the start of a bin, -1 if the channel is part of group, and 0 if the data grouping is undefined for all channels.

References

K. A. Arnaud, I. M. George & A. F. Tennant, "The OGIP Spectral File Format"

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

December 2023