コード例 #1
0
    except Exception as e:
        print(e)
        dist = np.nan
        focality_score = np.nan
        corr = np.nan
        ori_error = np.nan
    print(setting, dist, focality_score, corr, ori_error)

    dists.append(dist)
    focs.append(focality_score)
    corrs.append(corr)
    ori_errors.append(ori_error)

###############################################################################
# Save everything to a pandas dataframe
###############################################################################

df = pd.DataFrame(lcmv_settings,
                  columns=[
                      'reg', 'sensor_type', 'pick_ori', 'inversion',
                      'weight_norm', 'normalize_fwd', 'use_noise_cov',
                      'reduce_rank', 'project_pca'
                  ])
df['dist'] = dists
df['focality'] = focs
df['corr'] = corrs
df['ori_error'] = ori_errors

df.to_csv(fname.lcmv_results(vertex=config.vertex, noise=config.noise))
print('OK!')
コード例 #2
0
from tqdm import tqdm
import mne
import surfer
from mayavi import mlab
mlab.options.offscreen = True
from itertools import product

import config
from config import fname

fwd = mne.read_forward_solution(fname.fwd)

dfs = []
for vertex in tqdm(range(3765), total=3765):
    try:
        df = pd.read_csv(fname.lcmv_results(noise=config.noise, vertex=vertex))
        df['vertex'] = vertex
        df['noise'] = config.noise
        dfs.append(df)
    except Exception as e:
        print(e)
lcmv = pd.concat(dfs, ignore_index=True)
lcmv['pick_ori'].fillna('none', inplace=True)
lcmv['weight_norm'].fillna('none', inplace=True)

regs = [0.05, 0.1]
sensor_types = ['joint', 'grad', 'mag']
pick_oris = ['none', 'normal', 'max-power']
weight_norms = ['unit-noise-gain', 'none']
use_noise_covs = [True, False]
depths = [True, False]
コード例 #3
0
vsrc = fwd['src']
vertno = vsrc[0]['vertno']

# needs to be set for plot_vstc_sliced_old to work
if vsrc[0]['subject_his_id'] is None:
    vsrc[0]['subject_his_id'] = 'sample'

###############################################################################
# Get data from csv files
###############################################################################

dfs = []
for vertex in tqdm(range(3756), total=3756):
    try:
        df = pd.read_csv(fname.lcmv_results(vertex=vertex, noise=0.1), index_col=0)
        df['vertex'] = vertex
        df['noise'] = config.noise
        dfs.append(df)
    except Exception as e:
        print(e)
lcmv = pd.concat(dfs, ignore_index=True)
lcmv['pick_ori'].fillna('none', inplace=True)
lcmv['weight_norm'].fillna('none', inplace=True)
lcmv['ori_error'].fillna(-1, inplace=True)

def fix(x):
    if x == np.nan:
        return np.nan
    elif x > 90:
        return 180 - x