load_arrays

sherpa.ui.load_arrays(id, *args)

Create a data set from array values.

Parameters:
  • id (int or str) – The identifier for the data set to use.
  • *args – Two or more arrays, followed by the type of data set to create.

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.
set_data()
Set a data set.
unpack_arrays()
Create a sherpa data object from arrays of data.

Notes

The data type identifier, which defaults to Data1D, determines the number, and order, of the required inputs.

Identifier Required Fields Optional Fields
Data1D x, y statistical error, systematic error
Data1DInt xlo, xhi, y statistical error, systematic error
Data2D x0, x1, y shape, statistical error, systematic error
Data2DInt x0lo, x1lo, x0hi, x1hi, y shape, statistical error, systematic error

The shape argument should be a tuple giving the size of the data (ny,nx).

Examples

Create a 1D data set with three points:

>>> load_arrays(1, [10, 12, 15], [4.2, 12.1, 8.4])

Create a 1D data set, with the identifier ‘prof’, from the arrays x (independent axis), y (dependent axis), and dy (statistical error on the dependent axis):

>>> load_arrays('prof', x, y, dy)

Explicitly define the type of the data set:

>>> load_arrays('prof', x, y, dy, Data1D)

Data set 1 is a histogram, where the bins cover the range 1-3, 3-5, and 5-7 with values 4, 5, and 9 respectively.

>>> load_arrays(1, [1,3,5], [3,5,7], [4,5,9], Data1DInt)