- sherpa.astro.ui.set_grouping(id, val=None, bkg_id=None)
Apply a set of grouping flags to a PHA data set.
A group is indicated by a sequence of flag values starting with
-1for all the channels in the group, following 1.
val (array of int) – This must be an array of grouping values of the same length as the data array.
sherpa.utils.err.ArgumentErr – If the data set does not contain a PHA data set.
Fit one or more data sets.
Return the grouping flags for a PHA data set.
Turn on the grouping for a PHA data set.
Adaptively group to a minimum number of counts.
Adaptively group to a minimum signal-to-noise ratio.
Group into a fixed number of bins.
Group into a minimum number of counts per bin.
Group into a minimum signal-to-noise ratio.
Group into a fixed bin width.
Load the grouping scheme from a file and add to a PHA data set.
Apply a set of quality flags to a PHA data set.
Turn off the grouping for a PHA data set.
The function does not follow the normal Python standards for parameter use, since it is designed for easy interactive use. When called with a single un-named argument, it is taken to be the
valparameter. If given two un-named arguments, then they are interpreted as the
The meaning of the grouping column is taken from 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.
“The OGIP Spectral File Format”, https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/spectra/ogip_92_007/ogip_92_007.html
Copy the grouping array from data set 2 into the default data set and ensure it is applied:
>>> grp = get_grouping(2) >>> set_grouping(grp) >>> group()
Copy the grouping from data set “src1” to the source and the first background data set of “src2”:
>>> grp = get_grouping("src1") >>> set_grouping("src2", grp) >>> set_grouping("src2", grp, bkg_id=1) >>> group("src2")