def _order_surfaces(surfs):
 if (len(surfs) != 3):
  return surfs
 surf_order = [FIFF.FIFFV_BEM_SURF_ID_HEAD, FIFF.FIFFV_BEM_SURF_ID_SKULL, FIFF.FIFFV_BEM_SURF_ID_BRAIN]
 ids = np.array([surf['id'] for surf in surfs])
 if (set(ids) != set(surf_order)):
  raise RuntimeError(('bad surface ids: %s' % ids))
 order = [np.where((ids == id_))[0][0] for id_ in surf_order]
 surfs = [surfs[idx] for idx in order]
 return surfs

def _order_surfaces ( surfs ) : if ( len ( surfs ) != 3 ) : return surfs surf_order = [ FIFF . FIFFV_BEM_SURF_ID_HEAD , FIFF . FIFFV_BEM_SURF_ID_SKULL , FIFF . FIFFV_BEM_SURF_ID_BRAIN ] ids = np . array ( [ surf [ 'id' ] for surf in surfs ] ) if ( set ( ids ) != set ( surf_order ) ) : raise RuntimeError ( ( 'bad surface ids: %s' % ids ) ) order = [ np . where ( ( ids == id_ ) ) [ 0 ] [ 0 ] for id_ in surf_order ] surfs = [ surfs [ idx ] for idx in order ] return surfs
reorder the surfaces .