fORP response box

fORP fibre optic (MR-compatible) response devices by CurrentDesigns: http://www.curdes.com/ This class is only useful when the fORP is connected via the serial port.

If you’re connecting via USB, just treat it like a standard keyboard. E.g., use a Keyboard component, and typically listen for Allowed keys '1', '2', '3', '4', '5'. Or use event.getKeys().

class psychopy.hardware.forp.ButtonBox(serialPort=1, baudrate=19200)[source]

Serial line interface to the fORP MRI response box.

To use this object class, select the box use setting serialPort, and connect the serial line. To emulate key presses with a serial connection, use getEvents(asKeys=True) (e.g., to be able to use a RatingScale object during scanning). Alternatively connect the USB cable and use fORP to emulate a keyboard.

fORP sends characters at 800Hz, so you should check the buffer frequently. Also note that the trigger event numpy the fORP is typically extremely short (occurs for a single 800Hz epoch).

Parameters:
serialPort :

should be a number (where 1=COM1, …)

baud :

the communication rate (baud), eg, 57600

classmethod _decodePress(pressCode)[source]
Returns a list of buttons and whether they’re pressed, given a
character code.
pressCode :
A number with a bit set for every button currently pressed. Will be between 0 and 31.
_generateEvents(pressCode)[source]

For a given button press, returns a list buttons that went from unpressed to pressed. Also flags any unpressed buttons as unpressed.

pressCode :
a number with a bit set for every button currently pressed.
clearBuffer()[source]

Empty the input buffer of all characters

clearStatus()[source]

Resets the pressed statuses, so getEvents will return pressed buttons, even if they were already pressed in the last call.

getEvents(returnRaw=False, asKeys=False, allowRepeats=False)[source]

Returns a list of unique events (one event per button pressed) and also stores a copy of the full list of events since last getEvents() (stored as ForpBox.rawEvts)

returnRaw :
return (not just store) the full event list
asKeys :
If True, will also emulate pyglet keyboard events, so that button 1 will register as a keyboard event with value “1”, and as such will be detectable using event.getKeys()
allowRepeats :
If True, this will return pressed buttons even if they were held down between calls to getEvents(). If the fORP is on the “Eprime” setting, you will get a stream of button presses while a button is held down. On the “Bitwise” setting, you will get a set of all currently pressed buttons every time a button is pressed or released. This option might be useful if you think your participant may be holding the button down before you start checking for presses.
getUniqueEvents(fullEvts=False)[source]

Returns a Python set of the unique (unordered) events of either a list given or the current rawEvts buffer


Back to top