-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCCPT.opensesame
803 lines (747 loc) · 23.3 KB
/
CCPT.opensesame
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
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
# Generated by OpenSesame 2.8.2~pre3 (Gutsy Gibson)
# Wed May 21 09:42:23 2014 (posix)
# <http://www.cogsci.nl/opensesame>
set mouse_backend "legacy"
set subject_parity "even"
set transparent_variables "no"
set height "1024"
set font_italic "no"
set synth_backend "legacy"
set title "New experiment"
set coordinates "relative"
set start "experiment"
set sampler_backend "legacy"
set font_family "mono"
set foreground "white"
set font_bold "no"
set description "Default description"
set background "black"
set font_size "30"
set keyboard_backend "legacy"
set canvas_backend "legacy"
set compensation "0"
set bidi "no"
set subject_nr "0"
set width "1280"
define inline_script NYCQ_inline_script
___run__
from openexp.canvas import canvas
import pygame
my_canvas = canvas(self.experiment)
slider_w = 500
slider_h = 40
slider_x = self.get("width")/2-slider_w/2
slider_y = self.get("height")/2-slider_h/2
slider_fill = slider_w/2.0
step = slider_w/2/10
left_key = pygame.K_1
right_key = pygame.K_0
esc_keys = [pygame.K_SPACE, pygame.K_ESCAPE]
left_down = False
right_down = False
outer_break = False
while True:
events = pygame.event.get()
for event in events:
if event.type == pygame.KEYDOWN:
if event.key in esc_keys:
outer_break = True
if event.key == left_key:
left_down = True
if event.key == right_key:
right_down = True
elif event.type == pygame.KEYUP:
if event.key == left_key:
left_down = False
if event.key == right_key:
right_down = False
if len(events) == 2:
if left_down and slider_fill > 0:
slider_fill -= step
elif right_down and slider_fill < slider_w:
slider_fill += step
if outer_break:
break
elif left_down and slider_fill > 0:
slider_fill -= step
elif right_down and slider_fill < slider_w:
slider_fill += step
my_canvas.clear()
if language == "en":
my_canvas.text("During the last scan", y=slider_y-200)
my_canvas.text("<b>"+self.get("question_en")+"</b>", y=slider_y-100)
my_canvas.text("Completely did <b>not</b>U+005Cndescribe my experience", y=slider_y+100, x=slider_x)
my_canvas.text("Completely didU+005Cndescribe my experience", y=slider_y+100, x=slider_x+slider_w)
if language == "de":
my_canvas.text("WU+00E4hrend der letzten Messung", y=slider_y-200)
my_canvas.text("<b>"+self.get("question_de")+"</b>", y=slider_y-100)
my_canvas.text("Beschreibt meine GedankenU+005CnU+00FCberhaupt nicht", y=slider_y+100, x=slider_x)
my_canvas.text("Beschreibt meine GedankenU+005CnvollstU+00E4ndig", y=slider_y+100, x=slider_x+slider_w)
# Draw the slider frame
my_canvas.rect(slider_x, slider_y, slider_w, slider_h)
# Draw the slider fill
my_canvas.rect(slider_x, slider_y, slider_fill, slider_h, fill=True)
# Draw the mouse cursor
my_canvas.show()
slider_percent = 100.0*slider_fill/slider_w
self.experiment.set("slider_percent", slider_percent)
__end__
set _prepare ""
set description "Executes Python code"
define text_display NYCQ_intro
set foreground "white"
set font_size "30"
set description "Presents a display consisting of text"
set maxchar "50"
set align "center"
set content "[NYCQ_intro_msg]"
set background "black"
set duration "keypress"
set font_family "mono"
define logger NYCQ_logger
set ignore_missing "no"
set description "Logs experimental data"
set auto_log "no"
set use_quotes "no"
log "slider_percent"
log "question_de"
log "question_en"
log "question_id"
define loop NYCQ_loop
set repeat "1"
set description "Repeatedly runs another item"
set item "NYCQ_sequence"
set column_order "question_id;question_de;question_en"
set cycles "12"
set order "random"
setcycle 0 question_de "habe ich an etwas Positives gedacht."
setcycle 0 question_en "I thought about something positive"
setcycle 0 question_id "positive"
setcycle 1 question_de "habe ich an etwas Negatives gedacht."
setcycle 1 question_en "I thought about something negative "
setcycle 1 question_id "negative"
setcycle 2 question_de "habe ich an zukU+00FCnftige Ereignisse gedacht."
setcycle 2 question_en "my thoughts involved future events "
setcycle 2 question_id "future"
setcycle 3 question_de "habe ich an vergangene Ereignisse gedacht."
setcycle 3 question_en "my thoughts involved past events"
setcycle 3 question_id "past"
setcycle 4 question_de "habe ich U+00FCber mich selbst nachgedacht."
setcycle 4 question_en "my thoughts involved myself"
setcycle 4 question_id "myself"
setcycle 5 question_de "habe ich an andere Menschen gedacht."
setcycle 5 question_en "my thoughts involved other people"
setcycle 5 question_id "people"
setcycle 6 question_de "habe ich U+00FCber meine derzeitige Umgebung nachgedacht."
setcycle 6 question_en "my thoughts involved my surroundings"
setcycle 6 question_id "surrpundings"
setcycle 7 question_de "war ich vollkommen wach."
setcycle 7 question_en "I was fully awake"
setcycle 7 question_id "vigilance"
setcycle 8 question_de "hatte ich Gedanken in Form von Bildern."
setcycle 8 question_en "my thoughts were in the form of images"
setcycle 8 question_id "images"
setcycle 9 question_de "hatte ich Gedanken in Form von Worten."
setcycle 9 question_en "my thoughts were in the form of words"
setcycle 9 question_id "words"
setcycle 10 question_de "waren meine Gedanken eher spezifisch als vage."
setcycle 10 question_en "my thoughts were more specific than vague"
setcycle 10 question_id "specific_vague"
setcycle 11 question_de "waren meine Gedanken aufdringlich/eindringlich."
setcycle 11 question_en "my thoughts were intrusive"
setcycle 11 question_id "intrusive"
run NYCQ_sequence
define sequence NYCQ_sequence
run NYCQ_inline_script "always"
run NYCQ_logger "always"
define sketchpad blank
set duration "600"
set description "Displays stimuli"
define sequence experiment
run set_up_variables "always"
run intro_1 "always"
run intro_2 "always"
run intro_3 "always"
run intro_4 "always"
run intro_5 "always"
run blank "always"
run shuffle_stimuli_list "always"
run training_loop "always"
run intro_6 "always"
run intro_7 "always"
run blank "always"
run shuffle_stimuli_list "always"
run loop "always"
run NYCQ_intro "always"
run NYCQ_loop "always"
run thank_you "always"
define feedback feedback
set duration "800"
set reset_variables "yes"
set description "Provides feedback to the participant"
draw textline 0 0 "[feedback_message]" center=1 color=[feedback_colour] font_family="mono" font_size=30 font_italic=no font_bold=no show_if="always" html="yes"
define text_display intro_1
set foreground "white"
set font_size "30"
set description "Presents a display consisting of text"
set maxchar "50"
set align "center"
__content__
[intro_1_msg]
__end__
set background "black"
set duration "keypress"
set font_family "mono"
define text_display intro_2
set foreground "white"
set font_size "30"
set description "Presents a display consisting of text"
set maxchar "50"
set align "center"
set content "[intro_2_msg]"
set background "black"
set duration "keypress"
set font_family "mono"
define text_display intro_3
set foreground "white"
set font_size "30"
set description "Presents a display consisting of text"
set maxchar "50"
set align "center"
set content "[intro_3_msg]"
set background "black"
set duration "keypress"
set font_family "mono"
define sketchpad intro_4
set duration "keypress"
set description "Displays stimuli"
draw image 0 0 "stimuli/red_square.png" scale=1 center=1 show_if="always"
define text_display intro_5
set foreground "white"
set font_size "30"
set description "Presents a display consisting of text"
set maxchar "50"
set align "center"
set content "[intro_5_msg]"
set background "black"
set duration "keypress"
set font_family "mono"
define text_display intro_6
set foreground "white"
set font_size "30"
set description "Presents a display consisting of text"
set maxchar "50"
set align "center"
set content "[intro_6_msg]"
set background "black"
set duration "keypress"
set font_family "mono"
define text_display intro_7
set foreground "white"
set font_size "30"
set description "Presents a display consisting of text"
set maxchar "50"
set align "center"
set content "[intro_7_msg]"
set background "black"
set duration "keypress"
set font_family "mono"
define logger logger
set ignore_missing "no"
set description "Logs experimental data"
set auto_log "no"
set use_quotes "no"
log "response"
log "response_time"
log "trial_shape"
log "trial_ISI"
define loop loop
set repeat "1"
set description "Repeatedly runs another item"
set skip "0"
set item "sequence"
set break_if "never"
set column_order "bogus"
set cycles "320"
set order "sequential"
setcycle 0 bogus ""
setcycle 1 bogus ""
setcycle 2 bogus ""
setcycle 3 bogus ""
setcycle 4 bogus ""
setcycle 5 bogus ""
setcycle 6 bogus ""
setcycle 7 bogus ""
setcycle 8 bogus ""
setcycle 9 bogus ""
setcycle 10 bogus ""
setcycle 11 bogus ""
setcycle 12 bogus ""
setcycle 13 bogus ""
setcycle 14 bogus ""
setcycle 15 bogus ""
setcycle 16 bogus ""
setcycle 17 bogus ""
setcycle 18 bogus ""
setcycle 19 bogus ""
setcycle 20 bogus ""
setcycle 21 bogus ""
setcycle 22 bogus ""
setcycle 23 bogus ""
setcycle 24 bogus ""
setcycle 25 bogus ""
setcycle 26 bogus ""
setcycle 27 bogus ""
setcycle 28 bogus ""
setcycle 29 bogus ""
setcycle 30 bogus ""
setcycle 31 bogus ""
setcycle 32 bogus ""
setcycle 33 bogus ""
setcycle 34 bogus ""
setcycle 35 bogus ""
setcycle 36 bogus ""
setcycle 37 bogus ""
setcycle 38 bogus ""
setcycle 39 bogus ""
setcycle 40 bogus ""
setcycle 41 bogus ""
setcycle 42 bogus ""
setcycle 43 bogus ""
setcycle 44 bogus ""
setcycle 45 bogus ""
setcycle 46 bogus ""
setcycle 47 bogus ""
setcycle 48 bogus ""
setcycle 49 bogus ""
setcycle 50 bogus ""
setcycle 51 bogus ""
setcycle 52 bogus ""
setcycle 53 bogus ""
setcycle 54 bogus ""
setcycle 55 bogus ""
setcycle 56 bogus ""
setcycle 57 bogus ""
setcycle 58 bogus ""
setcycle 59 bogus ""
setcycle 60 bogus ""
setcycle 61 bogus ""
setcycle 62 bogus ""
setcycle 63 bogus ""
setcycle 64 bogus ""
setcycle 65 bogus ""
setcycle 66 bogus ""
setcycle 67 bogus ""
setcycle 68 bogus ""
setcycle 69 bogus ""
setcycle 70 bogus ""
setcycle 71 bogus ""
setcycle 72 bogus ""
setcycle 73 bogus ""
setcycle 74 bogus ""
setcycle 75 bogus ""
setcycle 76 bogus ""
setcycle 77 bogus ""
setcycle 78 bogus ""
setcycle 79 bogus ""
setcycle 80 bogus ""
setcycle 81 bogus ""
setcycle 82 bogus ""
setcycle 83 bogus ""
setcycle 84 bogus ""
setcycle 85 bogus ""
setcycle 86 bogus ""
setcycle 87 bogus ""
setcycle 88 bogus ""
setcycle 89 bogus ""
setcycle 90 bogus ""
setcycle 91 bogus ""
setcycle 92 bogus ""
setcycle 93 bogus ""
setcycle 94 bogus ""
setcycle 95 bogus ""
setcycle 96 bogus ""
setcycle 97 bogus ""
setcycle 98 bogus ""
setcycle 99 bogus ""
setcycle 100 bogus ""
setcycle 101 bogus ""
setcycle 102 bogus ""
setcycle 103 bogus ""
setcycle 104 bogus ""
setcycle 105 bogus ""
setcycle 106 bogus ""
setcycle 107 bogus ""
setcycle 108 bogus ""
setcycle 109 bogus ""
setcycle 110 bogus ""
setcycle 111 bogus ""
setcycle 112 bogus ""
setcycle 113 bogus ""
setcycle 114 bogus ""
setcycle 115 bogus ""
setcycle 116 bogus ""
setcycle 117 bogus ""
setcycle 118 bogus ""
setcycle 119 bogus ""
setcycle 120 bogus ""
setcycle 121 bogus ""
setcycle 122 bogus ""
setcycle 123 bogus ""
setcycle 124 bogus ""
setcycle 125 bogus ""
setcycle 126 bogus ""
setcycle 127 bogus ""
setcycle 128 bogus ""
setcycle 129 bogus ""
setcycle 130 bogus ""
setcycle 131 bogus ""
setcycle 132 bogus ""
setcycle 133 bogus ""
setcycle 134 bogus ""
setcycle 135 bogus ""
setcycle 136 bogus ""
setcycle 137 bogus ""
setcycle 138 bogus ""
setcycle 139 bogus ""
setcycle 140 bogus ""
setcycle 141 bogus ""
setcycle 142 bogus ""
setcycle 143 bogus ""
setcycle 144 bogus ""
setcycle 145 bogus ""
setcycle 146 bogus ""
setcycle 147 bogus ""
setcycle 148 bogus ""
setcycle 149 bogus ""
setcycle 150 bogus ""
setcycle 151 bogus ""
setcycle 152 bogus ""
setcycle 153 bogus ""
setcycle 154 bogus ""
setcycle 155 bogus ""
setcycle 156 bogus ""
setcycle 157 bogus ""
setcycle 158 bogus ""
setcycle 159 bogus ""
setcycle 160 bogus ""
setcycle 161 bogus ""
setcycle 162 bogus ""
setcycle 163 bogus ""
setcycle 164 bogus ""
setcycle 165 bogus ""
setcycle 166 bogus ""
setcycle 167 bogus ""
setcycle 168 bogus ""
setcycle 169 bogus ""
setcycle 170 bogus ""
setcycle 171 bogus ""
setcycle 172 bogus ""
setcycle 173 bogus ""
setcycle 174 bogus ""
setcycle 175 bogus ""
setcycle 176 bogus ""
setcycle 177 bogus ""
setcycle 178 bogus ""
setcycle 179 bogus ""
setcycle 180 bogus ""
setcycle 181 bogus ""
setcycle 182 bogus ""
setcycle 183 bogus ""
setcycle 184 bogus ""
setcycle 185 bogus ""
setcycle 186 bogus ""
setcycle 187 bogus ""
setcycle 188 bogus ""
setcycle 189 bogus ""
setcycle 190 bogus ""
setcycle 191 bogus ""
setcycle 192 bogus ""
setcycle 193 bogus ""
setcycle 194 bogus ""
setcycle 195 bogus ""
setcycle 196 bogus ""
setcycle 197 bogus ""
setcycle 198 bogus ""
setcycle 199 bogus ""
setcycle 200 bogus ""
setcycle 201 bogus ""
setcycle 202 bogus ""
setcycle 203 bogus ""
setcycle 204 bogus ""
setcycle 205 bogus ""
setcycle 206 bogus ""
setcycle 207 bogus ""
setcycle 208 bogus ""
setcycle 209 bogus ""
setcycle 210 bogus ""
setcycle 211 bogus ""
setcycle 212 bogus ""
setcycle 213 bogus ""
setcycle 214 bogus ""
setcycle 215 bogus ""
setcycle 216 bogus ""
setcycle 217 bogus ""
setcycle 218 bogus ""
setcycle 219 bogus ""
setcycle 220 bogus ""
setcycle 221 bogus ""
setcycle 222 bogus ""
setcycle 223 bogus ""
setcycle 224 bogus ""
setcycle 225 bogus ""
setcycle 226 bogus ""
setcycle 227 bogus ""
setcycle 228 bogus ""
setcycle 229 bogus ""
setcycle 230 bogus ""
setcycle 231 bogus ""
setcycle 232 bogus ""
setcycle 233 bogus ""
setcycle 234 bogus ""
setcycle 235 bogus ""
setcycle 236 bogus ""
setcycle 237 bogus ""
setcycle 238 bogus ""
setcycle 239 bogus ""
setcycle 240 bogus ""
setcycle 241 bogus ""
setcycle 242 bogus ""
setcycle 243 bogus ""
setcycle 244 bogus ""
setcycle 245 bogus ""
setcycle 246 bogus ""
setcycle 247 bogus ""
setcycle 248 bogus ""
setcycle 249 bogus ""
setcycle 250 bogus ""
setcycle 251 bogus ""
setcycle 252 bogus ""
setcycle 253 bogus ""
setcycle 254 bogus ""
setcycle 255 bogus ""
setcycle 256 bogus ""
setcycle 257 bogus ""
setcycle 258 bogus ""
setcycle 259 bogus ""
setcycle 260 bogus ""
setcycle 261 bogus ""
setcycle 262 bogus ""
setcycle 263 bogus ""
setcycle 264 bogus ""
setcycle 265 bogus ""
setcycle 266 bogus ""
setcycle 267 bogus ""
setcycle 268 bogus ""
setcycle 269 bogus ""
setcycle 270 bogus ""
setcycle 271 bogus ""
setcycle 272 bogus ""
setcycle 273 bogus ""
setcycle 274 bogus ""
setcycle 275 bogus ""
setcycle 276 bogus ""
setcycle 277 bogus ""
setcycle 278 bogus ""
setcycle 279 bogus ""
setcycle 280 bogus ""
setcycle 281 bogus ""
setcycle 282 bogus ""
setcycle 283 bogus ""
setcycle 284 bogus ""
setcycle 285 bogus ""
setcycle 286 bogus ""
setcycle 287 bogus ""
setcycle 288 bogus ""
setcycle 289 bogus ""
setcycle 290 bogus ""
setcycle 291 bogus ""
setcycle 292 bogus ""
setcycle 293 bogus ""
setcycle 294 bogus ""
setcycle 295 bogus ""
setcycle 296 bogus ""
setcycle 297 bogus ""
setcycle 298 bogus ""
setcycle 299 bogus ""
setcycle 300 bogus ""
setcycle 301 bogus ""
setcycle 302 bogus ""
setcycle 303 bogus ""
setcycle 304 bogus ""
setcycle 305 bogus ""
setcycle 306 bogus ""
setcycle 307 bogus ""
setcycle 308 bogus ""
setcycle 309 bogus ""
setcycle 310 bogus ""
setcycle 311 bogus ""
setcycle 312 bogus ""
setcycle 313 bogus ""
setcycle 314 bogus ""
setcycle 315 bogus ""
setcycle 316 bogus ""
setcycle 317 bogus ""
setcycle 318 bogus ""
setcycle 319 bogus ""
run sequence
define inline_script prepare_feedback_message
___run__
shape = self.experiment.get("trial_shape")
response = self.experiment.get("response")
response_time = self.experiment.get("response_time")
print shape, response, response_time
feedback_message = correct_msg
feedback_colour = "green"
if (shape != "red_square" and response == "space") or (shape == "red_square" and response != "space"):
feedback_message = incorrect_msg
feedback_colour = "red"
self.experiment.set("feedback_message", feedback_message)
self.experiment.set("feedback_colour", feedback_colour)
__end__
___prepare__
correct_msg = self.experiment.get("correct_msg")
incorrect_msg = self.experiment.get("incorrect_msg")
__end__
set description "Executes Python code"
define sequence sequence
run set_trial_variables "always"
run show_and_collect_response "always"
run logger "always"
define inline_script set_trial_variables
set _run ""
___prepare__
global shapes
global timings
shape = shapes.pop()
ISI = timings.pop()
self.experiment.set("trial_shape", shape)
self.experiment.set("trial_ISI", ISI)
__end__
set description "Executes Python code"
define inline_script set_up_variables
set _run ""
___prepare__
language = "de"
if language == "de":
self.experiment.set("intro_1_msg", """Im folgenden Experiment werden wir Ihnen eine Reihe von Figuren in verschiedenen Farben prU+00E4sentieren.
(Weiter mit beliebigem Tastendruck)""")
self.experiment.set("intro_2_msg","""Wenn Sie ein rotes Quadrat sehen, drU+00FCcken Sie bitte die Leertaste so schnell wie mU+00F6glich.""")
self.experiment.set("intro_3_msg","""So sieht das rote Quadrat aus.""")
self.experiment.set("intro_5_msg","""Wir beginnen mit einem U+00DCbungsdurchgang. DrU+00FCcken Sie eine beliebige Taste, wenn Sie bereit sind. Bitte denken Sie daran, die Leertaste NUR DANN zu drU+00FCcken, wenn Sie ein rotes Quadrat sehen.""")
self.experiment.set("correct_msg","""richtig""")
self.experiment.set("incorrect_msg","""falsch""")
self.experiment.set("intro_6_msg","""Danke! Das ist das Ende des U+00DCbungsdurchgangs.""")
self.experiment.set("intro_7_msg","""Wir starten jetzt mit dem eigentlichen Experiment. Es wird lU+00E4nger dauern als der U+00DCbungsdurchgang und Sie werden kein Feedback erhalten. Noch einmal, bitte denken Sie daran, die Leertaste NUR DANN zu drU+00FCcken, wenn Sie ein rotes Quadrat sehen.
DrU+00FCcken Sie jetzt zum Start eine beliebige Taste.""")
self.experiment.set("NYCQ_intro_msg","""Wir mU+00F6chten Ihnen einige Fragen zu den Gedanken stellen, die Sie wU+00E4hrend des letzten Experiments hatten.
Auf dem Bildschirm werden Sie gleich Fragen und einen Schieberegler sehen. Benutzen Sie die Tasten 1 und 0 um den Regler zu bewegen und so Ihre Antwort anzugeben.
Um zur nU+00E4chsten Frage zu gelangen drU+00FCcken Sie bitte die Leertaste.""")
self.experiment.set("thank_you_msg","""Ende. Vielen Dank fU+00FCr die Teilnahme an unserer Studie!""")
else:
self.experiment.set("intro_1_msg", """In the following experiment we will show you a series of shapes in different colours.
(press any key to continue)""")
self.experiment.set("intro_2_msg","""When you will see a red square press space as quickly as possible.""")
self.experiment.set("intro_3_msg","""This is how the red square looks like.""")
self.experiment.set("intro_5_msg","""We will start with a practice run. Press any key whenever you are ready. Remember to press space ONLY when you see a red square!""")
self.experiment.set("correct_msg","""correct""")
self.experiment.set("incorrect_msg","""incorrect""")
self.experiment.set("intro_6_msg","""This concludes the training phase.""")
self.experiment.set("intro_7_msg","""We will now start with the proper test. It will be longer and there will be no feedback. Remember to only press space when you see a red square.
(press any key to start the test)""")
self.experiment.set("NYCQ_intro_msg","""We would like to ask you a few questions about the thoughts you had during the last experiment. On the next screens you will see questions and a slider. Use buttons 1 and 0 to move the slider indicating your answer.
To move to the next question press space.""")
self.experiment.set("thank_you_msg","""Thank you for participating in our study!""")
__end__
set description "Executes Python code"
define inline_script show_and_collect_response
___run__
from openexp.keyboard import keyboard
# Durations for the two displays
duration_shape = 100
duration_blank = self.experiment.get('trial_ISI')
# Displays are copied from sketchpads. To avoid these
# sketchpads from being shown twice (i.e. once in the
# normal way, and once in this inline_script), you can set
# their 'Run-if' statement to 'never'.
# Create a keyboard object with a zero timeout to allow
# for continuous polling.
my_keyboard = keyboard(exp, timeout=0)
my_keyboard.flush()
key = None
# Show the first canvas, and poll the keyboard for the
# specified duration.
show_time_shape = canvas_shape.show()
while self.time() - show_time_shape < duration_shape:
if not key:
key, time = my_keyboard.get_key()
# Show the second canvas, and poll the keyboard for the
# specified duration.
show_time_blank = canvas_blank.show()
while self.time() - show_time_blank < duration_blank:
if not key:
key, time = my_keyboard.get_key()
exp.set('response', key)
if key:
exp.set('response_time', int(round(time-show_time_shape)))
else:
exp.set('response_time', 0)
__end__
___prepare__
from openexp.canvas import canvas
canvas_shape = canvas(exp)
canvas_blank = canvas(exp)
path = exp.get_file("stimuli/%s.png"%exp.get("trial_shape"))
canvas_shape.image(path)
__end__
set description "Executes Python code"
define inline_script shuffle_stimuli_list
___run__
number_of_trials = 320
shapes = ["red_square"]*(int(0.3*number_of_trials))
for colour in ["yellow", "blue", "green"]:
shapes += ["%s_square"%colour]*(int((0.175/3) * number_of_trials))
shapes += ["yellow_square", "blue_square"]
for shape in ["star", "circle", "triangle"]:
shapes += ["red_%s"%shape]*(int((0.175/3) * number_of_trials))
shapes += ["red_star", "red_circle"]
for colour in ["yellow", "blue", "green"]:
for shape in ["star", "circle", "triangle"]:
shapes += ["%s_%s"%(colour,shape)]*(int((0.35/(3*3) * number_of_trials)))
shapes += ["green_triangle", "blue_triangle", "green_circle", "blue_star"]
timings = [1000]*(len(shapes)/4) + [1500]*(len(shapes)/4) + [2000]*(len(shapes)/4) + [2500]*(len(shapes)/4)
random.shuffle(shapes)
random.shuffle(timings)
__end__
___prepare__
import random
global shapes
global timings
__end__
set description "Executes Python code"
define text_display thank_you
set foreground "white"
set font_size "30"
set description "Presents a display consisting of text"
set maxchar "50"
set align "center"
set content "[thank_you_msg]"
set background "black"
set duration "keypress"
set font_family "mono"
define loop training_loop
set repeat "1"
set description "Repeatedly runs another item"
set skip "0"
set item "training_sequence"
set break_if "never"
set column_order "bogus"
set cycles "15"
set order "sequential"
setcycle 0 bogus ""
run training_sequence
define sequence training_sequence
run set_trial_variables "always"
run show_and_collect_response "always"
run prepare_feedback_message "always"
run feedback "always"