Skip to content

Instantly share code, notes, and snippets.

@adelavega
Created July 24, 2017 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adelavega/7847a7595414a8c357d440de1c1cf6da to your computer and use it in GitHub Desktop.
Save adelavega/7847a7595414a8c357d440de1c1cf6da to your computer and use it in GitHub Desktop.
Fix stim_files in studyorrest
from bids.grabbids import BIDSLayout
import pandas as pd
import os.path as op
layout = BIDSLayout('../')
event_files = layout.get(task='objectcategories', type='events', return_type='file')
for f in event_files:
events = pd.read_csv(f, delimiter='\t')
events['stim_file'] = events.stim_file.str.replace('stimuli/', '')
events.to_csv(f, sep='\t')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment