@@ -68,32 +68,30 @@ class VisualOddballVE(VisionEggFeedback):
68
68
69
69
70
70
def init_parameters (self ):
71
- print "in init"
72
71
73
- #self.geometry = [100, 100, 800, 550]
74
- self .center = [self .geometry [2 ]/ 2 , self .geometry [3 ]/ 2 ]
72
+ #self.geometry = [100, 100, 800, 550]
75
73
self .nTrials = 16
76
74
self .nTrials_per_block = 8
77
75
self .dev_perc = 0.25
78
76
self .countdown_start = 2
79
77
self .show_standards = True
80
- self .show_fixation_cross = False
78
+ self .show_fixation_cross = True
81
79
self .give_feedback = True # will be ignored if self.response=='none'
82
80
self .group_stim_markers = False
83
81
self .dd_dist = 0 # no constraint if deviant-deviant distance is 0 (cf. constraint_stim_sequence() )
84
82
85
83
self .DIR_DEV = 'C:\img_oddball\dev'
86
84
self .DIR_STD = 'C:\img_oddball\std'
87
- self .logfilename = 'C:\img_oddball\log.txt '
85
+ self .logfilename = ''
88
86
# stimuli_opts = ['load', 'predefined']
89
87
# self.stimuli = stimuli_opts[1]
90
88
91
89
# response options
92
- self .eob_response = True # type in e.g. number of deviants after each block?
90
+ self .eob_response = False # type in e.g. number of deviants after each block?
93
91
response_opts = ['none' , 'dev_only' , 'both' ] # none: subject should not press a key
94
92
# dev_only: subject should press only for deviants
95
93
# both: subject response for both stds and devs
96
- self .response = response_opts [0 ]
94
+ self .response = response_opts [2 ]
97
95
self .rsp_key_dev = 'f'
98
96
self .rsp_key_std = 'j'
99
97
self .hitstr = 'Hit'
@@ -105,17 +103,15 @@ def init_parameters(self):
105
103
self .prestim_ival = 1.
106
104
#self.fixation_cross_time = self.prestim_ival
107
105
self .stim_duration = 1.
108
- self .responsetime_duration = 0 # 2.
106
+ self .responsetime_duration = 2.
109
107
self .feedback_duration = 2.
110
-
111
- #self.gameover_duration = 3000
112
- #self.shortpauseDuration = 10000
108
+
113
109
114
110
self .VEstimuli = True
115
111
if self .VEstimuli :
116
112
self .std , self .dev = self .define_stimuli ()
117
113
else :
118
- self .std , self .dev = self .load_stimuli ()
114
+ self .std , self .dev = self .load_stimuli ()
119
115
120
116
self .bg_color = 'grey'
121
117
@@ -124,7 +120,7 @@ def init_parameters(self):
124
120
125
121
126
122
def run (self ):
127
-
123
+
128
124
nBlocks = int (ceil (1.0 * self .nTrials / self .nTrials_per_block ))
129
125
self .create_log ()
130
126
@@ -137,10 +133,8 @@ def run(self):
137
133
self .create_stim_seq ()
138
134
139
135
# Init image and text object
140
- self .image = self .add_image_stimulus (position = self .center )
141
- self .text = self .add_text_stimulus (position = (self .geometry [2 ]/ 2 ,self .geometry [3 ]/ 2 ),on = False ) #self.center)
142
- #self.im = self.add_image('C:\img_oddball\dev\deviant.jpg',anchor='center',position=self.center)
143
- #self.text = self.add_text('',position=self.center,on=False)
136
+ self .image = self .add_image_stimulus (position = [self .geometry [2 ]/ 2 , self .geometry [3 ]/ 2 ])
137
+ self .text = self .add_text_stimulus (position = (self .geometry [2 ]/ 2 ,self .geometry [3 ]/ 2 ),on = False ) #[self.geometry[2]/2, self.geometry[3]/2])
144
138
145
139
# This feedback uses a generator function for controlling the stimulus
146
140
# transition. Note that the function has to be called before passing
@@ -149,14 +143,12 @@ def run(self):
149
143
# Pass the transition function and the pre-stimulus display durations
150
144
# to the stimulus sequence factory.
151
145
if self .give_feedback :
152
- s = self .stimulus_sequence (generator , [self .prestim_ival , 0.001 , self .stim_duration , self .responsetime_duration , 0.01 , self .feedback_duration ])
146
+ s = self .stimulus_sequence (generator , [self .prestim_ival , self .stim_duration , self .responsetime_duration , 0.01 , self .feedback_duration ])
153
147
else :
154
- s = self .stimulus_sequence (generator , [self .prestim_ival , 0.001 , self .stim_duration , self .responsetime_duration , 0.01 ])
148
+ s = self .stimulus_sequence (generator , [self .prestim_ival , self .stim_duration , self .responsetime_duration , 0.01 ])
155
149
156
150
self ._view .countdown ()
157
151
158
- #self._view.present_center_word('test',1)
159
-
160
152
# Start the stimulus sequence
161
153
s .run ()
162
154
@@ -189,28 +181,27 @@ def prepare(self):
189
181
for n , stim in enumerate (self .stim_pres_seq ):
190
182
191
183
# Init Trial
192
- #self.send_parallel(marker.TRIAL_START)
193
184
self .responded = False
194
185
if self .stim_seq [n ] == 1 :
195
186
self .isdeviant = True
196
187
else :
197
188
self .isdeviant = False
198
189
199
- # Prestimulus interval
190
+ # Prestimulus interval
200
191
if self .show_fixation_cross :
201
- self ._trigger (marker .FIXATION_START )
192
+ self ._trigger (marker .FIXATION_START , wait = True )
202
193
self .text .set (text = '+' ,on = True )
203
194
yield
204
195
if self .show_fixation_cross :
205
- self .text .set (text = '' ,on = False )
206
- # self._trigger(marker.FIXATION_END)
207
- yield
196
+ self .text .set (text = '' ,on = False )
197
+ self ._view . update ()
198
+
208
199
# Present Stimulus
209
200
self .response = True
210
201
if self .isdeviant :
211
- self ._trigger (self .DEVIANT )
202
+ self ._trigger (self .DEVIANT , wait = False )
212
203
else :
213
- self ._trigger (self .STANDARD )
204
+ self ._trigger (self .STANDARD , wait = False )
214
205
if self .show_standards or self .isdeviant :
215
206
if self .VEstimuli :
216
207
self .set_stimuli (stim )
@@ -226,19 +217,18 @@ def prepare(self):
226
217
self .image .set (on = False )
227
218
yield
228
219
yield
220
+
229
221
self .response = False
230
222
231
- # Give Feedback
223
+ # Give Feedback about Response
232
224
if self .give_feedback :
233
- self ._trigger (marker .FEEDBACK_START )
234
225
if not self .responded :
235
226
self .text .set (text = self .norespstr ,on = True )
236
227
else :
237
228
self .text .set (on = True )
238
229
yield
239
- self ._trigger (marker .FEEDBACK_END )
240
- self .text .set (on = False )
241
- #self.send_parallel(marker.TRIAL_END)
230
+ self .text .set (on = False )
231
+ self ._view .update ()
242
232
243
233
244
234
def create_stim_seq (self ,nTrials = None ):
@@ -321,9 +311,9 @@ def define_stimuli(self):
321
311
Creates standard and deviant stimuli.
322
312
"""
323
313
# The stimului. This can be anything compatible with VisionEgg
324
- dev = FilledCircle (color = (0 ,1.0 ,0 ), position = self .center , radius = 100 )
325
- std1 = Target2D (color = (0 ,0 ,1.0 ), position = self .center , size = (200 ,200 ))
326
- std2 = std1
314
+ dev = FilledCircle (color = (0 ,1.0 ,0 ), position = [ self .geometry [ 2 ] / 2 , self . geometry [ 3 ] / 2 ] , radius = 100 )
315
+ std1 = Target2D (color = (0 ,0 ,1.0 ), position = [ self .geometry [ 2 ] / 2 , self . geometry [ 3 ] / 2 ] , size = (200 ,200 ))
316
+ std2 = Target2D ( color = ( 1.0 , 0 , 0 ), position = [ self . geometry [ 2 ] / 2 , self . geometry [ 3 ] / 2 ], size = ( 200 , 200 ))
327
317
#dev = Text(text='Deviant', font_size=72, position=(300, 200), anchor='center')
328
318
#std1 = Text(text='Standard I', font_size=72, position=(300, 200), anchor='center')
329
319
#std2 = Text(text='Standard II', font_size=72, position=(300, 200), anchor='center')
0 commit comments