expyriment.io.extras.CedrusResponseDevice

class expyriment.io.extras.CedrusResponseDevice(device_ID=0, error_screen=True)

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

__init__(device_ID=0, error_screen=True)

Create a Cedrus Device Input.

Parameters :

device_id : int, optional

device ID (default=0). Only required if more than one Cedrus Devices are connected.

error_screen : bool, optional

set False to switch off the ‘device not found’ error screen. An exception will be raise instead (default=True)

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.

buffer

Getter for buffer.

check(codes=None)

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

key codes to check for

Returns :

key : int

code of pressed key

rt : int

reaction time in ms

clear()

Clear device and all events in the response cues.

id

Getter for XID device id.

poll_responses()

Poll the Cedrus response device and copies the available response in the buffer.

Returns :

out : bool

True is a new response was available.

Notes

Release key events get a code larger 999 (1000 + key code).

wait(codes=None, duration=None, no_clear_buffer=False, check_for_control_keys=True)

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

codes to wait for

duration : int, optional

maximal time to wait in ms

no_clear_buffer : bool, optional

do not clear the buffer. In this case RT could be negative, if the event is already in the buffer (default = False)

check_for_control_keys : bool, optional

checks if control key has been pressed (default = True)

Returns :

key : int

code of pressed key

rt : int

reaction time in ms

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!

xid_interface

Getter for xid device interface.

Previous topic

expyriment.io.extras.defaults

Next topic

expyriment.io.extras.MidiIn

This Page