Skip to content

Commit

Permalink
clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-nystrom committed Feb 29, 2024
1 parent 757ade7 commit 0c07bdd
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions demo_analyses/extract_trial_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,14 @@ def extract_trial_data(df_et_data, df_msg, msg_onset, msg_offset):

# Create a folder to put the trials
path = Path.cwd() / 'trials' / pid
try:
path.mkdir(parents=True, exist_ok=False)
except FileExistsError:
print("Folder is already there")
else:
print("Folder was created")
path.mkdir(parents=True, exist_ok=True)

# Extract relevant trial data and save in format required by I2MC
for t in trial_msg:
df_trial = extract_trial_data(df_gaze, df_msg, t[0], t[1])
df_trial.reset_index(inplace=True)

filename = t[0].split('_', 1)[1] + '.tsv'
df_trial.to_csv(str(path) + os.sep + filename, sep='\t')
df_trial.to_csv(str(path) + os.sep + filename, sep='\t', index=False)

print('Trial ' + filename + " written to folder ", path)

0 comments on commit 0c07bdd

Please sign in to comment.