-
Notifications
You must be signed in to change notification settings - Fork 0
/
touch_nback2.psy
230 lines (220 loc) · 8.33 KB
/
touch_nback2.psy
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
options
bitmapdir stimuli
sounddir stimuli
set &maxrt 760 # stimulus presentation
set &iti 2000 # intertrial interval
set &choosechance 3 # 1 in 4 are matching
mouse on
sounds
sound_good good.mp3
sound_bad wrong.mp3
fonts
arial 18
bitmaps
letterA ## 15 letters
letterB
letterC
letterD
letterE
letterH
letterI
letterK
letterL
letterM
letterO
letterP
letterR
letterS
letterT
overlay
instruction1
instruction2
instruction3
## a part is a reusable piece of code. In this case, it gives for the
## 3 blocks the feedback
part myfeedback
feedback
text align left
set &Total1 count ; select c8 == 1 && c1 == BLOCKNUMBER ## number of trials where there was a 2back item
set &Total2 count ; select c8 > 1 && c1 == BLOCKNUMBER ## number of trials where there was NOT a 3back item
set &Matches count ; select c4 == 1 && c1 == BLOCKNUMBER ## number of matches
set &Misses count ; select c5 == 1 && c1 == BLOCKNUMBER ## number of misses
set &FalseAlarms count ; select c6 == 1 && c1 == BLOCKNUMBER ## number of false alarms
set &MatchesPerc expression &Matches / &Total1 * 100.0
set &MissesPerc expression &Misses / &Total1 * 100.0
set &FalseAlarmsPerc expression &FalseAlarms / &Total2 * 100.0
text -250 -200 "There were 25 trials in total in this block"
text -250 -150 &Total1 ; prefix "Total trials that had a match:"
text -250 -100 &Total2 ; prefix "Total trials that had no match:"
text -250 -50 &Matches ; prefix "Number of correctly matched items:"
text -250 -0 &Misses ; prefix "Number of missed items:"
text -250 50 &FalseAlarms ; prefix "Number of false alarms:"
text -250 100 &MatchesPerc ; prefix "Percentage correct matches:" ; postfix " %"
text -250 150 &MissesPerc ; prefix "Percentage missed items:" ; postfix " %"
text -250 200 &FalseAlarmsPerc ; prefix "Percentage false alarms:" ; postfix " %"
text -250 250 "Click mouse to continue and show data"
wait_for_key mouse
end
task nback_learning
set &trialcount increase
set $currentletter random 1 15 ## choose randomw letter, might be overridden
############################################################################
## is this condition a yes condition?
set $memory random 1 &choosechance ## 1 in &choosechance trials will be matching trial
## if a 2back trial (there must have been at least 2 trials before for this to be possible)
if ¬nbacktrialcount == 15 || $memory == 1 && &trialcount > 2 && &nbacktrialcount < 10
set &nbacktrialcount increase
set $currentletter &nback2
set $requiredresponse 1 ## this is a MATCH, so response is required
fi
## if a NON 2back trial
if $memory != 1 || &trialcount <= 2 ## chose a letter but not that of 2 trials ago
set ¬nbacktrialcount increase
set $currentletter random 1 15
while $currentletter == &nback2 ## choose anything but NOT that of 2 back
set $currentletter random 1 15
while-end
set $requiredresponse 2 ## this is a NON-match, so people need to withhold
fi
############################################################################
## this part is the only part that is different between learning and non-learning
draw off
show bitmap $currentletter ## stimulus 1
## now show previous trials
if &trialcount > 1
show bitmap &nback1 -100 0 # show 1-back left of stimulus
show bitmap overlay -100 0 # greyed out
fi
if &trialcount > 2
show bitmap &nback2 -200 0 # show 2-back left of stimulus
show bitmap overlay -200 0 # greyed out
fi
draw on
######################################################################
readmouse l 1 &maxrt ## click the first bitmap in this task
############################################################################
## the different possible response outcomes
##
if $requiredresponse == 1 and STATUS != TIMEOUT
set $score 1 ## means good
set $match 1
sound sound_good
fi
if $requiredresponse == 1 and STATUS == TIMEOUT
set $score 0 ## means wrong -- miss
set $miss 1
sound sound_bad
fi
if $requiredresponse == 2 and STATUS == TIMEOUT
set $score 1 ## means good
fi
if $requiredresponse == 2 and STATUS != TIMEOUT
set $score 0 ## means wrong
set $false_alarm 1
sound sound_bad
fi
#
######################################################################
#
set $extrawait expression &maxrt - RT ## how much time is left between max RT and now?
delay $extrawait ## wait until letter has been on screen total of 2000 ms
clear screen
delay 2000 ## wait 2000 ms
#
### now save the letter for next trial
#
set &nback2 &nback1
set &nback1 $currentletter
### save the data
save BLOCKNUMBER &trialcount &nbacktrialcount ¬nbacktrialcount $score $match $miss $false_alarm RT $memory $currentletter &nback1 &nback2
task nback_normal
set &trialcount increase
set $currentletter random 1 15 ## choose randomw letter, might be overridden
############################################################################
## is this condition a yes condition?
set $memory random 1 &choosechance ## 1 in &choosechance trials will be matching trial
## if a 2back trial (there must have been at least 2 trials before for this to be possible)
if ¬nbacktrialcount == 15 || $memory == 1 && &trialcount > 2 && &nbacktrialcount < 10
set &nbacktrialcount increase
set $currentletter &nback2
set $requiredresponse 1 ## this is a MATCH, so response is required
fi
## if a NON 2back trial
if $memory != 1 || &trialcount <= 2 ## chose a letter but not that of 2 trials ago
set ¬nbacktrialcount increase
set $currentletter random 1 15
while $currentletter == &nback2 ## choose anything but NOT that of 2 back
set $currentletter random 1 15
while-end
set $requiredresponse 2 ## this is a NON-match, so people need to withhold
fi
############################################################################
## this part is the only part that is different between learning and non-learning
draw off
show bitmap $currentletter ## stimulus 1
draw on
######################################################################
readmouse l 1 &maxrt ## click the first bitmap in this task
############################################################################
## the different possible response outcomes
##
if $requiredresponse == 1 and STATUS != TIMEOUT
set $score 1 ## means good
set $match 1
sound sound_good
fi
if $requiredresponse == 1 and STATUS == TIMEOUT
set $score 0 ## means wrong -- miss
set $miss 1
sound sound_bad
fi
if $requiredresponse == 2 and STATUS == TIMEOUT
set $score 1 ## means good
fi
if $requiredresponse == 2 and STATUS != TIMEOUT
set $score 0 ## means wrong
set $false_alarm 1
sound sound_bad
fi
#
######################################################################
#
set $extrawait expression &maxrt - RT ## how much time is left between max RT and now?
delay $extrawait ## wait until letter has been on screen total of 2000 ms
clear screen
delay 2000 ## wait 2000 ms
#
### now save the letter for next trial
#
set &nback2 &nback1
set &nback1 $currentletter
### save the data
save BLOCKNUMBER &trialcount &nbacktrialcount ¬nbacktrialcount $score $match $miss $false_alarm RT $memory $currentletter &nback1 &nback2
block training
set &trialcount 0 # make sure you use this again if you have another block
set &nbacktrialcount 0 # number of trials where there was a 2back item
set ¬nbacktrialcount 0 # number of trials where there was NOT a 2back item
message instruction1 mouse
message instruction2 mouse
tasklist
nback_learning 25
end
part myfeedback
block normal1
set &trialcount 0 # make sure you use this again if you have another block
set &nbacktrialcount 0 # number of trials where there was a 2back item
set ¬nbacktrialcount 0 # number of trials where there was NOT a 2back item
message instruction3 mouse
tasklist
nback_normal 25
end
part myfeedback
block normal2
set &trialcount 0 # make sure you use this again if you have another block
set &nbacktrialcount 0 # number of trials where there was a 2back item
set ¬nbacktrialcount 0 # number of trials where there was NOT a 2back item
message instruction3 mouse
tasklist
nback_normal 25
end
part myfeedback