A class implementing a Cedrus XID response device.
Notes
The CedrusResponseDevice class requires a free Python package for Cedrus devices called “pyxid”. For installation instructions see Expyriment online documentation:
The class does not use the hardware timer, due to the known bug in the Cedrus hardware. Events will be time stamped by Expyriment. Thus, ensure constant polling / checking when not using the wait function.
To install Cedrus resonse device under Linux, you have to set the USB product ID. To do so, edit the file /etc/modules and add the following line:
ftdi_sio vendor=0403 product=f228
Methods
Create a Cedrus Device Input.
Parameters : | device_id : int, optional
error_screen : bool, optional
|
---|
Notes
If no Cedrus device is connected, an error text screen will be presented informing that the device could not be found and suggesting to check the connection and to switch on the device. After keypress the class tries to reconnect with the device. Use <q> to quit this procedure.
Getter for buffer.
Check for a specific response code occurred since last clear().
The function polls the device and returns the first event found in the buffer (i.e., since last clear) or None.
Parameters : | codes : int or list, optional
|
---|---|
Returns : | key : int
rt : int
|
Clear device and all events in the response cues.
Getter for XID device id.
Poll the Cedrus response device and copies the available response in the buffer.
Returns : | out : bool
|
---|
Notes
Release key events get a code larger 999 (1000 + key code).
Wait for responses defined as codes.
The functions returns the found key code and the reaction time, that is, the time relative to the called of wait. By default the buffer will be cleared() before waiting.
Parameters : | codes : int or list, optional
duration : int, optional
no_clear_buffer : bool, optional
check_for_control_keys : bool, optional
|
---|---|
Returns : | key : int
rt : int
|
Notes
The function checks for control keys (quit and pause) by default. Thus, keyboard events will be cleared from the cue and cannot be received by a Keyboard().check() anymore!
Getter for xid device interface.