stytra.triggering package¶
Module contents¶
This module contains Trigger objects that can be used to trigger the beginning of a stytra protocol from an external event, such as a message received via ZMQ from a microscope.
-
class
stytra.triggering.
Trigger
[source]¶ Bases:
multiprocessing.context.Process
Stytra uses
Trigger
objects to control the beginning of a stimulation protocol via an external event. In the most obvious case, the signal is sent by an acquisition device such as a microscope to synchronize data acquisition and stimulation. The trigger has a check_trigger function that is constantly called in a while loop in the run(). WhenTrigger
returns True, the start_event is set. The Experiment class, if it has a trigger assigned, will wait until the start_event to be set before starting. The control in check_trigger() is defined in subclasses to reflect the condition that we want to control the beginning of the protocol.Events
- start_event:
event that is set when check_trigger() returns True. It is used by stytra to control the beginning of the protocol;
- kill_event:
can be set to kill the Trigger process;
Output Queues
- queue_trigger_params:
can be used to send to the Experiment data about the triggering event or device. For example, if triggering happens from a microscope via a ZMQ message, setting of the microscope can be sent in that message to be saved together with experiment metadata.
-
class
stytra.triggering.
ZmqTrigger
(port)[source]¶ Bases:
stytra.triggering.Trigger
This trigger uses the ZMQ library to receive a json file from an external source such as a microscope. The port on which the communication is happening is taken as input. The source of the trigger must be configured with the IP and the port of the computer running the stytra session.
-
class
stytra.triggering.
U3LabJackPulseTrigger
(chan)[source]¶ Bases:
stytra.triggering.Trigger
” This triiger uses the labjack u3 to recieve a TTL pulse from an external source. The DIO number is used as input. The pin is initialized as input automatically