I would like to output a results file for my experiment which contains the keys being pressed and the timepoints of those events (preferably as a Pandas Dataframe which I can save to csv).
It seems to me TrialHandler might be what I am looking for, but the documentation doesn’t seem to address saving keypress events, nor do the few examples I could find address any use cases similar to mine.
Can you help me out?
Basically I would be looking for something like
Here’s a non-self-contained code example of what I think things should look like:
while pre_evaluation or routineTimer.getTime() > 0: resp_key = event.getKeys(keyList=keylist) if pre_evaluation: if "return" in resp_key: routineTimer.reset() routineTimer.add(trial_duration) pre_evaluation=False else: pass # get current time t = trialClock.getTime() if resp_key: if resp_key in keys_of_interest: MyMagicObject.add([t, resp_key) win.flip()