bsl.triggers.TriggerDef#
- class bsl.triggers.TriggerDef(trigger_file=None)#
Class used to store pairs {str: int} of events name and events value.
Each name and each value is unique. The pairs can be read from a
.ini
file or edited manually withTriggerDef.add()
andTriggerDef.remove()
.The class will expose the name as attributes
self.event_str = event_int
for all pairs.- Parameters
trigger_file (None | path-like) –
Path to the
.ini
file containing the table converting event numbers into event strings.Note
The
.ini
file is read withconfigparser
and has to be structured as follows:[events] event_str_1 = event_id_1 # comment event_str_2 = event_id_2 # comment
Example:
[events] rest = 1 stim = 2
- Attributes
Methods
add
(name, value[, overwrite])Add an event to the trigger definition instance.
read
(trigger_file)Read events from a
.ini
trigger definition file.remove
(event)Remove an event from the trigger definition instance.
write
(trigger_file)Write events to a
.ini
trigger definition file.- add(name, value, overwrite=False)#
Add an event to the trigger definition instance.
- read(trigger_file)#
Read events from a
.ini
trigger definition file.Note
The
.ini
file is read withconfigparser
and has to be structured as follows:[events] event_str_1 = event_id_1 # comment event_str_2 = event_id_2 # comment
Example:
[events] rest = 1 stim = 2
- Parameters
trigger_file (path-like) – Path to the
.ini
file containing the table converting event numbers into event strings.
- remove(event)#
Remove an event from the trigger definition instance.
The event can be given by name (str) or by value (int).
- write(trigger_file)#
Write events to a
.ini
trigger definition file.Note
The
.ini
file is written withconfigparser
and is structured as follows:[events] event_str_1 = event_id_1 event_str_2 = event_id_2