def _write_morph_map(fname, subject_from, subject_to, mmap_1, mmap_2):
 fid = start_file(fname)
 assert (len(mmap_1) == 2)
 assert (len(mmap_2) == 2)
 hemis = [FIFF.FIFFV_MNE_SURF_LEFT_HEMI, FIFF.FIFFV_MNE_SURF_RIGHT_HEMI]
 for (m, hemi) in zip(mmap_1, hemis):
  start_block(fid, FIFF.FIFFB_MNE_MORPH_MAP)
  write_string(fid, FIFF.FIFF_MNE_MORPH_MAP_FROM, subject_from)
  write_string(fid, FIFF.FIFF_MNE_MORPH_MAP_TO, subject_to)
  write_int(fid, FIFF.FIFF_MNE_HEMI, hemi)
  write_float_sparse_rcs(fid, FIFF.FIFF_MNE_MORPH_MAP, m)
  end_block(fid, FIFF.FIFFB_MNE_MORPH_MAP)
 for (m, hemi) in zip(mmap_2, hemis):
  start_block(fid, FIFF.FIFFB_MNE_MORPH_MAP)
  write_string(fid, FIFF.FIFF_MNE_MORPH_MAP_FROM, subject_to)
  write_string(fid, FIFF.FIFF_MNE_MORPH_MAP_TO, subject_from)
  write_int(fid, FIFF.FIFF_MNE_HEMI, hemi)
  write_float_sparse_rcs(fid, FIFF.FIFF_MNE_MORPH_MAP, m)
  end_block(fid, FIFF.FIFFB_MNE_MORPH_MAP)
 end_file(fid)

def _write_morph_map ( fname , subject_from , subject_to , mmap_1 , mmap_2 ) : fid = start_file ( fname ) assert ( len ( mmap_1 ) == 2 ) assert ( len ( mmap_2 ) == 2 ) hemis = [ FIFF . FIFFV_MNE_SURF_LEFT_HEMI , FIFF . FIFFV_MNE_SURF_RIGHT_HEMI ] for ( m , hemi ) in zip ( mmap_1 , hemis ) : start_block ( fid , FIFF . FIFFB_MNE_MORPH_MAP ) write_string ( fid , FIFF . FIFF_MNE_MORPH_MAP_FROM , subject_from ) write_string ( fid , FIFF . FIFF_MNE_MORPH_MAP_TO , subject_to ) write_int ( fid , FIFF . FIFF_MNE_HEMI , hemi ) write_float_sparse_rcs ( fid , FIFF . FIFF_MNE_MORPH_MAP , m ) end_block ( fid , FIFF . FIFFB_MNE_MORPH_MAP ) for ( m , hemi ) in zip ( mmap_2 , hemis ) : start_block ( fid , FIFF . FIFFB_MNE_MORPH_MAP ) write_string ( fid , FIFF . FIFF_MNE_MORPH_MAP_FROM , subject_to ) write_string ( fid , FIFF . FIFF_MNE_MORPH_MAP_TO , subject_from ) write_int ( fid , FIFF . FIFF_MNE_HEMI , hemi ) write_float_sparse_rcs ( fid , FIFF . FIFF_MNE_MORPH_MAP , m ) end_block ( fid , FIFF . FIFFB_MNE_MORPH_MAP ) end_file ( fid )
write a morph map to disk .