File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed
iblrig_custom_tasks/nate_adaptiveTimeoutChoiceWorld Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ """
2+ This task inherits TrainingChoiceWorldSession with the addition of configurable, adaptive timeouts for incorrect
3+ choices depending on the stimulus contrast.
4+ """
5+
6+ import logging
7+ from pathlib import Path
8+
9+ import yaml
10+
11+ from iblrig .base_choice_world import TrainingChoiceWorldSession
12+ from iblrig .misc import get_task_arguments
13+ from pybpodapi .state_machine import StateMachine
14+
15+ log = logging .getLogger ('iblrig.task' )
16+
17+
18+ # read defaults from task_parameters.yaml
19+ with open (Path (__file__ ).parent .joinpath ('task_parameters.yaml' )) as f :
20+ DEFAULTS = yaml .safe_load (f )
21+
22+
23+ class AdaptiveTimeoutStateMachine (StateMachine ):
24+ def add_state (self , ** kwargs ):
25+ super ().add_state (** kwargs )
26+
27+
28+ class Session (TrainingChoiceWorldSession ):
29+ protocol_name = 'nate_adaptiveTimeoutChoiceWorld'
30+
31+ def __init__ (self , * args , ** kwargs ):
32+ super ().__init__ (* args , ** kwargs )
33+
34+ def _instantiate_state_machine (self , trial_number = None ):
35+ return AdaptiveTimeoutStateMachine (self .bpod )
36+
37+
38+ if __name__ == '__main__' : # pragma: no cover
39+ kwargs = get_task_arguments (parents = [Session .extra_parser ()])
40+ sess = Session (** kwargs )
41+ sess .run ()
You can’t perform that action at this time.
0 commit comments