set_data
- sherpa.astro.ui.set_data(id, data=None) None
Set a data set.
- Parameters:
id (int or str, optional) – The data set. If not given then the default identifier is used, as returned by
get_default_id.data (instance of a sherpa.Data.Data-derived class) – The new contents of the data set. This can be copied from an existing data set or loaded in from a file (e.g.
unpack_data).
See also
copy_dataCopy a data set to a new identifier.
delete_dataDelete a data set by identifier.
get_dataReturn the data set by identifier.
load_dataCreate a data set from a file.
unpack_dataRead in a file.
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
dataparameter. If given two un-named arguments, then they are interpreted as theidanddataparameters, respectively.Examples
>>> d1 = get_data(2) >>> set_data(d1)
Copy the background data from the default data set into a new data set identified as ‘bkg’:
>>> set_data('bkg', get_bkg())