-
Notifications
You must be signed in to change notification settings - Fork 0
/
Experiment_part1.osexp
565 lines (517 loc) · 21.4 KB
/
Experiment_part1.osexp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
---
API: 2
OpenSesame: 3.1.3
Platform: nt
---
set width 1024
set uniform_coordinates yes
set title "PyGaze eye-tracking template"
set subject_parity even
set subject_nr 0
set start experiment
set sound_sample_size -16
set sound_freq 48000
set sound_channels 2
set sound_buf_size 1024
set sampler_backend legacy
set round_decimals 2
set mouse_backend xpyriment
set keyboard_backend legacy
set height 768
set fullscreen no
set form_clicks no
set foreground white
set font_underline no
set font_size 18
set font_italic no
set font_family mono
set font_bold no
set experiment_path "C:\\Users\\Ilse\\Dropbox\\dropboxinhoud\\LINGUISTICS\\jaar 2\\Internship"
set disable_garbage_collection yes
set description "A template for eye-tracking experiments"
set coordinates relative
set compensation 0
set color_backend legacy
set clock_backend legacy
set canvas_backend xpyriment
set bidi yes
set background black
define sketchpad break
set duration keypress
set description "Displays stimuli"
draw textline center=1 color="#ffffff" font_bold=no font_family=mono font_italic=no font_size=20 html=yes show_if=always text="Time for a break!<br /><br /><br /> Press a key as soon as you are<br/><br/> ready to start another round." x=0 y=0 z_index=0
define sketchpad end_of_practice
set duration keypress
set description "Displays stimuli"
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=20 html=yes show_if=always text="This is the end of the practice round <br/><br/>If you have any questions at this moment, <br/><br/>please ask them. <br /><br /><br /><br />Otherwise, <u>press any key</u> to continue.<br /><br/>You will no longer get feedback on your answers." x=0 y=0 z_index=0
define sequence experiment
set flush_keyboard yes
set description "The main sequence of the experiment"
run response_mapping always
run general_instructions always
run pygaze_init always
run instructions_practiceround always
run practice_loop always
run experimental_loop always
run break always
define loop experimental_block_loop
set source_file "table.xlsx"
set source table
set skip 0
set repeat 1
set order random
set offset no
set item trial_sequence
set description "A single block of trials"
set cycles 52
set continuous no
set column_order ""
set break_if_on_first yes
set break_if never
setcycle 0 image "118330.png"
setcycle 0 sound "118330.wav"
setcycle 0 verification "Does this look like a private residence"
setcycle 0 correct_response "[no_button]"
setcycle 1 image "148963.png"
setcycle 1 sound "148963.wav"
setcycle 1 verification "Are they all looking towars the camera?"
setcycle 1 correct_response "[no_button]"
setcycle 2 image "309371.png"
setcycle 2 sound "309371.wav"
setcycle 2 verification "Are there more than six people visible?"
setcycle 2 correct_response "[no_button]"
setcycle 3 image "509864.png"
setcycle 3 sound "509864.wav"
setcycle 3 verification "Is everyone wearing a red t-shirt?"
setcycle 3 correct_response "[no_button]"
setcycle 4 image "180002.png"
setcycle 4 sound "180002.wav"
setcycle 4 verification "Are these people standing on the beach with the sea in the background?"
setcycle 4 correct_response "[no_button]"
setcycle 5 image "253903.png"
setcycle 5 sound "253903.wav"
setcycle 5 verification "Was this picture taken when it was hot outside?"
setcycle 5 correct_response "[no_button]"
setcycle 6 image "366109.png"
setcycle 6 sound "366109.wav"
setcycle 6 verification "Is this person a teenager?"
setcycle 6 correct_response "[no_button]"
setcycle 7 image "538742.png"
setcycle 7 sound "538742.wav"
setcycle 7 verification "Are windows visible? "
setcycle 7 correct_response "[no_button]"
setcycle 8 image "365745.png"
setcycle 8 sound "365745.wav"
setcycle 8 verification "Is this a rural scene? "
setcycle 8 correct_response "[no_button]"
setcycle 9 image "182523.png"
setcycle 9 sound "182523.wav"
setcycle 9 verification "Are these people ready to start skiing?"
setcycle 9 correct_response "[no_button]"
setcycle 10 image "329952.png"
setcycle 10 sound "329952.wav"
setcycle 10 verification "Is it snowing?"
setcycle 10 correct_response "[no_button]"
setcycle 11 image "327663.png"
setcycle 11 sound "327663.wav"
setcycle 11 verification "Is anyone trying to get past the policemen?"
setcycle 11 correct_response "[no_button]"
setcycle 12 image "424694.png"
setcycle 12 sound "424694.wav"
setcycle 12 verification "Is the fire truck in front of the ambulance?"
setcycle 12 correct_response "[no_button]"
setcycle 13 image "91500.png"
setcycle 13 sound "91500.wav"
setcycle 13 verification "Do they both have short hair?"
setcycle 13 correct_response "[yes_button"
setcycle 14 image "335524.png"
setcycle 14 sound "335524.wav"
setcycle 14 verification "Is one of the women wearing a white coat?"
setcycle 14 correct_response "[yes_button]"
setcycle 15 image "115005.png"
setcycle 15 sound "115005.wav"
setcycle 15 verification "Is there a bicycle in the room?"
setcycle 15 correct_response "[yes_button]"
setcycle 16 image "402531.png"
setcycle 16 sound "402531.wav"
setcycle 16 verification "Are both people holding a camera in one of their hands?"
setcycle 16 correct_response "[yes_button]"
setcycle 17 image "401977.png"
setcycle 17 sound "401977.wav"
setcycle 17 verification "Are these kites for sale?"
setcycle 17 correct_response "[yes_button]"
setcycle 18 image "69856.png"
setcycle 18 sound "69856.wav"
setcycle 18 verification "Is that taxi in a hurry?"
setcycle 18 correct_response "[yes_button]"
setcycle 19 image "327032.png"
setcycle 19 sound "327032.wav"
setcycle 19 verification "Is the man laughing?"
setcycle 19 correct_response "[yes_button]"
setcycle 20 image "57361.png"
setcycle 20 sound "57361.wav"
setcycle 20 verification "Are there any crosswalks visible?"
setcycle 20 correct_response "[yes_button]"
setcycle 21 image "405007.png"
setcycle 21 sound "405007.wav"
setcycle 21 verification "Is it spring?"
setcycle 21 correct_response "[yes_button]"
setcycle 22 image "108655.png"
setcycle 22 sound "108655.wav"
setcycle 22 verification "Is the train moving?"
setcycle 22 correct_response "[yes_button]"
setcycle 23 image "518157.png"
setcycle 23 sound "518157.wav"
setcycle 23 verification "Is the man on the skateboard wearing a suit?"
setcycle 23 correct_response "[yes_button]"
setcycle 24 image "534734.png"
setcycle 24 sound "534734.wav"
setcycle 24 verification "Are only children playing tennis?"
setcycle 24 correct_response "[yes_button]"
setcycle 25 image "457986.png"
setcycle 25 sound "457986.wav"
setcycle 25 verification "Is someone currently living in this space?"
setcycle 25 correct_response "[yes_button]"
setcycle 26 image "120320.png"
setcycle 26 sound "120320.wav"
setcycle 26 verification ""
setcycle 26 correct_response ""
setcycle 27 image "433232.png"
setcycle 27 sound "433232.wav"
setcycle 27 verification ""
setcycle 27 correct_response ""
setcycle 28 image "44372.png"
setcycle 28 sound "44372.wav"
setcycle 28 verification ""
setcycle 28 correct_response ""
setcycle 29 image "324611.png"
setcycle 29 sound "324611.wav"
setcycle 29 verification ""
setcycle 29 correct_response ""
setcycle 30 image "193488.png"
setcycle 30 sound "193488.wav"
setcycle 30 verification ""
setcycle 30 correct_response ""
setcycle 31 image "368541.png"
setcycle 31 sound "368541.wav"
setcycle 31 verification ""
setcycle 31 correct_response ""
setcycle 32 image "42947.png"
setcycle 32 sound "42947.wav"
setcycle 32 verification ""
setcycle 32 correct_response ""
setcycle 33 image "36077.png"
setcycle 33 sound "36077.wav"
setcycle 33 verification ""
setcycle 33 correct_response ""
setcycle 34 image "5587.png"
setcycle 34 sound "5587.wav"
setcycle 34 verification ""
setcycle 34 correct_response ""
setcycle 35 image "197950.png"
setcycle 35 sound "197950.wav"
setcycle 35 verification ""
setcycle 35 correct_response ""
setcycle 36 image "86435.png"
setcycle 36 sound "86435.wav"
setcycle 36 verification ""
setcycle 36 correct_response ""
setcycle 37 image "548713.png"
setcycle 37 sound "548713.wav"
setcycle 37 verification ""
setcycle 37 correct_response ""
setcycle 38 image "67727.png"
setcycle 38 sound "67727.wav"
setcycle 38 verification ""
setcycle 38 correct_response ""
setcycle 39 image "409489.png"
setcycle 39 sound "409489.wav"
setcycle 39 verification ""
setcycle 39 correct_response ""
setcycle 40 image "504852.png"
setcycle 40 sound "504852.wav"
setcycle 40 verification ""
setcycle 40 correct_response ""
setcycle 41 image "171733.png"
setcycle 41 sound "171733.wav"
setcycle 41 verification ""
setcycle 41 correct_response ""
setcycle 42 image "30434.png"
setcycle 42 sound "30434.wav"
setcycle 42 verification ""
setcycle 42 correct_response ""
setcycle 43 image "319935.png"
setcycle 43 sound "319935.wav"
setcycle 43 verification ""
setcycle 43 correct_response ""
setcycle 44 image "54589.png"
setcycle 44 sound "54589.wav"
setcycle 44 verification ""
setcycle 44 correct_response ""
setcycle 45 image "458572.png"
setcycle 45 sound "458572.wav"
setcycle 45 verification ""
setcycle 45 correct_response ""
setcycle 46 image "208011.png"
setcycle 46 sound "208011.wav"
setcycle 46 verification ""
setcycle 46 correct_response ""
setcycle 47 image "294663.png"
setcycle 47 sound "294663.wav"
setcycle 47 verification ""
setcycle 47 correct_response ""
setcycle 48 image "8369.png"
setcycle 48 sound "8369.wav"
setcycle 48 verification ""
setcycle 48 correct_response ""
setcycle 49 image "117961.png"
setcycle 49 sound "117961.wav"
setcycle 49 verification ""
setcycle 49 correct_response ""
setcycle 50 image "167599.png"
setcycle 50 sound "167599.wav"
setcycle 50 verification ""
setcycle 50 correct_response ""
setcycle 51 image "307784.png"
setcycle 51 sound "307784.wav"
setcycle 51 verification ""
setcycle 51 correct_response ""
run trial_sequence
define sequence experimental_block_sequence
set flush_keyboard yes
set description "A sequence containing a single block of trials followed by feedback to the participant"
run experimental_block_loop always
define loop experimental_loop
set source_file ""
set source table
set skip 0
set repeat 1
set order random
set offset no
set item block_sequence
set description "A loop containing one or more experimental blocks"
set cycles 1
set continuous no
set column_order practice
set break_if_on_first yes
set break_if never
setcycle 0 practice no
run experimental_block_sequence
define sketchpad general_instructions
set duration keypress
set description "Displays stimuli"
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=20 html=yes show_if=always text="Please find a relaxing position <br /><br/>to sit in for the next 15 minutes.<br /><br /><br/>You are allowed to move your head, but move<br/><br /> the rest of your body as little as possible.<br/><br /><br/>As a first exercise, you are asked to follow<br /><br/> the dots. <u>Press a key</u> to continue to <br/><br/> this exercise. Good luck!<br /><br/>" x=0 y=0 z_index=0
define sketchpad instructions_practiceround
set start_response_interval no
set duration keypress
set description "A sketchpad containing the instructions for the participant"
draw textline center=1 color=black font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="" x=-608 y=-512 z_index=0
draw textline center=1 color=black font_bold=no font_family=mono font_italic=no font_size=22 html=yes show_if=always text="" x=0 y=0 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=20 html=yes show_if=always text="A practice round will start<br/><br/> after you <u>press a key</u>. <br /><br /><br/>Please listen and look carefully, <br /><br/> and answer any questions that pop up.<br /><br/><br/> You can answer the questions by <br /><br/>pressing the right or the left arrow key." x=0 y=0 z_index=0
define logger logger
set description "Logs experimental data"
set auto_log yes
define feedback new_feedback_1
set reset_variables yes
set duration 495
set description "Provides feedback to the participant"
draw textline center=1 color=green font_bold=no font_family=mono font_italic=no font_size=20 html=yes show_if=always text="Correct!" x=0 y=0 z_index=0
define feedback new_feedback_2
set reset_variables yes
set duration 495
set description "Provides feedback to the participant"
draw textline center=1 color=red font_bold=no font_family=mono font_italic=no font_size=20 html=yes show_if=always text=False x=0 y=0 z_index=0
define inline_script new_inline_script
set description "Executes Python code"
set _run ""
set _prepare ""
define inline_script new_inline_script_2
set description "Executes Python code"
___run__
my_canvas = canvas () #create canvas-object
#path = exp.pool[var.image] #path to one of the images in the pool
path = "C:\\Users\\Ilse\\Desktop\\Stage\\random_images\\coco_id\\" + str(var.image)
my_canvas.image(path) #put the image on the canvas
my_canvas.show() #show the canvas
clock.sleep(2995) # wait 3 seconds
#src = pool[var.sound] #path to one of the sounds in the pool
src = "C:\\Users\\Ilse\\Desktop\\Stage\\wav\\" + str(var.sound)
my_sampler = sampler(src, volume=1) #create sampler-object
my_sampler.play() #play the sound
my_canvas.show() #and also show the picture again
for i in range(5000): # check for 5 seconds... (check longest sample duration)
if my_sampler.is_playing(): # ...whether the sound is still playing
clock.sleep(1) # if it is playing, wait for 1 ms
i = i + 1
else:
break # if the sound stopped playing, stop
clock.sleep(1495) #wait another 1500 ms
# I need check if the timing is correct... with clock.time() ? how to print these times?
__end__
set _prepare ""
define keyboard_response new_keyboard_response
set timeout infinite
set flush yes
set duration keypress
set description "Collects keyboard responses"
set correct_response "[correct_response]"
set allowed_responses "left;right"
define pygaze_drift_correct new_pygaze_drift_correct
set ypos 0
set xpos 0
set target_style default
set target_color "[foreground]"
set fixation_triggered yes
set draw_target yes
set description "Perform eye-tracker drift correction"
define pygaze_log new_pygaze_log
set throttle 2
set msg ""
set description "Writes information to the eye-tracker logfile"
set auto_log yes
define pygaze_start_recording new_pygaze_start_recording
set status_msg start_trial
set description "Puts the eye tracker into recording mode"
define pygaze_stop_recording new_pygaze_stop_recording
set status_msg stop_trial
set description "Stops recording of eye tracking data"
define loop practice_block_loop
set source_file ""
set source table
set repeat 1
set order sequential
set description "Repeatedly runs another item"
set cycles 4
set continuous no
set break_if_on_first yes
set break_if never
setcycle 0 image "318533.png"
setcycle 0 sound "318533.wav"
setcycle 0 verification "Are there any cars on the road?"
setcycle 0 correct_response "[no_button]"
setcycle 0 extra_question ""
setcycle 1 image "297387.png"
setcycle 1 sound "297387.wav"
setcycle 1 verification ""
setcycle 1 correct_response ""
setcycle 1 extra_question "Are the trees green?"
setcycle 2 image "89407.png"
setcycle 2 sound "89407.wav"
setcycle 2 verification ""
setcycle 2 correct_response ""
setcycle 2 extra_question "Is this boy driving?"
setcycle 3 image "565211.png"
setcycle 3 sound "565211.wav"
setcycle 3 verification "Is the woman giving the teddy bear to the girl?"
setcycle 3 correct_response "[yes_button]"
setcycle 3 extra_question ""
run practice_sequence
define sequence practice_block_sequence
set flush_keyboard yes
set description "Runs a number of items in sequence"
run practice_block_loop always
run end_of_practice always
define loop practice_loop
set source_file ""
set source table
set repeat 1
set order random
set description "Repeatedly runs another item"
set cycles 1
set continuous no
set break_if_on_first yes
set break_if never
setcycle 0 practice yes
run practice_block_sequence
define sequence practice_sequence
set flush_keyboard yes
set description "Runs a number of items in sequence"
run new_pygaze_drift_correct always
run new_pygaze_start_recording always
run new_inline_script_2 always
run verification_question1 "[subject_parity] == 'odd' and ( [correct_response] == [no_button] or [correct_response]==[yes_button])"
run verification_question2 "[subject_parity] == 'even' and ( [correct_response] == [no_button] or [correct_response]==[yes_button])"
run new_keyboard_response "[correct_response] == [no_button] or [correct_response] == [yes_button]"
run new_feedback_1 "[correct] == 1 and ([correct_response] == [yes_button] or [correct_response] == [no_button])"
run new_feedback_2 "[correct] == 0 and ([correct_response] == [yes_button] or [correct_response] == [no_button])"
run logger always
run new_pygaze_log always
run new_pygaze_stop_recording always
define pygaze_drift_correct pygaze_drift_correct
set ypos 0
set xpos 0
set target_style default
set target_color "[foreground]"
set fixation_triggered yes
set draw_target yes
set description "Perform eye-tracker drift correction"
define pygaze_init pygaze_init
set tracker_type EyeTribe
set smi_send_port 4444
set smi_recv_port 5555
set smi_ip "127.0.0.1"
set sacc_vel_thr 35
set sacc_acc_thr 9500
set eyelink_pupil_size_mode area
set eyelink_force_drift_correct yes
set description "Initialize and calibrate eye tracker"
set calibrate yes
set calbeep yes
set _logfile automatic
define pygaze_log pygaze_log
set throttle 2
set msg ""
set description "Writes information to the eye-tracker logfile"
set auto_log yes
define pygaze_start_recording pygaze_start_recording
set status_msg "start_trial [count_trial_sequence]"
set description "Puts the eye tracker into recording mode"
define pygaze_stop_recording pygaze_stop_recording
set status_msg stop_trial
set description "Stops recording of eye tracking data"
define inline_script response_mapping
set description "Executes Python code"
set _run ""
___prepare__
#joystick.__init__(experiment, device=1, joybuttonlist=None, timeout=None)
#button, timestamp = joystick.get_joybutton(joybuttonlist=None, timeout=None)
#joystick.set_joybuttonlist(joybuttonlist=None)
#counterbalancing what button should be pressed when a statement is false/true
if var.subject_parity == 'even':
var.yes_button = 'left'
var.no_button = 'right'
else:
var.yes_button = 'right'
var.no_button = 'left'
__end__
define sequence trial_sequence
set flush_keyboard yes
set description "A single trial"
run pygaze_drift_correct always
run pygaze_start_recording always
run new_inline_script_2 always
run verification_question1 "[subject_parity] == 'odd' and ( [correct_response] == [yes_button] or [correct_response]==[no_button])"
run verification_question2_1 "[subject_parity] == 'even' and ( [correct_response] == [yes_button] or [correct_response]==[no_button])"
run new_keyboard_response "[correct_response] == [no_button] or [correct_response] == [yes_button]"
run logger always
run pygaze_log always
run pygaze_stop_recording always
define sketchpad verification_question1
set duration 0
set description "Displays stimuli"
draw textline center=1 color=black font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if=always text="[verification]" x=0 y=0 z_index=0
draw textline center=1 color="#ffffff" font_bold=no font_family=mono font_italic=no font_size=20 html=yes show_if=always text="[verification]" x=0 y=0 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=20 html=yes show_if=always text="NO = left" x=-288 y=-288 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=20 html=yes show_if=always text="YES = right" x=288 y=-288 z_index=0
define sketchpad verification_question2
set duration 0
set description "Displays stimuli"
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=20 html=yes show_if=always text="YES = left" x=-288 y=-288 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=20 html=yes show_if=always text="NO = right" x=288 y=-288 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=20 html=yes show_if=always text="[verification]" x=0 y=0 z_index=0
define sketchpad verification_question2_1
set duration 0
set description "Displays stimuli"
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=20 html=yes show_if=always text="YES = left" x=-288 y=-288 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=20 html=yes show_if=always text="NO = right" x=288 y=-288 z_index=0
draw textline center=1 color=white font_bold=no font_family=mono font_italic=no font_size=20 html=yes show_if=always text="[verification]" x=0 y=0 z_index=0