The sherpa.data module
Tools for creating, storing, inspecting, and manipulating data sets.
The main classes for representing data sets are Data1D
,
Data1DInt
, and Data2D
, to handle (x, y), (xlo,
xhi, y), and (x1, x2, y) data, although there are also
morespecialized cases, such as Data1DAsymmetricErrs
. These
classes build on the Data
class, which supports dynamic
filtering of data  to select a subset of the data range  as well as
data access and model evaluation to match the data range.
The Filter
class is used to handle data filtering  that
is, to combine filters such as selecting the range a to b (notice
)
and hiding the range c to d (ignore
). This is used with the
DataSpace1D
and DataSpace2D
classes to handle
evaluating models on different grids to the data, and then converting
back to the data space, whether by rebinnig or interpolation.
Design
The design for the Data
class assumes
the basic fields are the independent axis  which is thought of as a tuple of arrays  and the dependent axis, where normally the independent axis is labelled starting with
x
, and the dependent axisy
.there are a number of related fields  such as the statistical and systematic errors  that follow the same behavior as the independent and dependent axes.
fields are converted to
ndarray
when read in.the independent axes can either be points (
PointAxis
) or integrated (IntegratedAxis
). There is currently no support for an object with a combination of point and integrated axes but it could be added.the independent axis is mediated by a “Data Space” (
DataSpaceND
,DataSpace1D
,IntegratedDataSpace1D
,DataSpace2D
, andIntegratedDataSpace2D
).Data
objects contain thendim
field to indicate the number of independent axes it supports.to support arbitrary dimensions, the data is treated as onedimensional arrays.
Data
objects can be created with no data, but are fixed once an axis  expected to be the independent axis but it need not be  is set (see thesize
attribute). In general the data is assumed to be set when the object is created.there are checks to ensure that the data has the correct size, shape, and potentially data type, but this is not intended to catch all possible problems.
Numpy masked arrays can be used to initialize the dependent variable and the mask is converted to the format of the
mask
attribute of theData
object, taking into account that for Sherpa a value of True indicates a valid quantity, while the opposite is true in numpy.In general, it is expected that any filtering has been applied before the
Data
object is created.the independent axes are marked as readonly, so the only way to change a value is to replace the whole axis, in which case any existing filter will be removed.
Notebook support
The Data objects support the rich display protocol of IPython, with HTML display of a table of information highlighting the relevant data. Examples can be found at [NoteBook].
References
Examples
Create a data set representing the independent axis (x
) and
dependent axis (y
) then filter to select only those values between
500520 and 530700:
>>> d1 = Data1D('example', x, y)
>>> d1.notice(500, 700)
>>> d1.ignore(520, 530)
Classes

Generic, NDimensional data sets. 



1D data set with asymmetric errors 

1D integrated data set 



2D integrated data set 

Store multiple data sets. 

Base class for all data classes. 

Class for representing 1D Data Space. 

Class for representing 2D Data Spaces. 

Class for representing arbitray NDimensional data domains 

A class for representing filters of NDimensional datasets. 

Same as DataSpace1D, but for supporting integrated data sets. 

Same as DataSpace2D, but for supporting integrated data sets. 