get_grouping

sherpa.astro.ui.get_grouping(id=None, bkg_id=None)

Return the grouping array for a PHA data set.

Parameters:
  • id (int or str, optional) – 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 (int or str, optional) – Set if the grouping flags should be taken from a background associated with the data set.
Returns:

grouping – A value of 1 indicates the start of a new group, and -1 indicates that the bin is part of the group.

Return type:

array or None

Raises:

sherpa.utils.err.ArgumentErr – If the data set does not contain a PHA data set.

See also

fit()
Fit one or more data sets.
get_quality()
Return the quality array for a PHA data set.
ignore_bad()
Exclude channels marked as bad in a PHA data set.
set_grouping()
Apply a set of grouping flags to a PHA data set.

Examples

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)