read_arrays

sherpa.io.read_arrays(*args)[source] [edit on github]

Create a data object from arrays.

Parameters
  • col1 (array_like) – The data columns.

  • coln (...) – The data columns.

  • dstype (optional) – The data type to create. It must be a subclass of sherpa.data.BaseData and defaults to sherpa.data.Data1D

Returns

The data object (created by calling the dstype constructor with the filename and then the data columns from the file).

Return type

data

Raises

sherpa.utils.err.IOErr – Raised if no arrays are sent in.

Examples

Create a 1D data object from the x and y arrays:

>>> dat = read_arrays(x, y)

Include a statistical error column:

>>> dat = read_arrays(x, y, dy)

Create an integrated (i.e. histogram) data set:

>>> dat = read_arrays(xlo, xhi, y, dstype=sherpa.data.Data1DInt)