def _tps(distsq):
 out = np.zeros_like(distsq)
 mask = (distsq > 0)
 valid = distsq[mask]
 out[mask] = (valid * np.log(valid))
 return out

def _tps ( distsq ) : out = np . zeros_like ( distsq ) mask = ( distsq > 0 ) valid = distsq [ mask ] out [ mask ] = ( valid * np . log ( valid ) ) return out
thin-plate function * np .