@verbose
def _setup_bem(bem, bem_extra, neeg, mri_head_t, verbose=None):
 logger.info('')
 if isinstance(bem, string_types):
  logger.info(('Setting up the BEM model using %s...\n' % bem_extra))
  bem = read_bem_solution(bem)
 if (not isinstance(bem, ConductorModel)):
  raise TypeError('bem must be a string or ConductorModel')
 if bem['is_sphere']:
  logger.info('Using the sphere model.\n')
  if ((len(bem['layers']) == 0) and (neeg > 0)):
   raise RuntimeError('Spherical model has zero shells, cannot use with EEG data')
  if (bem['coord_frame'] != FIFF.FIFFV_COORD_HEAD):
   raise RuntimeError('Spherical model is not in head coordinates')
 else:
  if ((neeg > 0) and (len(bem['surfs']) == 1)):
   raise RuntimeError('Cannot use a homogeneous model in EEG calculations')
  logger.info('Employing the head->MRI coordinate transform with the BEM model.')
  bem['head_mri_t'] = _ensure_trans(mri_head_t, 'head', 'mri')
  logger.info(('BEM model %s is now set up' % op.split(bem_extra)[1]))
  logger.info('')
 return bem

@ verbose def _setup_bem ( bem , bem_extra , neeg , mri_head_t , verbose = None ) : logger . info ( '' ) if isinstance ( bem , string_types ) : logger . info ( ( 'Setting up the BEM model using %s...\n' % bem_extra ) ) bem = read_bem_solution ( bem ) if ( not isinstance ( bem , ConductorModel ) ) : raise TypeError ( 'bem must be a string or ConductorModel' ) if bem [ 'is_sphere' ] : logger . info ( 'Using the sphere model.\n' ) if ( ( len ( bem [ 'layers' ] ) == 0 ) and ( neeg > 0 ) ) : raise RuntimeError ( 'Spherical model has zero shells, cannot use with EEG data' ) if ( bem [ 'coord_frame' ] != FIFF . FIFFV_COORD_HEAD ) : raise RuntimeError ( 'Spherical model is not in head coordinates' ) else : if ( ( neeg > 0 ) and ( len ( bem [ 'surfs' ] ) == 1 ) ) : raise RuntimeError ( 'Cannot use a homogeneous model in EEG calculations' ) logger . info ( 'Employing the head->MRI coordinate transform with the BEM model.' ) bem [ 'head_mri_t' ] = _ensure_trans ( mri_head_t , 'head' , 'mri' ) logger . info ( ( 'BEM model %s is now set up' % op . split ( bem_extra ) [ 1 ] ) ) logger . info ( '' ) return bem
set up a bem for forward computation .