The response module called “Cedrus button box” does not work correctly as is with either of these configs:
PsychoPy 1.85.6 (MacOS 10.13.3) or PsychoPy 1.90.0 (WinVista) while using the Cedrus response pads (LS-PAIR) with the Lumina controller, (Mode: Lumina, Speed:19200).
My intention was to use the button box with an fMRI experiment where the MRI sends a trigger signal to the Lumina upon beginning the sequence.
Problem: The module instructs the user to put in keys as a list or nothing to accept any response.
The expectation from other response modules (like keyboard) is that
‘0’,‘1’,‘2’,‘3’,‘4’
would be an appropriate list to include all response pad keys (0-3) and the trigger (4). I realize now that the tooltip indicates “key numbers separated by commas” but using integers instead of strings is not the entire solution.
The reference page here is not that clear on whether integers or strings are returned or what they mean:
http://www.psychopy.org/api/hardware/cedrus.html
E.g.1)
Allowed keys $: ‘0’,‘1’
has output of no response.
E.g.2)
Allowed keys $: 4
has error
TypeError: argument of type ‘int’ is not iterable
Solution:
The actual responses from the Lumina are returned by the pyxid module in PsychoPy as a dictionary called evt in the code.
Each keypress is stored in the dictionary as an integer not as a string, accessed by evt[‘key’].
Solution 1)
In builder for the cedrus module, set Allowed keys $: 0,1
so that in the code view you will see the line
if evt[‘key’] not in [0, 1]:
In general, any list of integers (not strings) with at least two values is fine.
Solution 2)
To have the module only look for the trigger signal (and ignore response pad presses by the fMRI subject):
In builder for the cedrus module, set Allowed keys $: [4]
so that in the code view you will see the line
if evt[‘key’] not in [4]:
In general: For a single number in the allowed keys input box the builder is not forming the list of allowed keys correctly and so the Python shown in the code view has a bug, that can be fixed by setting the allowed integer surrounded by square brackets so that it becomes a list in the code.