A robot calibration report may turn scattered bench measurements into a smooth color map. The edge of that map needs an explicit meaning. If the input sites occupy only one part of the plotting rectangle, some grid cells may lie outside the convex hull of the measurements. A nearby value can still be useful for a display, but it answers a different question from a linear estimate supported by the surrounding sample sites. A reader should be able to tell which kind of value is being shown.
Use a triangle that fits inside the plot
The example below uses three synthetic bench coordinates. The two spatial coordinates share one arbitrary length unit and the values represent an illustrative offset in millimeters. This fixture ran with SciPy 1.18.1 and NumPy 2.5.2. It checks the data pipeline, with no dependency on a particular robot model, calibration procedure, or physical measurement. All three input sites are visible in the plotting rectangle, but the triangle between them covers only part of that rectangle.
The query at (0.5, 0.5) lies within the triangle. Its linear estimate is 1.5 mm. The query at (1.7, 1.4) lies beyond the diagonal joining the sites at (2, 0) and (0, 2). Both coordinates are within the individual axis ranges of the observations. A validator that checks only that x and y lie between their separate minima and maxima will therefore pass the outer query. The shape of the sampled region matters.
import numpy as np
from scipy.interpolate import griddata
from scipy.spatial import Delaunay
points = np.array([[0., 0.], [2., 0.], [0., 2.]])
offset = np.array([0., 4., 2.])
query = np.array([[0.5, 0.5], [1.7, 1.4]])
inside = Delaunay(points).find_simplex(query) >= 0
linear = griddata(points, offset, query, method='linear')
nearest = griddata(points, offset, query, method='nearest')
sentinel = griddata(points, offset, query, method='linear',
fill_value=-99.)
assert inside.tolist() == [True, False]
assert np.isclose(linear[0], 1.5) and np.isnan(linear[1])
assert np.allclose(nearest, [0., 4.])
assert np.allclose(sentinel, [1.5, -99.])
assert np.isfinite(nearest[1]) and not inside[1]
accepted = np.where(inside & np.isfinite(linear), linear, np.nan)
assert np.isclose(accepted[0], 1.5) and np.isnan(accepted[1])
Keep geometric support separate from the value
In SciPy, griddata with the linear method returns the fill value for locations outside the convex hull. The default is NaN. Setting fill_value to another number changes the output representation for the outside query. It does not extend the triangle. The nearest method returns the value of the closest observation and does not use fill_value. In this fixture, the outside query receives 4 mm from the observation at (2, 0). That number is a finite observed value assigned to another location by the nearest rule.
The separate geometry check asks the Delaunay triangulation whether each query falls in a simplex. Here, find_simplex returns an index for the inner query and minus one for the outer query. The output accepted in the fixture also requires that the linear result be finite. This second condition matters when production measurements can contain missing or invalid values. A geometrically supported query and a usable numeric estimate are separate properties. Validate the input rows first and build any support mask from the same accepted sites the interpolator uses. If the interpolation path rescales coordinates, use consistent geometry for the mask as well.
Show the distinction on the page
One straightforward report draws the accepted linear values on a color scale and uses a separate background for points outside the sampled hull. Overlay the sample locations so a technician can see where the map was constrained. If a viewer needs a value everywhere, it can provide a separate nearest-neighbor layer. Keep the method and support flag with each exported value so the difference survives CSV export, annotation, or a later comparison. If a spreadsheet accepts only finite numbers, include a separate support column before deciding how its blank or fill cells should display.
For a comparison between calibration runs, compute each run’s support from its own accepted sites. Restrict a difference map to queries supported by both runs, or label areas where only one run has support. Otherwise a new boundary or a dropped measurement can appear as a change in offset even when the values at shared sample locations agree. Count unsupported locations separately from locations whose estimate is outside an engineering limit. The former may call for more measurement coverage, while the latter calls for inspecting the observed behavior or the model.
Geometric support is only one check
A point inside the hull may still be far from any observation. It may also lie across a fixture cutout or another region that the bench geometry excludes. The hull check cannot identify those cases on its own. If they matter, mask known exclusions and apply a sampling-distance or other coverage rule justified by the measurement plan. For points almost on the boundary, document the tolerance and keep a test case near the edge. The synthetic queries here are comfortably separated from the diagonal so that the fixture isolates the distinction between interpolation and substituting a nearby value.
Before distributing a map, use a small fixture with an inside query, an outside query within the axis bounding box, and a deliberately missing accepted value. Check the resulting support flag, numeric output and displayed legend through the same export path the report uses. Inspect the recipients’ file as well as the plotting script. An exported report that preserves method and support lets a reader decide which cells are suitable for a calibration comparison and which locations still need a measurement.
Sources
SciPy, griddata
https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.griddata.html
SciPy, Delaunay.find_simplex
https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.Delaunay.find_simplex.html
Illustration. AI-generated concept of three calibration markers defining a triangle, with a white query inside and an amber query outside.