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:

interface : expyriment.io.SerialPort or expyriment.io.ParallelPort

the interface to use

default_code : int, optional

the default code of the trigger

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:

code : int, optional

a specific code to get

bitwise_comparison : bool, optional

make a bitwise comparison (default = False)

interface

Getter for interface

logging

Getter for logging.

set_logging(onoff)

Set logging of this object on or off

Parameters:

onoff : bool

set logging on (True) or off (False)

Notes

See also design.experiment.set_log_level fur further information about event logging.

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:

code : int, optional

a specific code to count

bitwise_comparison : bool, 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:

code : int, optional

a specific code to wait for

bitwise_comparison : bool, optional

make a bitwise comparison (default = False)

function : function, optional

function to repeatedly execute during waiting loop

process_control_events : bool, optional

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

See also

design.experiment.register_wait_callback_function

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!