-
Notifications
You must be signed in to change notification settings - Fork 0
/
Masks&Faces.py
2386 lines (2201 loc) · 108 KB
/
Masks&Faces.py
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
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This experiment was created using PsychoPy3 Experiment Builder (v2020.2.8),
on Tue Feb 23 00:58:24 2021
If you publish work using this script the most relevant publication is:
Peirce J, Gray JR, Simpson S, MacAskill M, Höchenberger R, Sogo H, Kastman E, Lindeløv JK. (2019)
PsychoPy2: Experiments in behavior made easy Behav Res 51: 195.
https://doi.org/10.3758/s13428-018-01193-y
"""
from __future__ import absolute_import, division
from psychopy import locale_setup
from psychopy import prefs
from psychopy import sound, gui, visual, core, data, event, logging, clock
from psychopy.constants import (NOT_STARTED, STARTED, PLAYING, PAUSED,
STOPPED, FINISHED, PRESSED, RELEASED, FOREVER)
import numpy as np # whole numpy lib is available, prepend 'np.'
from numpy import (sin, cos, tan, log, log10, pi, average,
sqrt, std, deg2rad, rad2deg, linspace, asarray)
from numpy.random import random, randint, normal, shuffle
import os # handy system and path functions
import sys # to get file system encoding
from psychopy.hardware import keyboard
# Ensure that relative paths start from the same directory as this script
_thisDir = os.path.dirname(os.path.abspath(__file__))
os.chdir(_thisDir)
# Store info about the experiment session
psychopyVersion = '2020.2.8'
expName = 'Effects of Varying Facial Region Visibility on Perception' # from the Builder filename that created this script
expInfo = {'participant': ''}
dlg = gui.DlgFromDict(dictionary=expInfo, sortKeys=False, title=expName)
if dlg.OK == False:
core.quit() # user pressed cancel
expInfo['date'] = data.getDateStr() # add a simple timestamp
expInfo['expName'] = expName
expInfo['psychopyVersion'] = psychopyVersion
# Data file name stem = absolute path + name; later add .psyexp, .csv, .log, etc
filename = _thisDir + os.sep + u'data/%s_%s_%s' % (expInfo['participant'], expName, expInfo['date'])
# An ExperimentHandler isn't essential but helps with data saving
thisExp = data.ExperimentHandler(name=expName, version='',
extraInfo=expInfo, runtimeInfo=None,
originPath='/Users/jamiecochrane/Desktop/MaskExperiment/Masks&Faces.py',
savePickle=True, saveWideText=True,
dataFileName=filename)
# save a log file for detail verbose info
logFile = logging.LogFile(filename+'.log', level=logging.DEBUG)
logging.console.setLevel(logging.WARNING) # this outputs to the screen, not a file
endExpNow = False # flag for 'escape' or other condition => quit the exp
frameTolerance = 0.001 # how close to onset before 'same' frame
# Start Code - component code to be run after the window creation
# Setup the Window
win = visual.Window(
size=[1440, 900], fullscr=True, screen=0,
winType='pyglet', allowGUI=False, allowStencil=False,
monitor='testMonitor', color=[0,0,0], colorSpace='rgb',
blendMode='avg', useFBO=True,
units='height')
# store frame rate of monitor if we can measure it
expInfo['frameRate'] = win.getActualFrameRate()
if expInfo['frameRate'] != None:
frameDur = 1.0 / round(expInfo['frameRate'])
else:
frameDur = 1.0 / 60.0 # could not measure, so guess
# create a default keyboard (e.g. to check for escape)
defaultKeyboard = keyboard.Keyboard()
# Initialize components for Routine "Pre_Virtual_Chin_Rest"
Pre_Virtual_Chin_RestClock = core.Clock()
text = visual.TextStim(win=win, name='text',
text='Prior to the experiment you will complete two short pre exercizes. \n(Click anywhere to continue)',
font='Arial',
pos=(0, 0), height=0.05, wrapWidth=None, ori=0,
color='white', colorSpace='rgb', opacity=1,
languageStyle='LTR',
depth=0.0);
mouse = event.Mouse(win=win)
x, y = [None, None]
mouse.mouseClock = core.Clock()
# Initialize components for Routine "Post_Virtual_Chin_Rest"
Post_Virtual_Chin_RestClock = core.Clock()
mouse_2 = event.Mouse(win=win)
x, y = [None, None]
mouse_2.mouseClock = core.Clock()
text_2 = visual.TextStim(win=win, name='text_2',
text='Thank you for completing the short exercises. Now on to the experiment. \n(Click anywhere to continue)',
font='Arial',
pos=(0, 0), height=0.05, wrapWidth=None, ori=0,
color='white', colorSpace='rgb', opacity=1,
languageStyle='LTR',
depth=-1.0);
# Initialize components for Routine "Instructions"
InstructionsClock = core.Clock()
mouse_3 = event.Mouse(win=win)
x, y = [None, None]
mouse_3.mouseClock = core.Clock()
text_3 = visual.TextStim(win=win, name='text_3',
text='Please wear the eyeglasses or corrective lenses that you feel are best for this viewing distance. \n\n(Click anywhere to continue). ',
font='Arial',
pos=(0, 0), height=0.05, wrapWidth=None, ori=0,
color='white', colorSpace='rgb', opacity=1,
languageStyle='LTR',
depth=-1.0);
# Initialize components for Routine "Instructions_2"
Instructions_2Clock = core.Clock()
mouse_4 = event.Mouse(win=win)
x, y = [None, None]
mouse_4.mouseClock = core.Clock()
text_4 = visual.TextStim(win=win, name='text_4',
text='For this experiment, we are investigating face perception. On each trial, you will first be shown a single face, and then asked to select that face from within a small set that appears afterwards. \n\n\n\n(Click anywhere to continue). \n\n',
font='Arial',
pos=(0, 0), height=0.05, wrapWidth=None, ori=0,
color='white', colorSpace='rgb', opacity=1,
languageStyle='LTR',
depth=-1.0);
# Initialize components for Routine "Instructions_3"
Instructions_3Clock = core.Clock()
mouse_5 = event.Mouse(win=win)
x, y = [None, None]
mouse_5.mouseClock = core.Clock()
text_5 = visual.TextStim(win=win, name='text_5',
text='Each trial will begin with a black dot in the middle of the screen. Look at the dot: this is the location where the target face will then be shown.\n\n\n\n(Click anywhere to continue). \n\n',
font='Arial',
pos=(0, 0), height=0.05, wrapWidth=None, ori=0,
color='white', colorSpace='rgb', opacity=1,
languageStyle='LTR',
depth=-1.0);
image_6 = visual.ImageStim(
win=win,
name='image_6',
image='sin', mask=None,
ori=0, pos=(0, -0.3), size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-2.0)
# Initialize components for Routine "Instructions_4"
Instructions_4Clock = core.Clock()
mouse_6 = event.Mouse(win=win)
x, y = [None, None]
mouse_6.mouseClock = core.Clock()
text_6 = visual.TextStim(win=win, name='text_6',
text='The target face will appear briefly, then automatically replaced with a small set of faces.\n\n\n\n(Click anywhere to continue). \n\n',
font='Arial',
pos=(0.3, 0), height=0.05, wrapWidth=None, ori=0,
color='white', colorSpace='rgb', opacity=1,
languageStyle='LTR',
depth=-1.0);
image_7 = visual.ImageStim(
win=win,
name='image_7',
image='sin', mask=None,
ori=0, pos=(0.2, 0), size=(0.3, 0.3),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-2.0)
# Initialize components for Routine "Instructions_5"
Instructions_5Clock = core.Clock()
mouse_7 = event.Mouse(win=win)
x, y = [None, None]
mouse_7.mouseClock = core.Clock()
text_7 = visual.TextStim(win=win, name='text_7',
text='Once the small set of faces appears, select the face that matches the identity of the target face you just saw. To make your choice, simply click on the face. Typically, this process takes only one to two seconds, although sometimes it may take longer. The goal is to be accurate in your choice.\n\n\n\n(Click anywhere to continue). \n\n',
font='Arial',
pos=(0, 0), height=0.05, wrapWidth=None, ori=0,
color='white', colorSpace='rgb', opacity=1,
languageStyle='LTR',
depth=-1.0);
# Initialize components for Routine "Instructions_6"
Instructions_6Clock = core.Clock()
mouse_8 = event.Mouse(win=win)
x, y = [None, None]
mouse_8.mouseClock = core.Clock()
text_8 = visual.TextStim(win=win, name='text_8',
text='If for any reason you need a break; feel free to step away when the small set of faces appears before making your choice. To continue the experiment, simply make your choice. \n\n\n\n(Click anywhere to continue). \n\n',
font='Arial',
pos=(0, 0), height=0.05, wrapWidth=None, ori=0,
color='white', colorSpace='rgb', opacity=1,
languageStyle='LTR',
depth=-1.0);
# Initialize components for Routine "Instructions_7"
Instructions_7Clock = core.Clock()
mouse_9 = event.Mouse(win=win)
x, y = [None, None]
mouse_9.mouseClock = core.Clock()
text_9 = visual.TextStim(win=win, name='text_9',
text='If, however, you would like to exit the experiment before it ends, without completing the task, then close the window you are using. This will end the experiment and your data will not be used. \n\n\n\n(Click anywhere to continue).\n\n',
font='Arial',
pos=(0, 0), height=0.05, wrapWidth=None, ori=0,
color='white', colorSpace='rgb', opacity=1,
languageStyle='LTR',
depth=-1.0);
# Initialize components for Routine "Instructions_8"
Instructions_8Clock = core.Clock()
mouse_10 = event.Mouse(win=win)
x, y = [None, None]
mouse_10.mouseClock = core.Clock()
text_10 = visual.TextStim(win=win, name='text_10',
text='Before starting the actual experiment, you will first complete ten practice trials. \n\n\n\nTo begin, click anywhere on the screen. \n\n',
font='Arial',
pos=(0, 0), height=0.05, wrapWidth=None, ori=0,
color='white', colorSpace='rgb', opacity=1,
languageStyle='LTR',
depth=-1.0);
# Initialize components for Routine "trial"
trialClock = core.Clock()
image = visual.ImageStim(
win=win,
name='image',
image='sin', mask=None,
ori=0, pos=(0, 0), size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=0.0)
image_1 = visual.ImageStim(
win=win,
name='image_1',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-1.0)
image_2 = visual.ImageStim(
win=win,
name='image_2',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-2.0)
image_3 = visual.ImageStim(
win=win,
name='image_3',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-3.0)
image_4 = visual.ImageStim(
win=win,
name='image_4',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-4.0)
image_5 = visual.ImageStim(
win=win,
name='image_5',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-5.0)
image_dot = visual.ImageStim(
win=win,
name='image_dot',
image='images/fixation.png', mask=None,
ori=0, pos=(0, 0), size=(0.02, 0.02),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-6.0)
resp = event.Mouse(win=win)
x, y = [None, None]
resp.mouseClock = core.Clock()
# Initialize components for Routine "trial"
trialClock = core.Clock()
image = visual.ImageStim(
win=win,
name='image',
image='sin', mask=None,
ori=0, pos=(0, 0), size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=0.0)
image_1 = visual.ImageStim(
win=win,
name='image_1',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-1.0)
image_2 = visual.ImageStim(
win=win,
name='image_2',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-2.0)
image_3 = visual.ImageStim(
win=win,
name='image_3',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-3.0)
image_4 = visual.ImageStim(
win=win,
name='image_4',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-4.0)
image_5 = visual.ImageStim(
win=win,
name='image_5',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-5.0)
image_dot = visual.ImageStim(
win=win,
name='image_dot',
image='images/fixation.png', mask=None,
ori=0, pos=(0, 0), size=(0.02, 0.02),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-6.0)
resp = event.Mouse(win=win)
x, y = [None, None]
resp.mouseClock = core.Clock()
# Initialize components for Routine "Pre_Experiment"
Pre_ExperimentClock = core.Clock()
mouse_11 = event.Mouse(win=win)
x, y = [None, None]
mouse_11.mouseClock = core.Clock()
text_11 = visual.TextStim(win=win, name='text_11',
text='You have completed the practice trials. \n\n\n\nClick anywhere on the screen to begin the experiment.\n\n',
font='Arial',
pos=(0, 0), height=0.05, wrapWidth=None, ori=0,
color='white', colorSpace='rgb', opacity=1,
languageStyle='LTR',
depth=-1.0);
# Initialize components for Routine "trial"
trialClock = core.Clock()
image = visual.ImageStim(
win=win,
name='image',
image='sin', mask=None,
ori=0, pos=(0, 0), size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=0.0)
image_1 = visual.ImageStim(
win=win,
name='image_1',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-1.0)
image_2 = visual.ImageStim(
win=win,
name='image_2',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-2.0)
image_3 = visual.ImageStim(
win=win,
name='image_3',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-3.0)
image_4 = visual.ImageStim(
win=win,
name='image_4',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-4.0)
image_5 = visual.ImageStim(
win=win,
name='image_5',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-5.0)
image_dot = visual.ImageStim(
win=win,
name='image_dot',
image='images/fixation.png', mask=None,
ori=0, pos=(0, 0), size=(0.02, 0.02),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-6.0)
resp = event.Mouse(win=win)
x, y = [None, None]
resp.mouseClock = core.Clock()
# Initialize components for Routine "trial"
trialClock = core.Clock()
image = visual.ImageStim(
win=win,
name='image',
image='sin', mask=None,
ori=0, pos=(0, 0), size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=0.0)
image_1 = visual.ImageStim(
win=win,
name='image_1',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-1.0)
image_2 = visual.ImageStim(
win=win,
name='image_2',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-2.0)
image_3 = visual.ImageStim(
win=win,
name='image_3',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-3.0)
image_4 = visual.ImageStim(
win=win,
name='image_4',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-4.0)
image_5 = visual.ImageStim(
win=win,
name='image_5',
image='sin', mask=None,
ori=0, pos=[0,0], size=(0.25, 0.25),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-5.0)
image_dot = visual.ImageStim(
win=win,
name='image_dot',
image='images/fixation.png', mask=None,
ori=0, pos=(0, 0), size=(0.02, 0.02),
color=[1,1,1], colorSpace='rgb', opacity=1,
flipHoriz=False, flipVert=False,
texRes=512, interpolate=True, depth=-6.0)
resp = event.Mouse(win=win)
x, y = [None, None]
resp.mouseClock = core.Clock()
# Initialize components for Routine "Debreifing"
DebreifingClock = core.Clock()
mouse_13 = event.Mouse(win=win)
x, y = [None, None]
mouse_13.mouseClock = core.Clock()
text_13 = visual.TextStim(win=win, name='text_13',
text='Debriefing\n\nThank you for your participation!\n\nFacial processing and facial recognition are both necessary for our daily social interactions. With masks becoming a mandatory part of life, the question arises of how they affect the way we see faces. Facial processing can be separated into many different aspects, two being facial memory and facial perception. Recent studies have found that facial memory seems to be significantly affected by masks. This information, however, does not explain masks effect on perception. Facial perception speaks specifically to the initial processes to depict facial properties. These properties include such things as facial features (eyes, mouth, nose), and individualistic spots that vary from person to person. This experiment wanted to investigate perception and how masks may hinder that within a wide range of populations.\n\nUnlike face memory, we think masks may not hinder facial perception to the extent previously thought. During face perception, people attend mostly to the eye regions of the face. As masks only cover the nose and mouth, it is possible the apparent deficit in face processing may not be due to perception. We hope to answer some of the questions posed, and better understand how masks affect this one aspect of face processing, face perception.\n\nIf you require any further information regarding this research project or your participation in the study, you may contact Jamie Cochrane (cochrj1@mcmaster.ca). If you have any questions about your rights as a research participant or the conduct of this study, you may contact the McMaster Research Ethics Board (MREB) at 905-525-9140, ext. 23142, or email at (srebsec@mcmaster.ca).\n\n',
font='Arial',
pos=(0, 0), height=0.03, wrapWidth=None, ori=0,
color='white', colorSpace='rgb', opacity=1,
languageStyle='LTR',
depth=-1.0);
# Create some handy timers
globalClock = core.Clock() # to track the time since experiment started
routineTimer = core.CountdownTimer() # to track time remaining of each (non-slip) routine
# ------Prepare to start Routine "Pre_Virtual_Chin_Rest"-------
continueRoutine = True
# update component parameters for each repeat
# setup some python lists for storing info about the mouse
gotValidClick = False # until a click is received
# keep track of which components have finished
Pre_Virtual_Chin_RestComponents = [text, mouse]
for thisComponent in Pre_Virtual_Chin_RestComponents:
thisComponent.tStart = None
thisComponent.tStop = None
thisComponent.tStartRefresh = None
thisComponent.tStopRefresh = None
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
# reset timers
t = 0
_timeToFirstFrame = win.getFutureFlipTime(clock="now")
Pre_Virtual_Chin_RestClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip
frameN = -1
# -------Run Routine "Pre_Virtual_Chin_Rest"-------
while continueRoutine:
# get current time
t = Pre_Virtual_Chin_RestClock.getTime()
tThisFlip = win.getFutureFlipTime(clock=Pre_Virtual_Chin_RestClock)
tThisFlipGlobal = win.getFutureFlipTime(clock=None)
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *text* updates
if text.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
# keep track of start time/frame for later
text.frameNStart = frameN # exact frame index
text.tStart = t # local t and not account for scr refresh
text.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(text, 'tStartRefresh') # time at next scr refresh
text.setAutoDraw(True)
# *mouse* updates
if mouse.status == NOT_STARTED and t >= 0.0-frameTolerance:
# keep track of start time/frame for later
mouse.frameNStart = frameN # exact frame index
mouse.tStart = t # local t and not account for scr refresh
mouse.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(mouse, 'tStartRefresh') # time at next scr refresh
mouse.status = STARTED
mouse.mouseClock.reset()
prevButtonState = mouse.getPressed() # if button is down already this ISN'T a new click
if mouse.status == STARTED: # only update if started and not finished!
buttons = mouse.getPressed()
if buttons != prevButtonState: # button state changed?
prevButtonState = buttons
if sum(buttons) > 0: # state changed to a new click
continueRoutine = False
# check for quit (typically the Esc key)
if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
core.quit()
# check if all components have finished
if not continueRoutine: # a component has requested a forced-end of Routine
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in Pre_Virtual_Chin_RestComponents:
if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
continueRoutine = True
break # at least one component has not yet finished
# refresh the screen
if continueRoutine: # don't flip if this routine is over or we'll get a blank screen
win.flip()
# -------Ending Routine "Pre_Virtual_Chin_Rest"-------
for thisComponent in Pre_Virtual_Chin_RestComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# store data for thisExp (ExperimentHandler)
thisExp.nextEntry()
# the Routine "Pre_Virtual_Chin_Rest" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()
# ------Prepare to start Routine "Post_Virtual_Chin_Rest"-------
continueRoutine = True
# update component parameters for each repeat
# setup some python lists for storing info about the mouse_2
gotValidClick = False # until a click is received
# keep track of which components have finished
Post_Virtual_Chin_RestComponents = [mouse_2, text_2]
for thisComponent in Post_Virtual_Chin_RestComponents:
thisComponent.tStart = None
thisComponent.tStop = None
thisComponent.tStartRefresh = None
thisComponent.tStopRefresh = None
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
# reset timers
t = 0
_timeToFirstFrame = win.getFutureFlipTime(clock="now")
Post_Virtual_Chin_RestClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip
frameN = -1
# -------Run Routine "Post_Virtual_Chin_Rest"-------
while continueRoutine:
# get current time
t = Post_Virtual_Chin_RestClock.getTime()
tThisFlip = win.getFutureFlipTime(clock=Post_Virtual_Chin_RestClock)
tThisFlipGlobal = win.getFutureFlipTime(clock=None)
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *mouse_2* updates
if mouse_2.status == NOT_STARTED and t >= 0.0-frameTolerance:
# keep track of start time/frame for later
mouse_2.frameNStart = frameN # exact frame index
mouse_2.tStart = t # local t and not account for scr refresh
mouse_2.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(mouse_2, 'tStartRefresh') # time at next scr refresh
mouse_2.status = STARTED
mouse_2.mouseClock.reset()
prevButtonState = mouse_2.getPressed() # if button is down already this ISN'T a new click
if mouse_2.status == STARTED: # only update if started and not finished!
buttons = mouse_2.getPressed()
if buttons != prevButtonState: # button state changed?
prevButtonState = buttons
if sum(buttons) > 0: # state changed to a new click
continueRoutine = False
# *text_2* updates
if text_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
# keep track of start time/frame for later
text_2.frameNStart = frameN # exact frame index
text_2.tStart = t # local t and not account for scr refresh
text_2.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(text_2, 'tStartRefresh') # time at next scr refresh
text_2.setAutoDraw(True)
# check for quit (typically the Esc key)
if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
core.quit()
# check if all components have finished
if not continueRoutine: # a component has requested a forced-end of Routine
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in Post_Virtual_Chin_RestComponents:
if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
continueRoutine = True
break # at least one component has not yet finished
# refresh the screen
if continueRoutine: # don't flip if this routine is over or we'll get a blank screen
win.flip()
# -------Ending Routine "Post_Virtual_Chin_Rest"-------
for thisComponent in Post_Virtual_Chin_RestComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# store data for thisExp (ExperimentHandler)
thisExp.nextEntry()
# the Routine "Post_Virtual_Chin_Rest" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()
# ------Prepare to start Routine "Instructions"-------
continueRoutine = True
# update component parameters for each repeat
# setup some python lists for storing info about the mouse_3
gotValidClick = False # until a click is received
# keep track of which components have finished
InstructionsComponents = [mouse_3, text_3]
for thisComponent in InstructionsComponents:
thisComponent.tStart = None
thisComponent.tStop = None
thisComponent.tStartRefresh = None
thisComponent.tStopRefresh = None
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
# reset timers
t = 0
_timeToFirstFrame = win.getFutureFlipTime(clock="now")
InstructionsClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip
frameN = -1
# -------Run Routine "Instructions"-------
while continueRoutine:
# get current time
t = InstructionsClock.getTime()
tThisFlip = win.getFutureFlipTime(clock=InstructionsClock)
tThisFlipGlobal = win.getFutureFlipTime(clock=None)
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *mouse_3* updates
if mouse_3.status == NOT_STARTED and t >= 0.0-frameTolerance:
# keep track of start time/frame for later
mouse_3.frameNStart = frameN # exact frame index
mouse_3.tStart = t # local t and not account for scr refresh
mouse_3.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(mouse_3, 'tStartRefresh') # time at next scr refresh
mouse_3.status = STARTED
mouse_3.mouseClock.reset()
prevButtonState = mouse_3.getPressed() # if button is down already this ISN'T a new click
if mouse_3.status == STARTED: # only update if started and not finished!
buttons = mouse_3.getPressed()
if buttons != prevButtonState: # button state changed?
prevButtonState = buttons
if sum(buttons) > 0: # state changed to a new click
continueRoutine = False
# *text_3* updates
if text_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
# keep track of start time/frame for later
text_3.frameNStart = frameN # exact frame index
text_3.tStart = t # local t and not account for scr refresh
text_3.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(text_3, 'tStartRefresh') # time at next scr refresh
text_3.setAutoDraw(True)
# check for quit (typically the Esc key)
if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
core.quit()
# check if all components have finished
if not continueRoutine: # a component has requested a forced-end of Routine
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in InstructionsComponents:
if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
continueRoutine = True
break # at least one component has not yet finished
# refresh the screen
if continueRoutine: # don't flip if this routine is over or we'll get a blank screen
win.flip()
# -------Ending Routine "Instructions"-------
for thisComponent in InstructionsComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# store data for thisExp (ExperimentHandler)
thisExp.nextEntry()
# the Routine "Instructions" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()
# ------Prepare to start Routine "Instructions_2"-------
continueRoutine = True
# update component parameters for each repeat
# setup some python lists for storing info about the mouse_4
gotValidClick = False # until a click is received
# keep track of which components have finished
Instructions_2Components = [mouse_4, text_4]
for thisComponent in Instructions_2Components:
thisComponent.tStart = None
thisComponent.tStop = None
thisComponent.tStartRefresh = None
thisComponent.tStopRefresh = None
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
# reset timers
t = 0
_timeToFirstFrame = win.getFutureFlipTime(clock="now")
Instructions_2Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip
frameN = -1
# -------Run Routine "Instructions_2"-------
while continueRoutine:
# get current time
t = Instructions_2Clock.getTime()
tThisFlip = win.getFutureFlipTime(clock=Instructions_2Clock)
tThisFlipGlobal = win.getFutureFlipTime(clock=None)
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *mouse_4* updates
if mouse_4.status == NOT_STARTED and t >= 0.0-frameTolerance:
# keep track of start time/frame for later
mouse_4.frameNStart = frameN # exact frame index
mouse_4.tStart = t # local t and not account for scr refresh
mouse_4.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(mouse_4, 'tStartRefresh') # time at next scr refresh
mouse_4.status = STARTED
mouse_4.mouseClock.reset()
prevButtonState = mouse_4.getPressed() # if button is down already this ISN'T a new click
if mouse_4.status == STARTED: # only update if started and not finished!
buttons = mouse_4.getPressed()
if buttons != prevButtonState: # button state changed?
prevButtonState = buttons
if sum(buttons) > 0: # state changed to a new click
continueRoutine = False
# *text_4* updates
if text_4.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
# keep track of start time/frame for later
text_4.frameNStart = frameN # exact frame index
text_4.tStart = t # local t and not account for scr refresh
text_4.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(text_4, 'tStartRefresh') # time at next scr refresh
text_4.setAutoDraw(True)
# check for quit (typically the Esc key)
if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
core.quit()
# check if all components have finished
if not continueRoutine: # a component has requested a forced-end of Routine
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in Instructions_2Components:
if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
continueRoutine = True
break # at least one component has not yet finished
# refresh the screen
if continueRoutine: # don't flip if this routine is over or we'll get a blank screen
win.flip()
# -------Ending Routine "Instructions_2"-------
for thisComponent in Instructions_2Components:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# store data for thisExp (ExperimentHandler)
thisExp.nextEntry()
# the Routine "Instructions_2" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()
# set up handler to look after randomisation of conditions etc
Face1 = data.TrialHandler(nReps=1, method='random',
extraInfo=expInfo, originPath=-1,
trialList=data.importConditions('image.1.'+condition+'.xlsx'),
seed=None, name='Face1')
thisExp.addLoop(Face1) # add the loop to the experiment
thisFace1 = Face1.trialList[0] # so we can initialise stimuli with some values
# abbreviate parameter names if possible (e.g. rgb = thisFace1.rgb)
if thisFace1 != None:
for paramName in thisFace1:
exec('{} = thisFace1[paramName]'.format(paramName))
for thisFace1 in Face1:
currentLoop = Face1
# abbreviate parameter names if possible (e.g. rgb = thisFace1.rgb)
if thisFace1 != None:
for paramName in thisFace1:
exec('{} = thisFace1[paramName]'.format(paramName))
# ------Prepare to start Routine "Instructions_3"-------
continueRoutine = True
# update component parameters for each repeat
# setup some python lists for storing info about the mouse_5
gotValidClick = False # until a click is received
image_6.setImage(target)
# keep track of which components have finished
Instructions_3Components = [mouse_5, text_5, image_6]
for thisComponent in Instructions_3Components:
thisComponent.tStart = None
thisComponent.tStop = None
thisComponent.tStartRefresh = None
thisComponent.tStopRefresh = None
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
# reset timers
t = 0
_timeToFirstFrame = win.getFutureFlipTime(clock="now")
Instructions_3Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip
frameN = -1
# -------Run Routine "Instructions_3"-------
while continueRoutine:
# get current time
t = Instructions_3Clock.getTime()
tThisFlip = win.getFutureFlipTime(clock=Instructions_3Clock)
tThisFlipGlobal = win.getFutureFlipTime(clock=None)
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *mouse_5* updates
if mouse_5.status == NOT_STARTED and t >= 0.0-frameTolerance:
# keep track of start time/frame for later
mouse_5.frameNStart = frameN # exact frame index
mouse_5.tStart = t # local t and not account for scr refresh
mouse_5.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(mouse_5, 'tStartRefresh') # time at next scr refresh
mouse_5.status = STARTED
mouse_5.mouseClock.reset()
prevButtonState = mouse_5.getPressed() # if button is down already this ISN'T a new click
if mouse_5.status == STARTED: # only update if started and not finished!
buttons = mouse_5.getPressed()
if buttons != prevButtonState: # button state changed?
prevButtonState = buttons
if sum(buttons) > 0: # state changed to a new click
continueRoutine = False
# *text_5* updates
if text_5.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
# keep track of start time/frame for later
text_5.frameNStart = frameN # exact frame index
text_5.tStart = t # local t and not account for scr refresh
text_5.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(text_5, 'tStartRefresh') # time at next scr refresh
text_5.setAutoDraw(True)
# *image_6* updates
if image_6.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
# keep track of start time/frame for later
image_6.frameNStart = frameN # exact frame index
image_6.tStart = t # local t and not account for scr refresh
image_6.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(image_6, 'tStartRefresh') # time at next scr refresh
image_6.setAutoDraw(True)
# check for quit (typically the Esc key)
if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
core.quit()
# check if all components have finished
if not continueRoutine: # a component has requested a forced-end of Routine
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in Instructions_3Components:
if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
continueRoutine = True
break # at least one component has not yet finished
# refresh the screen
if continueRoutine: # don't flip if this routine is over or we'll get a blank screen
win.flip()
# -------Ending Routine "Instructions_3"-------
for thisComponent in Instructions_3Components:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# store data for Face1 (TrialHandler)
# the Routine "Instructions_3" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()
thisExp.nextEntry()
# completed 1 repeats of 'Face1'
# set up handler to look after randomisation of conditions etc
Face2 = data.TrialHandler(nReps=1, method='random',
extraInfo=expInfo, originPath=-1,
trialList=data.importConditions('image.2.'+condition+'.xlsx'),
seed=None, name='Face2')
thisExp.addLoop(Face2) # add the loop to the experiment
thisFace2 = Face2.trialList[0] # so we can initialise stimuli with some values
# abbreviate parameter names if possible (e.g. rgb = thisFace2.rgb)
if thisFace2 != None:
for paramName in thisFace2:
exec('{} = thisFace2[paramName]'.format(paramName))
for thisFace2 in Face2:
currentLoop = Face2
# abbreviate parameter names if possible (e.g. rgb = thisFace2.rgb)
if thisFace2 != None:
for paramName in thisFace2:
exec('{} = thisFace2[paramName]'.format(paramName))
# ------Prepare to start Routine "Instructions_4"-------
continueRoutine = True
# update component parameters for each repeat
# setup some python lists for storing info about the mouse_6
gotValidClick = False # until a click is received
image_7.setImage(target)
# keep track of which components have finished
Instructions_4Components = [mouse_6, text_6, image_7]
for thisComponent in Instructions_4Components:
thisComponent.tStart = None
thisComponent.tStop = None
thisComponent.tStartRefresh = None
thisComponent.tStopRefresh = None
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
# reset timers
t = 0
_timeToFirstFrame = win.getFutureFlipTime(clock="now")
Instructions_4Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip
frameN = -1
# -------Run Routine "Instructions_4"-------
while continueRoutine:
# get current time
t = Instructions_4Clock.getTime()
tThisFlip = win.getFutureFlipTime(clock=Instructions_4Clock)
tThisFlipGlobal = win.getFutureFlipTime(clock=None)
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *mouse_6* updates
if mouse_6.status == NOT_STARTED and t >= 0.0-frameTolerance:
# keep track of start time/frame for later
mouse_6.frameNStart = frameN # exact frame index
mouse_6.tStart = t # local t and not account for scr refresh
mouse_6.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(mouse_6, 'tStartRefresh') # time at next scr refresh
mouse_6.status = STARTED
mouse_6.mouseClock.reset()
prevButtonState = mouse_6.getPressed() # if button is down already this ISN'T a new click
if mouse_6.status == STARTED: # only update if started and not finished!
buttons = mouse_6.getPressed()
if buttons != prevButtonState: # button state changed?
prevButtonState = buttons
if sum(buttons) > 0: # state changed to a new click
continueRoutine = False
# *text_6* updates
if text_6.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
# keep track of start time/frame for later