The XYDataSet Object

class qexpy.data.XYDataSet(*args, **kwargs)[source]

A pair of ExperimentalValueArray objects

QExPy is capable of multiple ways of data handling. One typical case in experimental data analysis is for a pair of data sets, which is usually plotted or fitted with a curve.

Parameters
  • xdata (List|np.ndarray) – an array of values for x-data

  • ydata (List|np.ndarray) – an array of values for y-data

Keyword Arguments
  • xerr (Real|List) – the uncertainty on x data

  • yerr (Real|List) – the uncertainty on y data

  • xunit (str) – the unit of the x data set

  • yunit (str) – the unit of the y data set

  • xname (str) – the name of the x data set

  • yname (str) – the name of the y data set

Examples

>>> import qexpy as q
>>> a = q.XYDataSet(xdata=[0, 1, 2, 3, 4], xerr=0.5, xunit="m", xname="length",
>>>                 ydata=[3, 4, 5, 6, 7], yerr=[0.1,0.2,0.3,0.4,0.5],
>>>                 yunit="kg", yname="weight")
>>> a.xvalues
array([0, 1, 2, 3, 4])
>>> a.xerr
array([0.5, 0.5, 0.5, 0.5, 0.5])
>>> a.yerr
array([0.1, 0.2, 0.3, 0.4, 0.5])
>>> a.xdata
ExperimentalValueArray([MeasuredValue(0.0 +/- 0.5),
                MeasuredValue(1.0 +/- 0.5),
                MeasuredValue(2.0 +/- 0.5),
                MeasuredValue(3.0 +/- 0.5),
                MeasuredValue(4.0 +/- 0.5)], dtype=object)

Properties

XYDataSet.xvalues

The values of the x data set

Type

np.ndarray

XYDataSet.xerr

The errors of the x data set

Type

np.ndarray

XYDataSet.yvalues

The values of the y data set

Type

np.ndarray

XYDataSet.yerr

The errors of the x data set

Type

np.ndarray

XYDataSet.xname

Name of the xdata set

Type

str

XYDataSet.yname

Name of the ydata set

Type

str

XYDataSet.xunit

Unit of the xdata set

Type

str

XYDataSet.yunit

Unit of the ydata set

Type

str

Methods

XYDataSet.fit(model, **kwargs)[source]

Fits the current dataset to a model

See also

The fit function in the fitting module of QExPy