Recovering Missed Key Presses from a PsychoPy Experiment

Hello everyone,

I recently ran a memory recall test where participants used two buttons to navigate a 7-point scale (-3, -2, -1, 0, 1, 2, 3). The idea was that pressing left would subtract 1 and pressing right would add 1, starting from the middle (0).

Unfortunately, I realized that our code only recorded the last keystroke instead of the full sequence. For example, if a participant clicked left three times (0 → -1 → -2 → -3) and then right once (-3 → -2), the output only captured “right,” missing the full sequence.

I was wondering if there’s any way to recover the missing keypress history from the .psydat file or reconstruct it from other data. I know .psydat files often contain more information than the .csv outputs, but I’m unsure how to access it properly. If the sequence of keypresses was logged somewhere, is there a way to retrieve it?

Any advice on extracting this data would be greatly appreciated!

Thanks in advance,
Elizabeth

The log file should be able to help. I’ve just looked at one of mine and I can see lines like this:

1.2383 	EXP 	text: text = 'colonial'
1.2383 	EXP 	text: autoDraw = True
1.7394 	EXP 	text: autoDraw = False
5.8475 	DATA 	Keypress: c
5.8739 	INFO 	Keyboard events cleared
6.1269 	DATA 	Keypress: o
6.2613 	DATA 	Keypress: l
6.4107 	DATA 	Keypress: o
6.9112 	DATA 	Keypress: r
7.0279 	DATA 	Keypress: i
7.1934 	DATA 	Keypress: a
7.3606 	DATA 	Keypress: l
7.7449 	DATA 	Keypress: return
7.8060 	INFO 	Keyboard events cleared
10.7264 	EXP 	text: text = 'dominion'
10.7264 	EXP 	text: autoDraw = True
11.2269 	EXP 	text: autoDraw = False
12.3957 	DATA 	Keypress: d
12.4267 	INFO 	Keyboard events cleared
12.4957 	DATA 	Keypress: o
12.6161 	DATA 	Keypress: m
12.8647 	DATA 	Keypress: i
12.9806 	DATA 	Keypress: n
13.2801 	DATA 	Keypress: i
13.3975 	DATA 	Keypress: o
13.5473 	DATA 	Keypress: n
14.2759 	DATA 	Keypress: return
14.2934 	INFO 	Keyboard events cleared
14.2927 	EXP 	text: autoDraw = False

It should be possible to write a Python script to calculate the scores for each trial. You could also try the csvFromPsyDat demo in the Coder.