@verbose
def read_source_spaces(fname, patch_stats=False, verbose=None):
 check_fname(fname, 'source space', ('-src.fif', '-src.fif.gz', '-fwd.fif', '-fwd.fif.gz', '-inv.fif', '-inv.fif.gz'))
 (ff, tree, _) = fiff_open(fname)
 with ff as fid:
  src = _read_source_spaces_from_tree(fid, tree, patch_stats=patch_stats, verbose=verbose)
  src.info['fname'] = fname
  node = dir_tree_find(tree, FIFF.FIFFB_MNE_ENV)
  if node:
   node = node[0]
   for p in range(node['nent']):
    kind = node['directory'][p].kind
    pos = node['directory'][p].pos
    tag = read_tag(fid, pos)
    if (kind == FIFF.FIFF_MNE_ENV_WORKING_DIR):
     src.info['working_dir'] = tag.data
    elif (kind == FIFF.FIFF_MNE_ENV_COMMAND_LINE):
     src.info['command_line'] = tag.data
 return src

@ verbose def read_source_spaces ( fname , patch_stats = False , verbose = None ) : check_fname ( fname , 'source space' , ( '-src.fif' , '-src.fif.gz' , '-fwd.fif' , '-fwd.fif.gz' , '-inv.fif' , '-inv.fif.gz' ) ) ( ff , tree , _ ) = fiff_open ( fname ) with ff as fid : src = _read_source_spaces_from_tree ( fid , tree , patch_stats = patch_stats , verbose = verbose ) src . info [ 'fname' ] = fname node = dir_tree_find ( tree , FIFF . FIFFB_MNE_ENV ) if node : node = node [ 0 ] for p in range ( node [ 'nent' ] ) : kind = node [ 'directory' ] [ p ] . kind pos = node [ 'directory' ] [ p ] . pos tag = read_tag ( fid , pos ) if ( kind == FIFF . FIFF_MNE_ENV_WORKING_DIR ) : src . info [ 'working_dir' ] = tag . data elif ( kind == FIFF . FIFF_MNE_ENV_COMMAND_LINE ) : src . info [ 'command_line' ] = tag . data return src
read the source spaces from a fif file .