def main(tup, remote_subject_dir, args, flags): (subject, mri_subject), inverse_method = tup evoked, epochs = None, None fname_format, fname_format_cond, conditions = meg.init_main(subject, mri_subject, args) meg.init_globals_args(subject, mri_subject, fname_format, fname_format_cond, SUBJECTS_EEG_DIR, SUBJECTS_MRI_DIR, MMVT_DIR, args) meg.MEG_DIR = SUBJECTS_EEG_DIR meg.FWD = meg.FWD_EEG meg.INV = meg.INV_EEG stat = meg.STAT_AVG if len(conditions) == 1 else meg.STAT_DIFF if utils.should_run(args, 'read_eeg_sensors_layout'): flags['read_eeg_sensors_layout'] = read_eeg_sensors_layout(subject, mri_subject, args) flags = meg.calc_evoked_wrapper(subject, conditions, args, flags) if utils.should_run(args, 'create_eeg_mesh'): flags['create_eeg_mesh'] = create_eeg_mesh(mri_subject, args.eeg_electrodes_excluded_from_mesh) if utils.should_run(args, 'save_evoked_to_blender'): flags['save_evoked_to_blender'] = save_evoked_to_blender(mri_subject, conditions, args, evoked) if not op.isfile(meg.COR): eeg_cor = op.join(meg.SUBJECT_MEG_FOLDER, '{}-cor-trans.fif'.format(subject)) if not op.isfile(eeg_cor): raise Exception("Can't find head-MRI transformation matrix. Should be in {} or in {}".format(meg.COR, eeg_cor)) meg.COR = eeg_cor flags = meg.calc_fwd_inv_wrapper(subject, mri_subject, conditions, args, flags) flags = meg.calc_stc_per_condition_wrapper(subject, conditions, inverse_method, args, flags) return flags
def init(subject, args, mri_subject='', remote_subject_dir=''): if mri_subject == '': mri_subject = subject fname_format, fname_format_cond, conditions = meg.init_main(subject, mri_subject, remote_subject_dir, args) meg.init_globals_args(subject, mri_subject, fname_format, fname_format_cond, args=args) # meg.MEG_DIR = SUBJECTS_EEG_DIR meg.FWD = meg.FWD_EEG meg.INV = meg.INV_EEG stat = meg.STAT_AVG if len(conditions) == 1 else meg.STAT_DIFF SUBJECT_EEG_DIR = op.join(SUBJECTS_EEG_DIR, subject) meg.locating_file = partial(utils.locating_file, parent_fol=SUBJECT_EEG_DIR) return conditions, stat
def init(subject, task): args = pu.init_args(meg.read_cmd_args(dict( subject=subject, atlas='laus125', task=task, files_includes_cond=True, inverse_method='MNE'))) fname_format_cond = '{subject}_hcp_{cond}-{ana_type}.{file_type}' fname_format = '{subject}_hcp-{ana_type}.{file_type}' meg.init_globals_args( subject, '', fname_format, fname_format_cond, args=args) hcp_params = dict(hcp_path=HCP_DIR, subject=subject, data_type=task) return args, hcp_params