Skip to content

Commit 235fab4

Browse files
committed
daysago3
1 parent d907cbb commit 235fab4

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

code/data_processing/plot_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ def _rt(df):
168168

169169
return ax2
170170
filtered = filter(df)
171-
print(filtered.head())
172171
acc = _percent_acc(filtered)
173172
rt = _rt(filtered)
174173

code/main_handler.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,29 +108,38 @@ def qc_cc_dfs(self, dfs, task):
108108
task=task)
109109
return categories, plots
110110

111-
112111
def qc_ps_dfs(self, dfs, task):
113112
categories, plots = [], []
114113
plot_instance = PS_PLOTS()
115114
print(task)
115+
116116
if task in ['PC', 'LC']:
117117
ps_instance = PS_QC('response_time', 'correct', 1, 0, 'block_c', 30000)
118-
for df in dfs:
119-
subject = df['subject_id'][1]
118+
for df in dfs[:]: # use a copy to safely modify the list during iteration
119+
try:
120+
subject = df['subject_id'][1]
121+
except Exception as e:
122+
print(f"Skipping df due to error accessing subject_id: {e}")
123+
dfs.remove(df)
124+
continue
125+
120126
print(f"qcing {subject}")
121-
category = ps_instance.ps_qc(df, threshold=0.6,)
122-
if task == 'PC':
123-
plot = plot_instance.lc_plot(df)
124-
elif task == 'LC':
125-
plot = plot_instance.lc_plot(df)
127+
category = ps_instance.ps_qc(df, threshold=0.6)
128+
plot = plot_instance.lc_plot(df)
126129
print(f"Category = {category}")
127130
categories.append([subject, category, df])
128131
plots.append([subject, plot])
129132

130133
else:
131134
ps_instance = PS_QC('block_dur', 'correct', 1, 0, 'block_c', 125)
132-
for df in dfs:
133-
subject = df['subject_id'][1]
135+
for df in dfs[:]:
136+
try:
137+
subject = df['subject_id'][1]
138+
except Exception as e:
139+
print(f"Skipping df due to error accessing subject_id: {e}")
140+
dfs.remove(df)
141+
continue
142+
134143
print(f"qcing {subject}")
135144
category = ps_instance.ps_qc(df, threshold=0.6, DSST=True)
136145
plot = plot_instance.dsst_plot(df)
@@ -139,10 +148,8 @@ def qc_ps_dfs(self, dfs, task):
139148
plots.append([subject, plot])
140149

141150
save_instance = SAVE_EVERYTHING()
142-
save_instance.save_dfs(categories=categories,
143-
task=task)
144-
save_instance.save_plots(plots=plots,
145-
task=task)
151+
save_instance.save_dfs(categories=categories, task=task)
152+
save_instance.save_plots(plots=plots, task=task)
146153

147154
return categories, plots
148155

0 commit comments

Comments
 (0)