Skip to content

Commit 82d85b6

Browse files
IanEisenbergvsoch
authored andcommitted
Assess update (#495)
* changed reaction time calculation to median instead of mean * made sure responses could be made on trials that are evaluated for assessperformance * fixed gongo bug
1 parent 167890c commit 82d85b6

File tree

54 files changed

+254
-615
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+254
-615
lines changed

adaptive_n_back/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"cognitive_atlas_task_id": "trm_56674133b666c",
66
"template":"jspsych",
77
"run": [
8+
"static/js/math.min.js",
89
"static/js/jspsych/jspsych.js",
910
"static/js/jspsych/plugins/jspsych-text.js",
1011
"static/js/jspsych/poldrack_plugins/jspsych-poldrack-text.js",

adaptive_n_back/experiment.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,23 @@ function assessPerformance() {
2929
choice_counts[-1] = 0
3030
choice_counts[32] = 0
3131
for (var i = 0; i < experiment_data.length; i++) {
32-
trial_count += 1
33-
rt = experiment_data[i].rt
34-
key = experiment_data[i].key_press
35-
choice_counts[key] += 1
36-
if (rt == -1) {
37-
missed_count += 1
38-
} else {
39-
rt_array.push(rt)
32+
if (experiment_data[i].possible_responses != 'none') {
33+
trial_count += 1
34+
rt = experiment_data[i].rt
35+
key = experiment_data[i].key_press
36+
choice_counts[key] += 1
37+
if (rt == -1) {
38+
missed_count += 1
39+
} else {
40+
rt_array.push(rt)
41+
}
4042
}
4143
}
4244
//calculate average rt
43-
var sum = 0
44-
for (var j = 0; j < rt_array.length; j++) {
45-
sum += rt_array[j]
46-
}
47-
var avg_rt = sum / rt_array.length || -1
45+
var avg_rt = -1
46+
if (rt_array.length !== 0) {
47+
avg_rt = math.median(rt_array)
48+
}
4849
var missed_percent = missed_count/experiment_data.length
4950
//calculate whether response distribution is okay
5051
var responses_ok = true

angling_risk_task_always_sunny/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"name": "Angling Risk Task - always Sunny",
44
"template":"jspsych",
55
"run": [
6+
"static/js/math.min.js",
67
"static/js/jspsych/jspsych.js",
78
"static/js/jspsych/plugins/jspsych-text.js",
89
"static/js/jspsych/poldrack_plugins/jspsych-poldrack-text.js",

angling_risk_task_always_sunny/experiment.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@ function assessPerformance() {
3535
}
3636
}
3737
//calculate average rt
38-
var sum = 0
39-
for (var j = 0; j < rt_array.length; j++) {
40-
sum += rt_array[j]
41-
}
42-
var avg_rt = sum / rt_array.length || -1
38+
var avg_rt = -1
39+
if (rt_array.length !== 0) {
40+
avg_rt = math.median(rt_array)
41+
}
4342
var missed_percent = missed_count/experiment_data.length
4443
credit_var = (missed_percent < 0.4 && avg_rt > 200)
4544
if (credit_var === true) {

attention_network_task/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"name": "Attention Network Task",
44
"template":"jspsych",
55
"run": [
6+
"static/js/math.min.js",
67
"static/js/jspsych/jspsych.js",
78
"static/js/jspsych/plugins/jspsych-text.js",
89
"static/js/jspsych/plugins/jspsych-call-function.js",

attention_network_task/experiment.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,10 @@ function assessPerformance() {
4646
}
4747
}
4848
//calculate average rt
49-
var sum = 0
50-
for (var j = 0; j < rt_array.length; j++) {
51-
sum += rt_array[j]
52-
}
53-
var avg_rt = sum / rt_array.length || -1
49+
var avg_rt = -1
50+
if (rt_array.length !== 0) {
51+
avg_rt = math.median(rt_array)
52+
}
5453
//calculate whether response distribution is okay
5554
var responses_ok = true
5655
Object.keys(choice_counts).forEach(function(key, index) {

bickel_titrator/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"name": "Adaptive Bickel Titrator",
44
"template":"jspsych",
55
"run": [
6+
"static/js/math.min.js",
67
"static/js/jspsych/jspsych.js",
78
"static/js/jspsych/plugins/jspsych-text.js",
89
"static/js/jspsych/poldrack_plugins/jspsych-poldrack-text.js",

bickel_titrator/experiment.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,23 @@ function assessPerformance() {
3636
choice_counts[choices[k]] = 0
3737
}
3838
for (var i = 0; i < experiment_data.length; i++) {
39-
trial_count += 1
40-
rt = experiment_data[i].rt
41-
key = experiment_data[i].key_press
42-
choice_counts[key] += 1
43-
if (rt == -1) {
44-
missed_count += 1
45-
} else {
46-
rt_array.push(rt)
47-
}
39+
if (experiment_data[i].possible_responses != 'none') {
40+
trial_count += 1
41+
rt = experiment_data[i].rt
42+
key = experiment_data[i].key_press
43+
choice_counts[key] += 1
44+
if (rt == -1) {
45+
missed_count += 1
46+
} else {
47+
rt_array.push(rt)
48+
}
49+
}
4850
}
4951
//calculate average rt
50-
var sum = 0
51-
for (var j = 0; j < rt_array.length; j++) {
52-
sum += rt_array[j]
53-
}
54-
var avg_rt = sum / rt_array.length || -1
52+
var avg_rt = -1
53+
if (rt_array.length !== 0) {
54+
avg_rt = math.median(rt_array)
55+
}
5556
var missed_percent = missed_count/trial_count
5657
credit_var = (missed_percent < 0.4 && avg_rt > 200)
5758
var bonus = randomDraw(bonus_list)

choice_reaction_time/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"name": "Choice Reaction Time",
44
"template":"jspsych",
55
"run": [
6+
"static/js/math.min.js",
67
"static/js/jspsych/jspsych.js",
78
"static/js/jspsych/plugins/jspsych-text.js",
89
"static/js/jspsych/plugins/jspsych-call-function.js",

choice_reaction_time/experiment.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,23 @@ function assessPerformance() {
3131
choice_counts[choices[k]] = 0
3232
}
3333
for (var i = 0; i < experiment_data.length; i++) {
34-
trial_count += 1
35-
rt = experiment_data[i].rt
36-
key = experiment_data[i].key_press
37-
choice_counts[key] += 1
38-
if (rt == -1) {
39-
missed_count += 1
40-
} else {
41-
rt_array.push(rt)
34+
if (experiment_data[i].possible_responses != 'none') {
35+
trial_count += 1
36+
rt = experiment_data[i].rt
37+
key = experiment_data[i].key_press
38+
choice_counts[key] += 1
39+
if (rt == -1) {
40+
missed_count += 1
41+
} else {
42+
rt_array.push(rt)
43+
}
4244
}
4345
}
4446
//calculate average rt
45-
var sum = 0
46-
for (var j = 0; j < rt_array.length; j++) {
47-
sum += rt_array[j]
48-
}
49-
var avg_rt = sum / rt_array.length || -1
47+
var avg_rt = -1
48+
if (rt_array.length !== 0) {
49+
avg_rt = math.median(rt_array)
50+
}
5051
//calculate whether response distribution is okay
5152
var responses_ok = true
5253
Object.keys(choice_counts).forEach(function(key, index) {

0 commit comments

Comments
 (0)