def write_bem_solution(fname, bem):
 _check_bem_size(bem['surfs'])
 with start_file(fname) as fid:
  start_block(fid, FIFF.FIFFB_BEM)
  write_int(fid, FIFF.FIFF_BEM_COORD_FRAME, bem['surfs'][0]['coord_frame'])
  _write_bem_surfaces_block(fid, bem['surfs'])
  if ('solution' in bem):
   if (bem['bem_method'] != FIFF.FWD_BEM_LINEAR_COLL):
    raise RuntimeError('Only linear collocation supported')
   write_int(fid, FIFF.FIFF_BEM_APPROX, FIFF.FIFFV_BEM_APPROX_LINEAR)
   write_float_matrix(fid, FIFF.FIFF_BEM_POT_SOLUTION, bem['solution'])
  end_block(fid, FIFF.FIFFB_BEM)
  end_file(fid)

def write_bem_solution ( fname , bem ) : _check_bem_size ( bem [ 'surfs' ] ) with start_file ( fname ) as fid : start_block ( fid , FIFF . FIFFB_BEM ) write_int ( fid , FIFF . FIFF_BEM_COORD_FRAME , bem [ 'surfs' ] [ 0 ] [ 'coord_frame' ] ) _write_bem_surfaces_block ( fid , bem [ 'surfs' ] ) if ( 'solution' in bem ) : if ( bem [ 'bem_method' ] != FIFF . FWD_BEM_LINEAR_COLL ) : raise RuntimeError ( 'Only linear collocation supported' ) write_int ( fid , FIFF . FIFF_BEM_APPROX , FIFF . FIFFV_BEM_APPROX_LINEAR ) write_float_matrix ( fid , FIFF . FIFF_BEM_POT_SOLUTION , bem [ 'solution' ] ) end_block ( fid , FIFF . FIFFB_BEM ) end_file ( fid )
write a bem model with solution .