sys.path.append('../../') # For functions file sys.path.append('..') # For config file import pandas as pd from mne import (read_evokeds, pick_channels) from mne.channels import combine_channels from sof_config import (analysis_dir, deriv_dir, task, bad_subs) from functions import (get_sub_list, mean_amplitude) # Handle directories out_erps = analysis_dir / 'erps' # Define the subjects sub_list = get_sub_list(deriv_dir, allow_all=True) # Remove subjects from list for bad_sub in bad_subs: sub_list.remove(bad_sub) # Ask for subject IDs to analyze for i, sub in enumerate(sub_list): # Define the Subject ID and paths deriv_path = deriv_dir / sub if int(sub[-3:]) < 200: age = 'young' else: age = 'older' print(sub, age)
# Dictionary of columns to rename in behavioral data file cols_to_rename = { 'frameRate': 'frame_rate', 'psychopyVersion': 'psychopy_version', 'TrialNumber': 'trial_number' } # List of columns to add to *events.tsv from behavioral data cols_to_add = [ 'trial_number', 'category', 'subcategory', 'repeat', 'resp', 'rt', 'correct', 'n_responses' ] # Get Subject List sub_list = get_sub_list(source_dir, is_source=True, allow_all=True) for sub in sub_list: # SUBJECT INFORMATION DEFINITION # Define the Subject ID and paths sub_id = sub.replace('sub-', '') bids_id = sub_id[-3:] source_path = source_dir / sub bids_path = BIDSPath(subject=bids_id, task=task, datatype='eeg', root=bids_dir) deriv_path = deriv_dir / f'sub-{bids_id}' deriv_path.mkdir(parents=True, exist_ok=True) print(f'Making BIDS data for sub-{bids_id} ({sub_id}) on task-{task}') print(f' Source Path: {source_path}')