colour.NullInterpolator

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

Bases: object

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...
property absolute_tolerance

Getter and setter property for the absolute tolerance.

Parameters

value (numeric) – Value to set the absolute tolerance with.

Returns

Absolute tolerance.

Return type

numeric

property default

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

Parameters

value (numeric) – Value to set the default value with.

Returns

Default value.

Return type

numeric

property relative_tolerance

Getter and setter property for the relative tolerance.

Parameters

value (numeric) – Value to set the relative tolerance with.

Returns

Relative tolerance.

Return type

numeric

property x

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

Parameters

value (array_like) – Value to set the independent \(x\) variable with.

Returns

Independent \(x\) variable.

Return type

array_like

property y

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

Parameters

value (array_like) – Value to set the dependent and already known \(y\) variable with.

Returns

Dependent and already known \(y\) variable.

Return type

array_like