kwant.plotter.mask_interpolate(coords, values, a=None, method='nearest', oversampling=3)[source]#

Interpolate a scalar function in vicinity of given points.

Create a masked array corresponding to interpolated values of the function at points lying not further than a certain distance from the original data points provided.

  • coords (np.ndarray) – An array with site coordinates.

  • values (np.ndarray) – An array with the values from which the interpolation should be built.

  • a (float, optional) – Reference length. If not given, it is determined as a typical nearest neighbor distance.

  • method (string, optional) – Passed to scipy.interpolate.griddata: “nearest” (default), “linear”, or “cubic”

  • oversampling (integer, optional) – Number of pixels per reference length. Defaults to 3.


  • array (2d NumPy array) – The interpolated values.

  • min, max (vectors) – The real-space coordinates of the two extreme ([0, 0] and [-1, -1]) points of array.


  • min and max are chosen such that when plotting a system on a square lattice and oversampling is set to an odd integer, each site will lie exactly at the center of a pixel of the output array.

  • When plotting a system on a square lattice and method is “nearest”, it makes sense to set oversampling to 1. Then, each site will correspond to exactly one pixel in the resulting array.