    Create a data set from array values.

load_arrays(id, *args)
id - int or str

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)

Create an image data set:

>>> ivals = np.arange(12) >>> y, x = np.mgrid[0:3, 0:4] >>> x = x.flatten() >>> y = y.flatten() >>> load_arrays('img', x, y, ivals, (3, 4), DataIMG)

PARAMETERS

The parameters for this function are:

Parameter
Definition
id
The identifier for the data set to use.
*args
Two or more arrays, followed by the type of data set to create.

Warning

Sherpa currently does not support numpy masked arrays. Use the set_filter function and note that it follows a different convention by default (a positive value or True for a "bad" channel, 0 or False for a good channel).

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
DataPHA
channel, counts
statistical error, systematic error, bin_lo, bin_hi, grouping, quality
DataIMG
x0, x1, y
shape, statistical error, systematic error

The shape argument should be a tuple giving the size of the data (ny,nx) , and for the dataimg case the arrays are 1D, not 2D.

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

December 2023