コード例 #1
0
ファイル: plot_functions.py プロジェクト: egorananyev/megpipe
def plot_source_space(name, subject, subjects_dir, save_plots, figures_path):

    source_space = io.read_source_space(subject, subjects_dir)
    source_space.plot()
    mayavi.mlab.view(-90, 7)

    if save_plots:
        save_path = join(figures_path, subject, 'source_space', name + '.jpg')
        mayavi.mlab.savefig(save_path)
        print 'figure: ' + save_path + ' has been saved'

    else:
        print 'Not saving plots; set "save_plots" to "True" to save'
コード例 #2
0
def create_forward_solution(name, save_dir, subject, subjects_dir,
                            overwrite):

    forward_name = name + '-fwd.fif'
    forward_path = join(save_dir, forward_name)

    if overwrite or not isfile(forward_path):

        info = io.read_info(name, save_dir)
        trans = io.read_transformation(name, save_dir)
        bem = io.read_bem_solution(subject, subjects_dir)
        source_space = io.read_source_space(subject, subjects_dir)

        forward = mne.make_forward_solution(info, trans, source_space, bem,
                                              n_jobs=1)
        
        mne.write_forward_solution(forward_path, forward, overwrite)
        
    else:
        print('forward solution: ' + forward_path + ' already exists')