# kwant.plotter.interpolate_density¶

kwant.plotter.interpolate_density(syst, density, relwidth=None, abswidth=None, n=9, mask=True)[source]

Interpolate density in a system onto a regular grid.

The system sites together with a scalar for each site defines a “discrete” density field where the density is non-zero only at the site positions.

To make this vector field easier to visualize and interpret at different length scales, it is smoothed by convoluting it with the bell-shaped bump function f(r) = max(1 - (2*r / width)**2, 0)**2. The bump width is determined by the relwidth and abswidth parameters.

This routine samples the smoothed field on a regular (square or cubic) grid.

Parameters
systA finalized system

The system on which we are going to calculate the field.

density1D array of float

Must contain the intensity on each site in the same order that they appear in syst.sites.

relwidthfloat, optional

Relative width of the bumps used to smooth the field, as a fraction of the length of the longest side of the bounding box. This argument is only used if abswidth is not given.

abswidthfloat, optional

Absolute width of the bumps used to smooth the field. Takes precedence over relwidth. If neither is given, the bump width is set to four times the length of the shortest hopping.

nint

Number of points the grid must have over the width of the bump.

If True, this function returns a masked array that masks positions that are too far away from any sites. This is useful for showing an approximate outline of the system when the field is plotted.

Returns
fieldn-d arraylike of float

n-d array of n-d vectors.

boxsequence of 2-sequences of float

the extents of field: ((x0, x1), (y0, y1), …)

#### Previous topic

kwant.plotter.interpolate_current