Skip to content

contact_distance builtin

contact_distance(
    model, classes, *, target=None, signed=True
)

Distance from each block to the nearest block of another class, or with target, to the nearest block of class target.

Blocks of target get the distance to the nearest block outside it, negative when signed; without target distances are never negative. Distances are exact, between block centroids, in any layout, so blocks on either side of a contact get the same distance. NaN where there is no such block. Classes may be any labels, or the column of model holding them.

used in