You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two major changes: 1) Commendably well-earned fixes to all go_no-go tasks to ensure an exact 6go:1no-go ratio; 2) CTI to start at 350 for shape_matching_with_cued_task_switch.
Copy file name to clipboardExpand all lines: go_nogo_single_task_network/experiment.js
+67-26Lines changed: 67 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -107,14 +107,14 @@ var appendData = function(data) {
107
107
trial_num: current_trial,
108
108
})
109
109
110
-
current_trial=current_trial+1
110
+
current_trial+=1
111
111
}
112
112
113
113
vargetFeedback=function(){
114
114
if(stim.key_answer==-1){
115
115
return'<div class = centerbox><div class = center-text>Correct!</div></div>'+prompt_text_list
116
116
}else{
117
-
return'<div class = centerbox><div class = center-text>Incorrect</div></p></div>'+prompt_text_list
117
+
return'<div class = centerbox><div class = center-text>The shape was outlined</div></p></div>'+prompt_text_list
118
118
}
119
119
}
120
120
@@ -166,23 +166,64 @@ var correct_responses = [
166
166
varstims=[["solid","stim1"],["outlined","stim2"]]//solid and outlined squares used as stimuli for this task are not png files as in some others, but they are defined in style.css
167
167
vargap=0
168
168
varcurrent_trial=0
169
-
varpractice_stimuli=[{//each {} consists of stimulus, data, and key_answer
170
-
stimulus: '<div class = bigbox><div class = centerbox><div class = gng_number><div class = cue-text><div id = '+stims[0][1]+'></div></div></div></div></div>',
171
-
data: {
172
-
correct_response: correct_responses[0][1],
173
-
go_nogo_condition: correct_responses[0][0],
174
-
trial_id: 'practice_trial'
175
-
},
176
-
key_answer: correct_responses[0][1]
177
-
},{
169
+
varpractice_stimuli=[{//To change go:nogo ratio, add or remove one or more sub-dictionaries within practice_stimuli and test_stimuli_block
178
170
stimulus: '<div class = bigbox><div class = centerbox><div class = gng_number><div class = cue-text><div id = '+stims[1][1]+'></div></div></div></div></div>',
179
171
data: {
180
172
correct_response: correct_responses[1][1],
181
173
go_nogo_condition: correct_responses[1][0],
182
174
trial_id: 'practice_trial'
183
175
},
184
176
key_answer: correct_responses[1][1]
185
-
}];
177
+
},{
178
+
stimulus: '<div class = bigbox><div class = centerbox><div class = gng_number><div class = cue-text><div id = '+stims[0][1]+'></div></div></div></div></div>',
179
+
data: {
180
+
correct_response: correct_responses[0][1],
181
+
go_nogo_condition: correct_responses[0][0],
182
+
trial_id: 'practice_trial'
183
+
},
184
+
key_answer: correct_responses[0][1]
185
+
},{
186
+
stimulus: '<div class = bigbox><div class = centerbox><div class = gng_number><div class = cue-text><div id = '+stims[0][1]+'></div></div></div></div></div>',
187
+
data: {
188
+
correct_response: correct_responses[0][1],
189
+
go_nogo_condition: correct_responses[0][0],
190
+
trial_id: 'practice_trial'
191
+
},
192
+
key_answer: correct_responses[0][1]
193
+
},{
194
+
stimulus: '<div class = bigbox><div class = centerbox><div class = gng_number><div class = cue-text><div id = '+stims[0][1]+'></div></div></div></div></div>',
195
+
data: {
196
+
correct_response: correct_responses[0][1],
197
+
go_nogo_condition: correct_responses[0][0],
198
+
trial_id: 'practice_trial'
199
+
},
200
+
key_answer: correct_responses[0][1]
201
+
},{
202
+
stimulus: '<div class = bigbox><div class = centerbox><div class = gng_number><div class = cue-text><div id = '+stims[0][1]+'></div></div></div></div></div>',
203
+
data: {
204
+
correct_response: correct_responses[0][1],
205
+
go_nogo_condition: correct_responses[0][0],
206
+
trial_id: 'practice_trial'
207
+
},
208
+
key_answer: correct_responses[0][1]
209
+
},{
210
+
stimulus: '<div class = bigbox><div class = centerbox><div class = gng_number><div class = cue-text><div id = '+stims[0][1]+'></div></div></div></div></div>',
211
+
data: {
212
+
correct_response: correct_responses[0][1],
213
+
go_nogo_condition: correct_responses[0][0],
214
+
trial_id: 'practice_trial'
215
+
},
216
+
key_answer: correct_responses[0][1]
217
+
},{
218
+
stimulus: '<div class = bigbox><div class = centerbox><div class = gng_number><div class = cue-text><div id = '+stims[0][1]+'></div></div></div></div></div>',
219
+
data: {
220
+
correct_response: correct_responses[0][1],
221
+
go_nogo_condition: correct_responses[0][0],
222
+
trial_id: 'practice_trial'
223
+
},
224
+
key_answer: correct_responses[0][1]
225
+
}
226
+
];
186
227
187
228
188
229
//set up block stim. test_stim_responses indexed by [block][stim][type]
@@ -242,14 +283,14 @@ var accuracy_thresh = 0.75
242
283
varrt_thresh=1000
243
284
varmissed_thresh=0.10
244
285
245
-
varpractice_length=14
246
-
varpractice_thresh=3// 3 blocks of 10 trials
286
+
varpractice_len=28
287
+
varpractice_thresh=3
247
288
248
-
vartest_length=245//keeping # of no_go trials at 50 -> new ratio 6:1 makes total of 350 trials
249
-
varnumTrialsPerBlock=49// must be divisible by 5 (7/31: new ratio go:nogo is 6:1 -> divisible by 7)
250
-
varnumTestBlocks=test_length/numTrialsPerBlock
289
+
varexp_len=245//multiple of numTrialsPerBlock
290
+
varnumTrialsPerBlock=49// multiple of 7 (6go:1nogo)
task_switches.unshift(//.unshift(): add to the beginning of an array
402
+
{
403
+
task_switch: 'na',
404
+
cue_switch: 'na',
405
+
go_no_go_type: jsPsych.randomization.repeat(["go","go","go","go","go","go","nogo"],1).pop()//.pop() removes the last element of an array, and returns that element. Note: This method changes the length of an array.
406
+
}
407
+
)
408
+
varpracticeStims=genStims(practice_len+1)
409
+
vartestStims=genStims(numTrialsPerBlock+1)
410
+
varstims=practiceStims//genStims returns stims, so stims = practiceStims makes some sense.
411
+
varcurr_task=randomDraw(getKeys(tasks))//tasks is in line 368, a dict containing 2 dicts, which are two tasks each containing 2 cues.
407
412
varlast_task='na'//object that holds the last task, set by setStims()
408
413
varcurr_cue='na'//object that holds the current cue, set by setStims()
409
414
varcue_i=randomDraw([0,1])//index for one of two cues of the current task
@@ -427,8 +432,8 @@ var pathSource = "/static/experiments/go_nogo_with_cued_task_switching/images/"
vargo_nogo_conditions=['go','go','go','go','go','go','nogo']//To change go:nogo ratio, modify this AND also the denominator in numIterations < numTrialsPerBlock/... within var createTrialTypes = function(numTrialsPerBlock)
403
402
vargo_no_go_styles=['solid','outlined']//has dashed as well
0 commit comments