@@ -29,72 +29,85 @@ def getParameters(
29
29
----------
30
30
participant : str
31
31
Subject ID. Default is 'exteroStairCase'.
32
- session : int
33
- Session number. Default to '001'.
32
+ resultPath : str or None
33
+ Where to save the results.
34
+ screenNb : int
35
+ Screen number. Used to parametrize py:func:`psychopy.visual.Window`.
36
+ Default is set to 0.
34
37
serialPort: str
35
38
The USB port where the pulse oximeter is plugged. Should be written as
36
39
a string e.g., 'COM3', 'COM4'. If set to *None*, the pulse oximeter
37
40
will be automatically detected. using the
38
41
:py:func:`systole.recording.findOximeter()` function.
39
- taskVersion : str or None
40
- Task version to run. Can be 'Garfinkel', 'Shandry', 'test' or None.
41
- resultPath : str or None
42
- Where to save the results.
42
+ session : int
43
+ Session number. Default to '001'.
43
44
setup : str
44
45
Context of oximeter recording. Behavioral will record through a Nonin
45
46
pulse oximeter, *fMRI* will record through BrainVision amplifier
46
47
through TCP/IP conneciton. *test* will use pre-recorded pulse time
47
48
series (for testing only).
48
49
systole_kw : dict
49
50
Additional keyword arguments for :py:class:`systole.recorder.Oxmeter`.
51
+ taskVersion : str or None
52
+ Task version to run. Can be 'Garfinkel', 'Shandry', 'test' or None.
50
53
51
54
Attributes
52
55
----------
53
- restPeriod : bool
54
- If *True*, a resting period will be proposed before the task.
55
- restLength : int
56
- The length of the resting period (seconds). Default is 300 seconds.
57
- screenNb : int
58
- The screen number (Psychopy parameter). Default set to 0.
59
- randomize : bool
60
- If `True` (default), will randomize the order of the conditions. If
61
- taskVersion is not None, will use the default task parameter instead.
62
- startKey : str
63
- The key to press to start the task and go to next steps.
64
- rating : bool
65
- If `True` (default), will add a rating scale after the evaluation.
56
+ conditions : 1d array-like of str
57
+ The conditions. Can be 'Rest', 'Training' or 'Count'.
66
58
confScale : list
67
59
The range of the confidence rating scale.
60
+ heartLogo : `psychopy.visual.ImageStim`
61
+ Image presented during resting conditions.
68
62
labelsRating : list
69
63
The labels of the confidence rating scale.
70
- taskVersion : str or None
71
- Task version to run. Can be 'Garfinkel', 'Shandry' or None.
72
- times : 1d array-like of int
73
- Length of trials, in seconds.
74
- conditions : 1d array-like of str
75
- The conditions. Can be 'Rest', 'Training' or 'Count'.
76
- subjectID : str
77
- Subject identifiant.
78
- subjectNumber : int
79
- Subject reference number.
64
+ noteStart : psychopy.sound.Sound instance
65
+ The sound that will be played when trial starts.
66
+ noteStop : psychopy.sound.Sound instance
67
+ The sound that will be played when trial ends.
80
68
path : str
81
69
The task working directory.
82
- results : str
70
+ randomize : bool
71
+ If `True` (default), will randomize the order of the conditions. If
72
+ taskVersion is not None, will use the default task parameter instead.
73
+ rating : bool
74
+ If `True` (default), will add a rating scale after the evaluation.
75
+ restLength : int
76
+ The length of the resting period (seconds). Default is 300 seconds.
77
+ restLogo : `psychopy.visual.ImageStim`
78
+ Image presented during resting conditions.
79
+ restPeriod : bool
80
+ If *True*, a resting period will be proposed before the task.
81
+ resultPath : str
83
82
The subject result directory.
84
- note : `psychopy.sound`
85
- The sound played at trial start and trial end.
86
- win : `psychopy.visual.Window`
87
- Window where to present stimuli.
83
+ screenNb : int
84
+ The screen number (Psychopy parameter). Default set to 0.
88
85
serial : `serial.Serial`
89
86
The serial port used to record the PPG activity.
90
- restLogo : `psychopy.visual.ImageStim`
91
- Image presented during resting conditions .
92
- heartLogo : `psychopy.visual.ImageStim`
93
- Image presented during resting conditions .
87
+ startKey : str
88
+ The key to press to start the task and go to next steps .
89
+ taskVersion : str or None
90
+ Task version to run. Can be 'Garfinkel', 'Shandry', 'test' or None .
94
91
texts : dict
95
92
Dictionnary containing the texts to be presented.
96
93
textSize : float
97
94
Text size.
95
+ triggers : dict
96
+ Dictionary {str, callable or None}. The function will be executed
97
+ before the corresponding trial sequence. The default values are
98
+ `None` (no trigger sent).
99
+ * `"trialStart"`
100
+ * `"trialStop"`
101
+ * `"listeningStart"`
102
+ * `"listeningStop"`
103
+ * `"decisionStart"`
104
+ * `"decisionStop"`
105
+ * `"confidenceStart"`
106
+ * `"confidenceStop"`
107
+ times : 1d array-like of int
108
+ Length of trials, in seconds.
109
+ win : `psychopy.visual.window`
110
+ The window in which to draw objects.
98
111
"""
99
112
parameters : Dict [str , Any ] = {}
100
113
parameters ["restPeriod" ] = True
@@ -106,6 +119,21 @@ def getParameters(
106
119
parameters ["labelsRating" ] = ["Guess" , "Certain" ]
107
120
parameters ["taskVersion" ] = taskVersion
108
121
parameters ["results_df" ] = pd .DataFrame ({})
122
+ parameters ["setup" ] = setup
123
+
124
+ # Initialize triggers dictionary with None
125
+ # Some or all can later be overwrited with callable
126
+ # sending the information needed.
127
+ parameters ["triggers" ] = {
128
+ "trialStart" : None ,
129
+ "trialStop" : None ,
130
+ "listeningStart" : None ,
131
+ "listeningStop" : None ,
132
+ "decisionStart" : None ,
133
+ "decisionStop" : None ,
134
+ "confidenceStart" : None ,
135
+ "confidenceStop" : None ,
136
+ }
109
137
110
138
# Experimental design - can choose between a version based on recent
111
139
# papers from Sarah Garfinkel's group, or the classic Schandry approach.
@@ -149,30 +177,32 @@ def getParameters(
149
177
parameters ["noteStart" ] = sound .Sound (
150
178
pkg_resources .resource_filename ("cardioception.HBC" , "Sounds/start.wav" )
151
179
)
152
- parameters ["noteEnd" ] = sound .Sound (
180
+
181
+ parameters ["noteStop" ] = sound .Sound (
153
182
pkg_resources .resource_filename ("cardioception.HBC" , "Sounds/stop.wav" )
154
183
)
155
184
156
185
# Open window
186
+ if parameters ["setup" ] == "test" :
187
+ fullscr = False
157
188
parameters ["win" ] = visual .Window (screen = screenNb , fullscr = fullscr , units = "height" )
158
189
parameters ["win" ].mouseVisible = False
159
190
160
191
parameters ["restLogo" ] = visual .ImageStim (
161
192
win = parameters ["win" ],
162
193
units = "height" ,
163
- image = os . path . dirname ( __file__ ) + "/ Images/rest.png" ,
194
+ image = pkg_resources . resource_filename ( __name__ , " Images/rest.png") ,
164
195
pos = (0.0 , - 0.2 ),
165
196
)
166
197
parameters ["restLogo" ].size *= 0.15
167
198
parameters ["heartLogo" ] = visual .ImageStim (
168
199
win = parameters ["win" ],
169
200
units = "height" ,
170
- image = os . path . dirname ( __file__ ) + "/ Images/heartbeat.png" ,
201
+ image = pkg_resources . resource_filename ( __name__ , " Images/heartbeat.png") ,
171
202
pos = (0.0 , - 0.2 ),
172
203
)
173
204
parameters ["heartLogo" ].size *= 0.05
174
205
175
- parameters ["setup" ] = setup
176
206
if setup == "behavioral" :
177
207
# PPG recording
178
208
if serialPort is None :
0 commit comments