def scale_bem(subject_to, bem_name, subject_from=None, scale=None, subjects_dir=None):
 (subjects_dir, subject_from, scale, nn_scale) = _scale_params(subject_to, subject_from, scale, subjects_dir)
 src = bem_fname.format(subjects_dir=subjects_dir, subject=subject_from, name=bem_name)
 dst = bem_fname.format(subjects_dir=subjects_dir, subject=subject_to, name=bem_name)
 if os.path.exists(dst):
  raise IOError(('File alredy exists: %s' % dst))
 surfs = read_bem_surfaces(src)
 for surf in surfs:
  surf['rr'] *= scale
  if (nn_scale is not None):
   surf['nn'] *= nn_scale
   surf['nn'] /= np.sqrt(np.sum((surf['nn'] ** 2), 1))[:, np.newaxis]
 write_bem_surfaces(dst, surfs)

def scale_bem ( subject_to , bem_name , subject_from = None , scale = None , subjects_dir = None ) : ( subjects_dir , subject_from , scale , nn_scale ) = _scale_params ( subject_to , subject_from , scale , subjects_dir ) src = bem_fname . format ( subjects_dir = subjects_dir , subject = subject_from , name = bem_name ) dst = bem_fname . format ( subjects_dir = subjects_dir , subject = subject_to , name = bem_name ) if os . path . exists ( dst ) : raise IOError ( ( 'File alredy exists: %s' % dst ) ) surfs = read_bem_surfaces ( src ) for surf in surfs : surf [ 'rr' ] *= scale if ( nn_scale is not None ) : surf [ 'nn' ] *= nn_scale surf [ 'nn' ] /= np . sqrt ( np . sum ( ( surf [ 'nn' ] ** 2 ) , 1 ) ) [ : , np . newaxis ] write_bem_surfaces ( dst , surfs )
scale a bem file .