OS (e.g. Win10): Win 10
PsychoPy version (e.g. 1.84.x): v2021.2.3
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?:
I want to record the number of correct button presses during the trial, and present total number correct during the feedback routine.
The “trial” routine is surrounded by two loops.
The first, inside loop, to choose image to present.
The second, outside loop, to choose subsets of the image list to shuffle, i.e., shuffle 0:3, 3:6, 6:9, 9:12…so on.
What did you try to make it work?:
This is my code in my “feedback” routine, to print in my feedback routine:
countCorr2 = int(trials_shuffler.trial.data[‘key_resp.corr’].sum())
$feedback_text = ‘You got str(countCorr2) correct.’
I reset countCorr2=0 at the beginning of every block, in the “Begin Experiment” tab.
What specifically went wrong when you tried that?:
Here is my error:
countCorr2 = int(trials_shuffler.trial.data[‘color_change_resp.corr’].sum())
AttributeError: ‘TrialHandler’ object has no attribute ‘trial’
To note, I have also tried:
countCorr2 = int(trial.data[‘key_resp.corr’].sum())
→ The experiment runs, but the incorrect number of correct button presses is recorded. I know this, when I compare the actual key_resp.corr column in the excel sheet output.
countCorr2 = int(trials_shuffler.data[‘key_resp.corr’].sum())
→ I get the error: KeyError: ‘color_change_resp.corr’
The feedback code works, if I remove the outer loop that shuffles a subset of trials.
Please advise, thank you so much.