Can't you just do: `neight_dist = np.maximum(neigh_dist, MACHINE_EPSILON)`?