Last modified: December 2023

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/set_grouping.html
AHELP for CIAO 4.16 Sherpa

set_grouping

Context: data

Synopsis

Apply a set of grouping flags to a PHA data set.

Syntax

set_grouping(id, val=None, bkg_id=None)

id - int or str, optional
val - array of int
bkg_id - int or str, optional

Description

A group is indicated by a sequence of flag values starting with 1 and then -1 for all the channels in the group, following the OGIP standard.


Examples

Example 1

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()

Example 2

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")

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` .
val This must be an array of grouping values of the same length as the data array.
bkg_id Set to group the background associated with the data set.

Notes

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 `val` parameter. If given two un-named arguments, then they are interpreted as the `id` and `val` parameters, respectively.

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

Changes in CIAO

Changed in CIAO 4.16

The filter is now re-calculated to match the new grouping scheme. If the data is already grouped then the filter will be displayed, so it can be reviewed to see if it remains sensible (as repeated changes to the grouping column can increase the number of noticed channels).


Bugs

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

See Also

confidence
set_conf_opt, set_covar_opt, set_proj_opt
data
get_grouping, group, group_adapt, group_adapt_snr, group_bins, group_counts, group_snr, group_width, load_grouping, set_areascal, set_arf, set_backscal, set_bkg, set_coord, set_counts, set_data, set_dep, set_exposure, set_quality, set_rmf, set_staterror, set_syserror, ungroup
filtering
set_filter
methods
set_iter_method, set_iter_method_opt, set_method, set_method_opt
modeling
get_par, get_xsabund, get_xscosmo, get_xsxsect, get_xsxset, set_bkg_model, set_bkg_source, set_full_model, set_model, set_par, set_pileup_model, set_source, set_xsabund, set_xscosmo, set_xsxsect, set_xsxset
saving
save_grouping
statistics
set_prior, set_sampler, set_sampler_opt, set_stat
utilities
set_analysis, set_default_id
visualization
image_setregion