def _surface_constraint(rd, surf, min_dist_to_inner_skull):
 dist = _compute_nearest(surf['rr'], rd[np.newaxis, :], return_dists=True)[1][0]
 if _points_outside_surface(rd[np.newaxis, :], surf, 1)[0]:
  dist *= (-1.0)
 dist -= min_dist_to_inner_skull
 return dist

def _surface_constraint ( rd , surf , min_dist_to_inner_skull ) : dist = _compute_nearest ( surf [ 'rr' ] , rd [ np . newaxis , : ] , return_dists = True ) [ 1 ] [ 0 ] if _points_outside_surface ( rd [ np . newaxis , : ] , surf , 1 ) [ 0 ] : dist *= ( - 1.0 ) dist -= min_dist_to_inner_skull return dist
surface fitting constraint .