def calc_fwd_inv(subject, raw_fname, empty_fname, bad_channels_fname, overwrite_inv=False, overwrite_fwd=False): # python -m src.preproc.eeg -s nmr00857 -f calc_inverse_operator,make_forward_solution # --overwrite_inv 0 --overwrite_fwd 0 -t epilepsy # --raw_fname /autofs/space/frieda_001/users/valia/epilepsy/5241495_00857/subj_5241495/190123/5241495_01_raw.fif # --empty_fname /autofs/space/frieda_001/users/valia/epilepsy/5241495_00857/subj_5241495/190123/5241495_roomnoise_raw.fif # --use_empty_room_for_noise_cov 1 # --bad_channels EEG061,EEG02,EEG042,MEG0112,MEG0113 bad_channels = ','.join(matlab_utils.matlab_cell_arrays_to_dict(bad_channels_fname)['label']) trans_fname = op.join(MEG_DIR, subject, '{}-trans.fif'.format(subject)) args = meg.read_cmd_args(dict( subject=subject, mri_subject=subject, function='calc_inverse_operator,make_forward_solution', task='kaggle', inv_fname=op.join(MEG_DIR, subject, '{}-meeg-kaggle-inv.fif'.format(subject)), fwd_fname=op.join(MEG_DIR, subject, '{}-meeg-kaggle-fwd.fif'.format(subject)), fwd_usingEEG=True, overwrite_inv=overwrite_inv, overwrite_fwd=overwrite_fwd, use_empty_room_for_noise_cov=True, bad_channels=bad_channels, raw_fname=raw_fname, empty_fname=empty_fname, cor_fname=trans_fname )) meg.call_main(args)
def dipole_fit(): mu.add_mmvt_code_root_to_path() from src.preproc import meg importlib.reload(meg) subject = mu.get_user() args = meg.read_cmd_args( dict(subject=subject, mri_subject=subject, atlas=mu.get_atlas())) meg.init(subject, args) dipoles_times = [(bpy.context.scene.meg_dipole_fit_tmin, bpy.context.scene.meg_dipole_fit_tmax)] dipoloes_title = mask_roi = MEGPanel.current_cluster['intersects'][0][ 'name'] meg.dipoles_fit(dipoles_times, dipoloes_title, None, mu.get_real_fname('meg_noise_cov_fname'), mu.get_real_fname('meg_evoked_fname'), mu.get_real_fname('head_to_mri_trans_mat_fname'), 5., bpy.context.scene.meg_dipole_fit_use_meg, bpy.context.scene.meg_dipole_fit_use_eeg, mask_roi=mask_roi, do_plot=False, n_jobs=4)
def meg_calc_labels_ts(subject, inv_method='MNE', em='mean_flip', atlas='electrodes_labels', remote_subject_dir='', meg_remote_dir='', empty_fname='', cor_fname='', use_demi_events=True, n_jobs=-1): functions = 'calc_epochs,calc_evokes,make_forward_solution,calc_inverse_operator,calc_stc,calc_labels_avg_per_condition' meg_args = meg.read_cmd_args(dict( subject=subject, mri_subject=subject, task='rest', inverse_method=inv_method, extract_mode=em, atlas=atlas, single_trial_stc=True, recreate_src_spacing='ico5', # fwd_recreate_source_space=True, # recreate_bem_solution=True, remote_subject_meg_dir=meg_remote_dir, remote_subject_dir=remote_subject_dir, empty_fname=empty_fname, cor_fname=cor_fname, function=functions, use_demi_events=use_demi_events, windows_length=10000, windows_shift=5000, # overwrite_fwd=True, # overwrite_inv=True, # overwrite_labels_data=True, using_auto_reject=False, use_empty_room_for_noise_cov=True, read_only_from_annot=False, n_jobs=n_jobs )) return meg.call_main(meg_args)
def calc_sample_meg_data(): args = meg.read_cmd_args( dict(subject='sample', function='calc_epochs,calc_evokes,calc_stc', contrast='audvis', task='audvis', pick_meg=True, pick_eeg=False, fwd_usingMEG=True, fwd_usingEEG=False, fname_format='{subject}_audvis_meg-{ana_type}.{file_type}', fname_format_cond= '{subject}_audvis_meg_{cond}-{ana_type}.{file_type}', trans_fname=op.join(MNE_ROOT, 'sample_audvis_raw-trans.fif'), events_fname=op.join(MNE_ROOT, 'sample_audvis_raw-eve.fif'), raw_fname=op.join(MNE_ROOT, 'sample_audvis_raw.fif'), inv_fname=op.join(MNE_ROOT, 'sample_audvis-meg-oct-6-meg-inv.fif'), fwd_fname=op.join(MNE_ROOT, 'sample_audvis-meg-oct-6-fwd.fif'), conditions=['LA', 'RA'], read_events_from_file=True, t_min=-0.2, t_max=0.5, overwrite_epochs=False, overwrite_evoked=False, overwrite_stc=True)) meg.call_main(args)
def calc_msit(args): # python -m src.preproc.meg -s ep001 -m mg78 -a laus250 -t MSIT # --contrast interference --t_max 2 --t_min -0.5 --data_per_task 1 --read_events_from_file 1 # --events_file_name {subject}_msit_nTSSS_interference-eve.txt --cleaning_method nTSSS args = meg.read_cmd_args( dict( subject=args.subject, mri_subject=args.mri_subject, task='MSIT', function=args.real_function, data_per_task=True, atlas='laus250', contrast='interference', cleaning_method='nTSSS', t_min=-0.5, t_max=2, # calc_epochs_from_raw=True, read_events_from_file=True, # remote_subject_meg_dir='/autofs/space/sophia_002/users/DARPA-MEG/project_orig_msit', events_file_name='{subject}_msit_nTSSS_interference-eve.txt', reject=False, # save_smoothed_activity=True, # stc_t=1189, morph_to_subject='fsaverage5', extract_mode=['mean_flip', 'mean', 'pca_flip'])) meg.call_main(args)
def calc_meg_epochs(args): empty_fnames, cors, days = get_empty_fnames(args.subject[0], args.tasks, args) times = (-2, 4) for task in args.tasks: args = meg.read_cmd_args( dict(subject=args.subject, mri_subject=args.subject, task=task, remote_subject_dir= '/autofs/space/lilli_001/users/DARPA-Recons/{subject}', get_task_defaults=False, fname_format='{}_{}_nTSSS-ica-raw'.format( '{subject}', task.lower()), empty_fname=empty_fnames[task], function='calc_epochs,calc_evokes', conditions=task.lower(), data_per_task=True, normalize_data=False, t_min=times[0], t_max=times[1], read_events_from_file=False, stim_channels='STI001', use_empty_room_for_noise_cov=True, n_jobs=args.n_jobs)) meg.call_main(args)
def calc_rest(args): # '-s hc029 -a laus125 -t rest -f calc_evoked,make_forward_solution,calc_inverse_operator --reject 0 --remove_power_line_noise 0 --windows_length 1000 --windows_shift 500 --remote_subject_dir "/autofs/space/lilli_001/users/DARPA-Recons/hc029"'' # '-s hc029 -a laus125 -t rest -f calc_stc,calc_labels_avg_per_condition --single_trial_stc 1 --remote_subject_dir "/autofs/space/lilli_001/users/DARPA-Recons/hc029"' # '-s subject-name -a atlas-name -t rest -f rest_functions' --l_freq 8 --h_freq 13 --windows_length 500 --windows_shift 100 args = meg.read_cmd_args(dict( subject=args.subject, mri_subject=args.mri_subject, atlas='laus125', function='rest_functions', task='rest', cleaning_method='tsss', reject=False, # Should be True here, unless you are dealling with bad data... remove_power_line_noise=True, l_freq=3, h_freq=80, windows_length=500, windows_shift=100, inverse_method='MNE', remote_subject_dir='/autofs/space/lilli_001/users/DARPA-Recons/{subject}', # This properties are set automatically if task=='rest' # calc_epochs_from_raw=True, # single_trial_stc=True, # use_empty_room_for_noise_cov=True, # windows_num=10, # baseline_min=0, # baseline_max=0, )) meg.call_main(args)
def _calc_pvals_fMRI_clusters(p, extract_time_series_for_clusters=False): subject, overwrite = p stc_name = 'dSPM_mean_flip_vertices_power_spectrum_stat' if not utils.both_hemi_files_exist( op.join(MMVT_DIR, subject, 'meg', '{}-{}.stc'.format( stc_name, '{hemi}'))): print('{}: Can\'t find {}!'.format(subject, stc_name)) return False args.subject = subject clusters_root_fol = utils.make_dir( op.join(MMVT_DIR, subject, 'meg', 'clusters')) res_fname = op.join( clusters_root_fol, 'clusters_labels_dSPM_mean_flip_vertices_power_spectrum_stat.pkl') if not op.isfile(res_fname) or args.overwrite: utils.delete_folder_files(clusters_root_fol) _args = meg.read_cmd_args( dict(subject=subject, mri_subject=subject, atlas='MSIT_I-C', function='find_functional_rois_in_stc', stc_name=stc_name, threshold=-np.log10(0.01), threshold_is_precentile=False, extract_time_series_for_clusters=False, save_func_labels=True, calc_cluster_contours=True, n_jobs=args.n_jobs)) try: meg.call_main(_args) except: print(traceback.format_exc()) if not op.isfile(res_fname): print('Cluster output can\'t be found!') return False
def calc_msit(args): # python -m src.preproc.meg -s ep001 -m mg78 -a laus250 -t MSIT # --contrast interference --t_max 2 --t_min -0.5 --data_per_task 1 --read_events_from_file 1 # --events_fname {subject}_msit_nTSSS_interference-eve.txt --cleaning_method nTSSS args = meg.read_cmd_args(dict( subject=args.subject, mri_subject=args.mri_subject, task='MSIT', # function=args.real_function, function='read_sensors_layout,calc_epochs,calc_evokes,calc_stc,calc_labels_avg_per_condition,calc_labels_min_max', data_per_task=True, atlas=args.atlas, contrast='interference', cleaning_method='nTSSS', t_min=-0.5, t_max=2, # calc_epochs_from_raw=True, read_events_from_file=True, # remote_subject_meg_dir='/autofs/space/sophia_002/users/DARPA-MEG/project_orig_msit', events_fname='{subject}_msit_nTSSS_interference-eve.txt', reject=False, # save_smoothed_activity=True, # stc_t=1189, morph_to_subject = 'fsaverage5', extract_mode=['mean_flip'], #, 'mean', 'pca_flip'], pick_ori='normal', overwrite_epochs=False, overwrite_evoked=True, overwrite_stc=False, overwrite_labels_data=False, overwrite_sensors=False )) meg.call_main(args)
def meg_preproc(subject, inv_method='MNE', em='mean_flip', atlas='electrodes_labels', remote_subject_dir='', meg_remote_dir='', empty_fname='', cor_fname='', use_demi_events=True, calc_labels_avg=False, overwrite=False, n_jobs=-1): functions = 'calc_epochs,calc_evokes,make_forward_solution,calc_inverse_operator' if calc_labels_avg: functions += ',calc_stc,calc_labels_avg_per_condition' meg_args = meg.read_cmd_args(dict( subject=subject, mri_subject=subject, task='rest', inverse_method=inv_method, extract_mode=em, atlas=atlas, remote_subject_meg_dir=meg_remote_dir, remote_subject_dir=remote_subject_dir, empty_fname=empty_fname, cor_fname=cor_fname, function=functions, use_demi_events=use_demi_events, windows_length=10000, windows_shift=5000, # power_line_notch_widths=5, using_auto_reject=False, # reject=False, use_empty_room_for_noise_cov=True, read_only_from_annot=False, overwrite_epochs=overwrite, overwrite_evoked=overwrite, n_jobs=n_jobs )) return meg.call_main(meg_args)
def calc_msit_functional_rois(args): clusters_root_fol = utils.make_dir( op.join(MMVT_DIR, args.subject[0], 'meg', 'clusters')) utils.delete_folder_files(clusters_root_fol) # conditions = ['neutral', 'interference'] # for cond in conditions: _args = meg.read_cmd_args( dict( subject=args.subject, mri_subject=args.mri_subject, task='MSIT', data_per_task=True, # atlas='laus125', function='find_functional_rois_in_stc', inverse_method='dSPM', stc_name= '{subject}_msit_nTSSS_interference_interference-neutral_1-15-dSPM', inv_fname='{subject}_msit_nTSSS_interference_1-15-inv', label_name_template='*', peak_mode='pos', threshold=99.5, min_cluster_max=5, min_cluster_size=100, # recreate_src_spacing='ico5' # clusters_label='precentral' )) meg.call_main(_args)
def calc_mne_python_sample_data(args): import mne mne_sample_data_fol = mne.datasets.sample.data_path() trans_fname = op.join(mne_sample_data_fol, 'MEG', 'sample', 'sample_audvis_raw-trans.fif') args = meg.read_cmd_args( dict( subject=args.subject, mri_subject=args.mri_subject, function='read_sensors_layout,calc_evokes', # atlas='laus250', contrast='audvis', task='audvis', trans_fname=trans_fname, fname_format='{subject}_audvis-{ana_type}.{file_type}', fname_format_cond='{subject}_audvis_{cond}-{ana_type}.{file_type}', conditions=['LA', 'RA'], read_events_from_file=True, t_min=-0.2, t_max=0.5, extract_mode=['mean_flip'], #, 'mean', 'pca_flip'], overwrite_epochs=args.overwrite, overwrite_evoked=True, overwrite_sensors=True)) meg.call_main(args)
def crop_stc_no_baseline(subject, mri_subject): args = meg.read_cmd_args(['-s', subject, '-m', mri_subject]) args.fname_format = '{subject}_02_f2-35_all_correct_combined' args.inv_fname_format = '{subject}_02_f2-35-ico-5-meg-eeg' args.stc_t_min = -0.1 args.stc_t_max = 0.15 args.base_line_max = None meg.run_on_subjects(args)
def meg_remove_artifcats(subject, raw_fname): meg_args = meg.read_cmd_args(dict( subject=subject, mri_subject=subject, function='remove_artifacts', raw_fname=raw_fname, overwrite_ica=True )) return meg.call_main(meg_args)
def read_cmd_args(argv=None): args = meg.read_cmd_args(argv) args.pick_meg = False args.pick_eeg = True args.reject = False args.fwd_usingMEG = False args.fwd_usingEEG = True return args
def read_epoches_and_calc_activity(subject, mri_subject): args = meg.read_cmd_args(['-s', subject, '-m', mri_subject]) args.function = [ 'calc_stc', 'calc_labels_avg_per_condition', 'smooth_stc', 'save_activity_map' ] args.pick_ori = 'normal' args.colors_map = 'jet' meg.run_on_subjects(args)
def calc_power_spectrum(args): args = meg.read_cmd_args(dict( subject=args.subject, mri_subject=args.mri_subject, atlas='laus125', function='calc_power_spectrum', overwrite_labels_power_spectrum=True, task='rest', )) meg.call_main(args)
def calc_meg_power_spectrum(subject, atlas, inv_method, em, overwrite=False, n_jobs=-1): meg_args = meg.read_cmd_args(dict( subject=subject, mri_subject=subject, task='rest', inverse_method=inv_method, extract_mode=em, atlas=atlas, function='calc_labels_power_spectrum', pick_ori='normal', # very important for calculation of the power spectrum # max_epochs_num=20, overwrite_labels_power_spectrum=overwrite, n_jobs=n_jobs )) return meg.call_main(meg_args)
def morph_stc(args): args = meg.read_cmd_args(dict( subject=args.subject, mri_subject=args.mri_subject, function='morph_stc', task='MSIT', data_per_task=True, contrast='interference', cleaning_method='nTSSS', morph_to_subject='colin27')) meg.call_main(args)
def calc_single_trial_labels_msit(subject, mri_subject): args = meg.read_cmd_args(['-s', subject, '-m', mri_subject]) args.task = 'MSIT' args.atlas = 'laus250' args.function = 'calc_stc_per_condition,calc_single_trial_labels_per_condition' args.t_tmin = -0.5 args.t_tmax = 2 args.single_trial_stc = True args.fwd_no_cond = False args.files_includes_cond = True args.constrast = 'interference' meg.run_on_subjects(args)
def calc_single_trial_labels_msit(subject, mri_subject): args = meg.read_cmd_args(['-s', subject, '-m', mri_subject]) args.task = 'MSIT' args.atlas = 'laus250' args.function = 'calc_stc,calc_single_trial_labels_per_condition' args.t_tmin = -0.5 args.t_tmax = 2 args.single_trial_stc = True args.fwd_no_cond = False args.files_includes_cond = True args.constrast = 'interference' meg.run_on_subjects(args)
def morph_stc(args): args = meg.read_cmd_args( dict(subject=args.subject, mri_subject=args.mri_subject, task='MSIT', data_per_task=True, contrast='interference', cleaning_method='nTSSS')) morph_to_subject = 'ab' # 'fsaverage5' fname_format, fname_format_cond, conditions = meg.init( args.subject[0], args, args.mri_subject[0]) meg.morph_stc(conditions, morph_to_subject, args.inverse_method[0], args.n_jobs)
def calc_functional_rois(args): # -s DC -a laus250 -f find_functional_rois_in_stc --stc_name right-MNE-1-15 --label_name_template "precentral*" --inv_fname right-inv --threshold 99.5 args = meg.read_cmd_args( dict(subject=args.subject, mri_subject=args.mri_subject, atlas='laus125', function='find_functional_rois_in_stc', inverse_method='MNE', stc_name='right-MNE-1-15', label_name_template='precentral*', inv_fname='right-inv', threshold=99.5)) meg.call_main(args)
def calc_labels_connectivity(args): args = meg.read_cmd_args(dict( subject=args.subject, mri_subject=args.mri_subject, task='MSIT', function='calc_labels_connectivity', data_per_task=True, # atlas='laus125', contrast='interference', cleaning_method='nTSSS', pick_ori='normal', con_method='wpli2_debiased' )) meg.call_main(args)
def calc_msit_stcs_diff(args): args = meg.read_cmd_args(dict( subject=args.subject, mri_subject=args.mri_subject, task='MSIT', data_per_task=True, contrast='interference', cleaning_method='nTSSS')) smooth = False fname_format, fname_format_cond, conditions = meg.init(args.subject[0], args, args.mri_subject[0]) stc_template_name = meg.STC_HEMI_SMOOTH if smooth else meg.STC_HEMI stc_fnames = [stc_template_name.format(cond=cond, method=args.inverse_method[0], hemi='lh') for cond in conditions.keys()] output_fname = stc_template_name.format(cond='diff', method=args.inverse_method[0], hemi='lh') meg.calc_stc_diff(*stc_fnames, output_fname)
def read_cmd_args(argv=None, subject='', mri_subject='', atlas=''): if argv is None and subject != '': mri_subject = subject if mri_subject == '' else mri_subject argv = ['-s', subject, '-m', mri_subject] args = meg.read_cmd_args(argv) if atlas != '' and args.atlas != atlas: args.atlas = atlas args.pick_meg = False args.pick_eeg = True args.reject = False args.fwd_usingMEG = False args.fwd_usingEEG = True args.modality = 'eeg' return args
def calc_msit_evoked(subject, mri_subject): args = meg.read_cmd_args(['-s', subject, '-m', mri_subject]) args.task = 'MSIT' args.atlas = 'laus250' args.function = 'calc_evoked' args.t_tmin = -0.5 args.t_tmax = 2 args.calc_epochs_from_raw = True args.read_events_from_file = True args.remote_subject_meg_dir = '/autofs/space/sophia_002/users/DARPA-MEG/project_orig_msit/events' args.events_file_name = '{subject}_msit_nTSSS_interference-eve.txt' args.reject = False args.pick_eeg = True meg.run_on_subjects(args)
def calc_mne_python_sample_data_stcs_diff(args): args = meg.read_cmd_args(dict( subject=args.subject, mri_subject=args.mri_subject, contrast = 'audvis', fname_format = '{subject}_audvis-{ana_type}.{file_type}', fname_format_cond = '{subject}_audvis_{cond}-{ana_type}.{file_type}', conditions = ['LA', 'RA'] )) smooth = False fname_format, fname_format_cond, conditions = meg.init(args.subject[0], args, args.mri_subject[0]) stc_template_name = meg.STC_HEMI_SMOOTH if smooth else meg.STC_HEMI stc_fnames = [stc_template_name.format(cond=cond, method=args.inverse_method[0], hemi='lh') for cond in conditions.keys()] output_fname = stc_template_name.format(cond='diff', method=args.inverse_method[0], hemi='lh') meg.calc_stc_diff(*stc_fnames, output_fname)
def calc_mne_python_sample_data(args): args = meg.read_cmd_args( dict( subject=args.subject, mri_subject=args.mri_subject, # atlas='laus250', contrast='audvis', fname_format='{subject}_audvis-{ana_type}.{file_type}', fname_format_cond='{subject}_audvis_{cond}-{ana_type}.{file_type}', conditions=['LA', 'RA'], read_events_from_file=True, t_min=-0.2, t_max=0.5, extract_mode=['mean_flip', 'mean', 'pca_flip'])) meg.call_main(args)
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
def analyze(subject): flags = {} args = meg.read_cmd_args( dict( subject=subject, task='tapping', conditions='left', # atlas='laus250', inverse_method='MNE', t_min=-2, t_max=2, noise_t_min=-2.5, noise_t_max=-1.5, bad_channels=[], stim_channels='STIM', pick_ori='normal', reject=False, overwrite_epochs=True, overwrite_inv=True, overwrite_noise_cov=True, overwrite_ica=True)) fname_format, fname_format_cond, conditions = meg.init(subject, args) conditions['left'] = 4 args.conditions = conditions if op.isfile(meg.RAW): raw = mne.io.read_raw_fif(meg.RAW, preload=True) else: raw = mne.io.read_raw_ctf(op.join(MEG_DIR, subject, 'raw', 'DC_leftIndex_day1.ds'), preload=True) meg.remove_artifacts(raw, remove_from_raw=True, overwrite_ica=args.overwrite_ica, do_plot=False) # print(raw.info['sfreq']) # if not op.isfile(meg.RAW): # raw.save(meg.RAW) # flags, evoked, epochs = meg.calc_evokes_wrapper(subject, conditions, args, flags, raw=raw) # if evoked is not None: # fig = evoked[0].plot_joint(times=[-0.5, 0.05, 0.150, 0.250, 0.6]) # plt.show() # flags = meg.calc_fwd_inv_wrapper(subject, conditions, args, flags) # flags, stcs_conds, _ = meg.calc_stc_per_condition_wrapper(subject, conditions, args.inverse_method, args, flags) # flags = meg.calc_labels_avg_per_condition_wrapper(subject, conditions, args.atlas, args.inverse_method, stcs_conds, args, flags) dipoles_times = [(0.25, 0.35)] dipoles_names = ['peak_left_motor']
def meg_preproc(args): atlas, inv_method, em = 'aparc.DKTatlas40', 'dSPM', 'mean_flip' atlas = 'darpa_atlas' bands = dict(theta=[4, 8], alpha=[8, 15], beta=[15, 30], gamma=[30, 55], high_gamma=[65, 200]) tasks = ['MSIT', 'ECR'] empty_fnames = get_empty_fnames(args.subject[0], tasks, args) times = (-2, 4) for task in tasks: args = meg.read_cmd_args(dict( subject=args.subject, mri_subject=args.subject, task=task, inverse_method=inv_method, extract_mode=em, atlas=atlas, meg_dir=args.meg_dir, remote_subject_dir=args.remote_subject_dir, # Needed for finding COR get_task_defaults=False, fname_format='{}_{}_maxwell-raw'.format('{subject}', task), empty_fname=empty_fnames[task], # function='calc_epochs,calc_evokes,make_forward_solution,calc_inverse_operator,calc_stc_per_condition,calc_labels_avg_per_condition,calc_labels_min_max', function='calc_epochs', # function='calc_labels_connectivity', conditions=task.lower(), # data_per_task=True, ica_overwrite_raw=False, normalize_data=False, t_min=times[0], t_max=times[1], read_events_from_file=False, stim_channels='STI001', use_empty_room_for_noise_cov=True, calc_source_band_induced_power=True, calc_inducde_power_per_label=False, bands='', #dict(theta=[4, 8], alpha=[8, 15], beta=[15, 30], gamma=[30, 55], high_gamma=[65, 200]), con_method='coh', con_mode='cwt_morlet', overwrite_connectivity=False, read_only_from_annot=False, # pick_ori='normal', # overwrite_epochs=True, # overwrite_evoked=True, # overwrite_inv=True, overwrite_stc=True, overwrite_labels_data=True, n_jobs=args.n_jobs )) meg.call_main(args) # for subject in args.subject: for task in tasks: task = task.lower()
def read_cmd_args(argv=None, subject='', mri_subject='', atlas=''): if argv is None and subject != '': mri_subject = subject if mri_subject == '' else mri_subject argv = ['-s', subject, '-m', mri_subject] args = meg.read_cmd_args(argv) if atlas != '' and args.atlas != atlas: args.atlas = atlas args.pick_meg = False args.pick_eeg = True args.reject = False args.fwd_usingMEG = False args.fwd_usingEEG = True args.modality = 'eeg' args.meg_dir = utils.get_link_dir(LINKS_DIR, 'eeg') if not op.isdir(args.meg_dir): raise Exception('EEG dir can\'t be found! Please rerun src.setup with -f create_links') return args
def read_epoches_and_calc_activity(subject, mri_subject): args = meg.read_cmd_args(['-s', subject, '-m', mri_subject]) args.function = ['calc_stc_per_condition', 'calc_labels_avg_per_condition', 'smooth_stc', 'save_activity_map'] args.pick_ori = 'normal' args.colors_map = 'jet' meg.run_on_subjects(args)
def check_files_names(subject, mri_subject): args = meg.read_cmd_args(['-s', subject, '-m', mri_subject]) args.fname_format = '{subject}_02_f2-35_all_correct_combined' args.inv_fname_format = '{subject}_02_f2-35-ico-5-meg-eeg' args.function = 'print_names' meg.run_on_subjects(args)