/
sart.py
72 lines (53 loc) · 1.38 KB
/
sart.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
from experiments import printWord, showInstructions
import subject
import shuffler
import pygame
import random
from CBalance import Counterbalance as cb
import VisionEgg
from VisionEgg.Core import get_default_screen, Viewport
from VisionEgg.FlowControl import Presentation, FunctionController, TIME_SEC_ABSOLUTE, FRAMES_ABSOLUTE
from VisionEgg.Textures import *
sub = subject.Subject(666, experiment='sart')
digits = range(0, 10)
ls = shuffler.ListShuffler(digits, 30)
stimList = ls.shuffle()
target = 3
sub = subject.Subject(666, experiment="sart")
def key_handler(event):
global s
global target
global acc
global RT
if event.key == pygame.locals.K_SPACE:
if s == target:
acc = 1
pressed = 1
else:
acc = 0
pressed = 1
RT = p.time_sec_since_go
trial = 0
###SET SCREEN
screen = get_default_screen()
screen.parameters.bgcolor = (0, 0, 0)
pygame.font.init()
pygame.mixer.init()
sound = pygame.mixer.Sound("beep.wav")
sound.play()
for s in stimList:
trial += 1
print s
RT = 0
acc = 0
w, v = printWord(screen, str(s), 48, [255, 255, 255])
p = Presentation(go_duration=[0.675, 'seconds'], viewports=[v])
p.parameters.handle_event_callbacks=[(pygame.locals.KEYDOWN, key_handler)]
p.go()
sub.inputData(trial, "RT", RT)
sub.inputData(trial, "acc", acc)
sub.inputData(trial, "s", s)
sub.inputData(trial, "target", target)
sub.printData()
sound.play()
sub.printData()