colour.NullInterpolator

class colour.NullInterpolator(x, y, absolute_tolerance=1e-06, relative_tolerance=1e-06, default=nan, dtype=<class 'numpy.float64'>)[source]

Performs 1-D function null interpolation, i.e. a call within given tolerances will return existing \(y\) variable values and default if outside tolerances.

Parameters
  • x (ndarray) – Independent \(x\) variable values corresponding with \(y\) variable.

  • y (ndarray) – Dependent and already known \(y\) variable values to interpolate.

  • absolute_tolerance (numeric, optional) – Absolute tolerance.

  • relative_tolerance (numeric, optional) – Relative tolerance.

  • default (numeric, optional) – Default value for interpolation outside tolerances.

  • dtype (type) – Data type used for internal conversions.

x
y
relative_tolerance
absolute_tolerance
default
__call__()[source]

Examples

>>> y = np.array([5.9200, 9.3700, 10.8135, 4.5100,
...               69.5900, 27.8007, 86.0500])
>>> x = np.arange(len(y))
>>> f = NullInterpolator(x, y)
>>> f(0.5)
nan
>>> f(1.0)  
9.3699999...
>>> f = NullInterpolator(x, y, absolute_tolerance=0.01)
>>> f(1.01)  
9.3699999...
__init__(x, y, absolute_tolerance=1e-06, relative_tolerance=1e-06, default=nan, dtype=<class 'numpy.float64'>)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(x, y[, absolute_tolerance, …])

Initialize self.

Attributes

absolute_tolerance

Getter and setter property for the absolute tolerance.

default

Getter and setter property for the default value for call outside tolerances.

relative_tolerance

Getter and setter property for the relative tolerance.

x

Getter and setter property for the independent \(x\) variable.

y

Getter and setter property for the dependent and already known \(y\) variable.