Last modified: December 2020

AHELP for CIAO 4.13 Sherpa v1


Context: data


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


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

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


A quality value of 0 indicates a good channel, otherwise (values >=1) the channel is considered bad and can be excluded using the `ignore_bad` function, as discussed in [1] .


Example 1

Copy the quality array from data set 2 into the default data set, and then ensure that any 'bad' channels are ignored:

>>> qual = get_data(2).quality
>>> set_quality(qual)
>>> ignore_bad()

Example 2

Copy the quality array from data set "src1" to the source and background data sets of "src2":

>>> qual = get_data("src1").quality
>>> set_quality("src2", qual)
>>> set_quality("src2", qual, bkg_id=1)


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 quality values of the same length as the data array.
bkg_id Set if the quality values should be associated with the background associated with the 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 `val` parameter. If given two un-named arguments, then they are interpreted as the `id` and `val` parameters, respectively.

The meaning of the quality column is taken from [1] , which says that 0 indicates a "good" channel, 1 and 2 are for channels that are identified as "bad" or "dubious" (respectively) by software, 5 indicates a "bad" channel set by the user, and values of 3 or 4 are not used.



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

See Also

set_conf_opt, set_covar_opt, set_proj_opt
copy_data, dataspace1d, dataspace2d, datastack, delete_data, fake, get_axes, get_bkg_chisqr_plot, get_bkg_delchi_plot, get_bkg_fit_plot, get_bkg_model_plot, get_bkg_plot, get_bkg_ratio_plot, get_bkg_resid_plot, get_bkg_source_plot, get_counts, get_data, get_data_contour, get_data_contour_prefs, get_data_image, get_data_plot, get_data_plot_prefs, get_dep, get_dims, get_error, get_quality, get_specresp, get_staterror, get_syserror, group, group_adapt, group_adapt_snr, group_bins, group_counts, group_snr, group_width, load_ascii, load_data, load_grouping, load_quality, set_areascal, set_arf, set_backscal, set_bkg, set_coord, set_counts, set_data, set_dep, set_exposure, set_grouping, set_rmf, set_staterror, set_syserror, ungroup, unpack_ascii, unpack_data
get_filter, ignore_bad, load_filter, set_filter
get_default_id, list_data_ids, list_response_ids
set_iter_method, set_iter_method_opt, set_method, set_method_opt
clean, 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
plot_data, set_xlinear, set_xlog, set_ylinear, set_ylog
save_error, save_filter, save_grouping, save_quality, save_staterror, save_syserror
set_prior, set_sampler, set_sampler_opt, set_stat
calc_data_sum, calc_data_sum2d, calc_ftest, calc_kcorr, calc_mlr, calc_model_sum2d, calc_source_sum2d, get_rate, set_analysis, set_default_id
contour, contour_data, contour_ratio, histogram1d, histogram2d, image_data, image_setregion, rebin