def _calc_zvals_parallel(p): subject, clip_fname, baseline_fnames, modality, inverse_method, fol, from_index, to_index, use_abs, overwrite = p stc_zvals_fname = op.join( fol, '{}-epilepsy-{}-{}-{}-amplitude-zvals'.format( subject, inverse_method, modality, utils.namebase(clip_fname))) if utils.both_hemi_files_exist('{}-{}.stc'.format( stc_zvals_fname, '{hemi}')) and not overwrite: return True stc_fname = op.join( MMVT_DIR, subject, meg.modality_fol(modality), 'ictal-{}-stcs'.format(inverse_method), '{}-epilepsy-{}-{}-{}'.format(subject, inverse_method, modality, utils.namebase(clip_fname))) if not utils.both_hemi_files_exist('{}-{}.stc'.format(stc_fname, '{hemi}')): print('Error finding {}!'.format(stc_fname)) return False return meg.calc_stc_zvals( subject, '{}-rh.stc'.format(stc_fname), baseline_fnames, stc_zvals_fname, # '{}-rh.stc'.format(baseline_fname) use_abs, from_index, to_index, True, overwrite)
def main(tup, remote_subject_dir, args, flags): (subject, mri_subject), inverse_method = tup evoked, epochs = None, None conditions, stat = init(subject, args, mri_subject, remote_subject_dir) if utils.should_run(args, 'read_sensors_layout'): flags['read_sensors_layout'] = read_sensors_layout_args( mri_subject, args) flags, evoked, epochs = meg.calc_evokes_wrapper(subject, conditions, args, flags, mri_subject=mri_subject) flags = meg.calc_fwd_inv_wrapper(subject, args, conditions, flags, mri_subject) flags, stcs_conds, stcs_num = meg.calc_stc_per_condition_wrapper( subject, conditions, inverse_method, args, flags) flags = meg.calc_labels_avg_per_condition_wrapper(subject, conditions, args.atlas, inverse_method, stcs_conds, args, flags, stcs_num, None, epochs) if 'calc_stc_zvals' in args.function: flags['calc_stc_zvals'] = meg.calc_stc_zvals( subject, args.stc_name, args.baseline_stc_name, 'eeg', args.use_abs, args.from_index, args.to_index, args.stc_zvals_name, False, args.overwrite_stc) if utils.should_run(args, 'create_helmet_mesh'): flags['create_helmet_mesh'] = create_helmet_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 utils.should_run(args, 'calc_minmax'): flags['calc_minmax'] = calc_minmax(mri_subject, args) if 'plot_evoked' in args.function: flags['plot_evoked'], _ = plot_evoked(args.evo_fname, args.evoked_key, args.pick_meg, args.pick_eeg, args.pick_eog, args.ssp_proj, args.spatial_colors, args.window_title, args.hline, args.channels_to_exclude) if 'snap_sensors_to_outer_skin' in args.function: flags['snap_sensors_to_outer_skin'] = snap_sensors_to_outer_skin( mri_subject) return flags