CurveUncertain

Definition of CurveUncertain.

class CurveUncertain(x, y, yerr=None, xerr=None)

Bases: swprepost.curve.Curve

Curve object with arbitrary uncertainty in terms of x and y.

Variables:
  • _isyerr (_isxerr,) – Flags to indicate if x and y error has been provided.
  • _yerr (_xerr,) – Vector defining the error in x and y respectively.
__init__(x, y, yerr=None, xerr=None)

Initialize a new CurveUncertain object.

Parameters:
  • x, y (iterable) – x and y coordinate which define the curves central trend.
  • yerr, xerr (iterable, optional) – Relative error in the y- and x-direction respectively, default is None indicating no error is defined.
Returns:

CurveUncertain – Initialized CurveUncertain object.

Raises:

IndexError – If size of x, y, yerr (if provided) and xerr (if provided) are inconsistent.

resample(xx, inplace=False, interp1d_kwargs=None, res_fxn=None)

Resample curve and its associated uncertainty.

Parameters:
  • xx (ndarray) – Desired x values after resampling.
  • inplace (bool, optional) – Indicates whether resampling is performed inplace and the objects attributes are updated or if calculated values are returned.
  • interp1d_settings (dict, optional) – Settings for use with the interp1d function from scipy. See documentation here for details.
  • res_fxn (tuple of functions, optional) – Functions to define the resampling of the central x and y values, xerr and yerr respectively, default is None indicating default resampling function is used.
Returns:

None or Tuple – If inplace=True, returns None, instead update attributes _x, _y, _xerr, and _yerr if they exist. If inplace=False, returns Tuple of the form (xx, yy, yyerr, xxerr). If xerr and/or yerr are not defined they are not resampled and omitted from the return statement.