Fitting source data with multiple backgrounds fails unless all background IDs are assigned models.
When a Chandra grating PHA data set is loaded into Sherpa, and the associated background data is available, it is assigned two separate background IDs, one for each of the 'up' and 'down' background data sets.
sherpa> load_pha("459_heg_m1_bin10.pha") WARNING: systematic errors were not found in file '459_heg_m1_bin10.pha' statistical errors were found in file '459_heg_m1_bin10.pha' but not used; to use them, re-read with use_errors=True read background_up into a dataset from file 459_heg_m1_bin10.pha read background_down into a dataset from file 459_heg_m1_bin10.pha
Currently, if the source data ID and only one of its two background data IDs have been assigned a model, an attempt to fit the source and single background will fail with an error; Sherpa expects to include both backgrounds in the fit. While this safeguards the user against potentially misleading results in the analysis of their data, the fit should continue on in this case and simply issue a warning that only one of the two associated background data sets will be included in the fit.
sherpa> load_arf("459_heg_p1.arf") sherpa> set_model("xspowerlaw.p1") sherpa> set_bkg_model("const1d.c1") sherpa> fit() ModelErr: background model 2 for data set 1 has not been set
In order to fit only one of multiple background data sets assigned to a single source data set, the get_data() command may be used to remove the unneeded background, as shown below:
sherpa> print get_data(1).background_ids [1,2] sherpa> get_data(1).background_ids =  # set background 1 as the only # background to fit.