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_data
Copy a data set to a new identifier.
delete_data
Delete a data set by identifier.
get_data
Return the data set by identifier.
load_data
Create a data set from a file.
unpack_data
Read 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
data
parameter. If given two un-named arguments, then they are interpreted as theid
anddata
parameters, 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())