Keypresses not properly registered in the experiment (appearing within the .log-file not the .csv)

Just as a follow-up:

I adjusted and tested several things but the bug/problem persists. I

  • removed “None” as an allowed key
  • split the code component used to present the keypresses and correct responses on the second screen and to log the trial performance measures into two parts. Before that, sometimes the .corr system variable and another logged variable that copied the status of that variable would differ but now the values are identical again.
  • added “key_resp_base.clearEvents()” in the beginning of the routine tab of the keyboard component to clear the keyboard buffer at the beginning of each trial
  • downloaded the most recent stable PsychoPy version that is also installed on the presentation computer of the scanner facility (v2024.2.4)
  • tried out a different buttonbox to check whether the problem stems from the hardware side

The problem still persists and the experiment runs fine for the first half of the experiment (i.e. the baseline block loops of the experiment) but gets progressively worse and does not log responses correctly (they appear as missed keypress without a reaction time).

However, the bug only appears at the scanner set-up and i cannot replicate it on my work laptop which complicates the debugging process.One more thing I noticed, is that the keyboard-component “.stopped” variable is not being logged consistently.

I will try out the approach from this post to change the logging of the response from “keypress” to “keyrelease” but it really is the last straw because I have no idea what else I could try out to make this work. Unfortunately, i cannot switch the key-release type as the interface does not include a button or display (e.g. I cannot switch between HID KEY vs. HID NAR and i don’t know which of these is currently active).

This is the current python & psychopy script and the latest logfile (produced with that same script):
sfb940a1-b03-experiment.psyexp (293.5 KB)
sfb940a1-b03-experiment.py (247.6 KB)
sfb940a1-b03-experiment_01_2025-05-19_10h18.10.620.csv (1.4 MB)

EDIT:
Might it perhaps be more sensible to use code component instead of using the preconfigured keyboard component? And would there be any examples for this approach? Perhaps it is a problem that the keyboard component is used 68 times per block and the performance of the component gets flakier or more errorprone with so many repeats?