diff --git a/MultiTaskBattery/task_blocks.py b/MultiTaskBattery/task_blocks.py index 62e5684c..08c34f09 100644 --- a/MultiTaskBattery/task_blocks.py +++ b/MultiTaskBattery/task_blocks.py @@ -343,7 +343,12 @@ def show_stim(self): def run_trial(self,trial): # get current time (self.t0) self.screen.fixation_cross() + send_event = getattr(self.const, 'send_event', None) + if send_event: + send_event('block_start_rest', self.ttl_clock.get_time(), task=self.name) self.ttl_clock.wait_until(self.start_time + trial['trial_dur']) + if send_event: + send_event('block_end', self.ttl_clock.get_time(), task=self.name) return trial class VerbGeneration(Task): diff --git a/docs/custom_experiments.rst b/docs/custom_experiments.rst index e66d0db7..ec4a1cae 100644 --- a/docs/custom_experiments.rst +++ b/docs/custom_experiments.rst @@ -126,6 +126,11 @@ defaults are used. - ``False`` - If ``True``, writes a BIDS ``events.tsv`` for each scan into ``/events/`` (see Output files). + * - ``send_event`` + - ``None`` + - A function the rest task calls when its fixation cross appears and when + it ends, as ``send_event(name, time, task='rest')`` with ``name`` + ``'block_start_rest'`` or ``'block_end'``, e.g. to send MEG triggers. * - ``task_modules`` - ``[]`` - List of imported Python modules that hold custom Task and TaskFile