expyriment.io.TriggerInput

class expyriment.io.TriggerInput(interface, default_code=None)

A class implementing a trigger input.

__init__(interface, default_code=None)

Create a trigger input.

Parameters:
interfaceexpyriment.io.SerialPort or expyriment.io.ParallelPort

the interface to use

default_codeint, optional

the default code of the trigger

property default_code

Getter for default_code

get_triggers(code=None, bitwise_comparison=False)

Get list of received triggers.

For not missing any triggers the history has to be updated regularly (e.g. by calling this method)! Returns None if no history is used.

If bitwise_comparision = True, the function performs a bitwise comparison (logical and) between code and received input and waits until a certain bit pattern is set.

Parameters:
codeint, optional

a specific code to get

bitwise_comparisonbool, optional

make a bitwise comparison (default = False)

property interface

Getter for interface

property logging

Getter for logging.

set_logging(onoff)

Set logging of this object on or off

Parameters:
onoffbool

set logging on (True) or off (False)

property trigger_count

Get the number of received triggers.

For not missing any triggers the history has to be updated regularly (e.g. by calling this method)! Returns None if no history is used.

If bitwise_comparision = True, the function performs a bitwise comparison (logical and) between code and received input and waits until a certain bit pattern is set.

Parameters:
codeint, optional

a specific code to count

bitwise_comparisonbool, optional

make a bitwise comparison (default = False)

wait(code=None, bitwise_comparison=False, callback_function=None, process_control_events=True)

Wait for a trigger.

Returns the code received and the reaction time [code, rt].

If bitwise_comparison = True, the function performs a bitwise comparison (logical and) between code and received input and waits until a certain bit pattern is set.

Parameters:
codeint, optional

a specific code to wait for

bitwise_comparisonbool, optional

make a bitwise comparison (default = False)

functionfunction, optional

function to repeatedly execute during waiting loop

process_control_eventsbool, optional

process io.Keyboard.process_control_keys() and io.Mouse.process_quit_event() (default = True)

Notes

This will also by default process control events (quit and pause). Thus, keyboard events will be cleared from the cue and cannot be received by a Keyboard().check() anymore!