zooc.dsp.surface_nearest_interpolator

2D-surface with interpolation and extrapolation using simple nearest neighbor interpolation.

class zooc.dsp.surface_nearest_interpolator.SurfaceNearestInterpolator(**kwargs)

Bases: object

Simple Nearest interpolator without numpy dependency.

Deprecated since version 1.0: This module is obsolete.

For now, the module still uses numpy.

Nearest interpolation without numpy.

Parameters:
static nearest(dict_v, key_value)

Search the dict value of which key is nearest to given key.

When the target key is exactly between the two keys, select the larger one.

Parameters:
  • dict_v (dict[float, T]) – Dict with float keys and any value. Keys must be sorted in ascending order.

  • key_value (float) – Target key value to search.

Returns:

Value of the nearest key to target.

Return type:

T

property dict_x: dict[float, dict[float, float]]

Create a dictionary of x-coordinates with z-coordinates as values.

Returns:

Dictionary with x-coordinates as keys and z-coordinates as values.