get_grouping
- sherpa.astro.ui.get_grouping(id: IdType | None = None, bkg_id: IdType | None = None)
Return the grouping array for a PHA data set.
The function returns the grouping value for each channel in the PHA data set.
- Parameters:
- Returns:
- grouping
ndarrayorNone A value of
1indicates the start of a new group, and-1indicates 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).
- grouping
- Raises:
sherpa.utils.err.ArgumentErrIf the data set does not contain a PHA data set.
See also
fitFit one or more data sets.
get_qualityReturn the quality array for a PHA data set.
ignore_badExclude channels marked as bad in a PHA data set.
load_groupingLoad the grouping scheme from a file and add to a PHA data set.
set_groupingApply a set of grouping flags to a PHA data set.
Notes
The meaning of the grouping column is taken from the OGIP standard [1], 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
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)