unpack_arrays
- sherpa.ui.unpack_arrays(*args)
Create a sherpa data object from arrays of data.
The object returned by
unpack_arrayscan be used in aset_datacall.- Parameters:
args (array_like) – Arrays of data. The order, and number, is determined by the
dstypeparameter, and listed in theload_arraysroutine.dstype – The data set type. The default is
Data1Dand values include:Data1D,Data1DInt,Data2D, andData2DInt. It is expected to be derived fromsherpa.data.BaseData.
- Returns:
The data set object matching the requested
dstype.- Return type:
instance
See also
get_dataReturn the data set by identifier.
load_arraysCreate a data set from array values.
set_dataSet a data set.
unpack_dataCreate a sherpa data object from a file.
Examples
Create a 1D (unbinned) data set from the values in the x and y arrays. Use the returned object to create a data set labelled “oned”:
>>> x = [1, 3, 7, 12] >>> y = [2.3, 3.2, -5.4, 12.1] >>> dat = unpack_arrays(x, y) >>> set_data("oned", dat)
Include statistical errors on the data:
>>> edat = unpack_arrays(x, y, dy)
Create a “binned” 1D data set, giving the low, and high edges of the independent axis (xlo and xhi respectively) and the dependent values for this grid (y):
>>> hdat = unpack_arrays(xlo, xhi, y, Data1DInt)