From 21aaa60c99375315bf44869308714ecb73d10e03 Mon Sep 17 00:00:00 2001 From: Jamie Li Date: Sat, 13 Oct 2018 11:13:15 -0700 Subject: [PATCH 1/8] fixing jshint errors, added tasks to circle.yml file --- circle.yml | 6 ++++++ cue_control_food/experiment.js | 2 +- cue_control_food_practice/experiment.js | 2 +- cue_control_food_pre_rating/experiment.js | 4 ++-- cue_control_smoking/experiment.js | 2 +- cue_control_smoking_practice/experiment.js | 2 +- cue_control_smoking_pre_rating/experiment.js | 4 ++-- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/circle.yml b/circle.yml index e208b7c9c..7e7242c04 100644 --- a/circle.yml +++ b/circle.yml @@ -27,6 +27,12 @@ test: - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('cognitive_reflection','web','.');" - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('columbia_card_task_cold','web','.');" - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('columbia_card_task_hot','web','.');" + - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('cue_control_food','web','.');" + - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('cue_control_food_practice','web','.');" + - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('cue_control_food_pre_rating','web','.');" + - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('cue_control_smoking','web','.');" + - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('cue_control_smoking_practice','web','.');" + - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('cue_control_smoking_pre_rating','web','.');" - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('demographics','web','.');" - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('dot_pattern_expectancy','web','.');" - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('dickman','web','.');" diff --git a/cue_control_food/experiment.js b/cue_control_food/experiment.js index 97e7bda00..6fdc0a709 100644 --- a/cue_control_food/experiment.js +++ b/cue_control_food/experiment.js @@ -243,7 +243,7 @@ var appendData = function(){ curr_trial = jsPsych.progress().current_trial_global trial_id = jsPsych.data.getDataByTrialIndex(curr_trial).trial_id - if(response_tracker.length == 0){ + if(response_tracker.length === 0){ subject_response = "" } diff --git a/cue_control_food_practice/experiment.js b/cue_control_food_practice/experiment.js index 258959f8b..ea1e51fe5 100644 --- a/cue_control_food_practice/experiment.js +++ b/cue_control_food_practice/experiment.js @@ -241,7 +241,7 @@ var appendData = function(){ curr_trial = jsPsych.progress().current_trial_global trial_id = jsPsych.data.getDataByTrialIndex(curr_trial).trial_id - if(response_tracker.length == 0){ + if(response_tracker.length === 0){ subject_response = "" } diff --git a/cue_control_food_pre_rating/experiment.js b/cue_control_food_pre_rating/experiment.js index bca80694b..687c94390 100644 --- a/cue_control_food_pre_rating/experiment.js +++ b/cue_control_food_pre_rating/experiment.js @@ -35,7 +35,7 @@ var createStims = function(numStims,numIterations,numZeroes){ stimArray.push(stim2) } - var stimArray = jsPsych.randomization.repeat(stimArray, numIterations, true) + stimArray = jsPsych.randomization.repeat(stimArray, numIterations, true) return stimArray } @@ -68,7 +68,7 @@ var appendData = function(){ //curr_trial = jsPsych.progress().current_trial_global //trial_id = jsPsych.data.getDataByTrialIndex(curr_trial).trial_id - if(response_tracker.length == 0){ + if(response_tracker.length === 0){ stim_rating = "" } diff --git a/cue_control_smoking/experiment.js b/cue_control_smoking/experiment.js index dc05c4716..2082167ba 100644 --- a/cue_control_smoking/experiment.js +++ b/cue_control_smoking/experiment.js @@ -241,7 +241,7 @@ var appendData = function(){ curr_trial = jsPsych.progress().current_trial_global trial_id = jsPsych.data.getDataByTrialIndex(curr_trial).trial_id - if(response_tracker.length == 0){ + if(response_tracker.length === 0){ subject_response = "" } diff --git a/cue_control_smoking_practice/experiment.js b/cue_control_smoking_practice/experiment.js index a36b2afc2..20f260cf8 100644 --- a/cue_control_smoking_practice/experiment.js +++ b/cue_control_smoking_practice/experiment.js @@ -240,7 +240,7 @@ var appendData = function(){ curr_trial = jsPsych.progress().current_trial_global trial_id = jsPsych.data.getDataByTrialIndex(curr_trial).trial_id - if(response_tracker.length == 0){ + if(response_tracker.length === 0){ subject_response = "" } diff --git a/cue_control_smoking_pre_rating/experiment.js b/cue_control_smoking_pre_rating/experiment.js index 3db0ee0bc..6930baa8f 100644 --- a/cue_control_smoking_pre_rating/experiment.js +++ b/cue_control_smoking_pre_rating/experiment.js @@ -35,7 +35,7 @@ var createStims = function(numStims,numIterations,numZeroes){ stimArray.push(stim2) } - var stimArray = jsPsych.randomization.repeat(stimArray, numIterations, true) + stimArray = jsPsych.randomization.repeat(stimArray, numIterations, true) return stimArray } @@ -68,7 +68,7 @@ var appendData = function(){ //curr_trial = jsPsych.progress().current_trial_global //trial_id = jsPsych.data.getDataByTrialIndex(curr_trial).trial_id - if(response_tracker.length == 0){ + if(response_tracker.length === 0){ stim_rating = "" } From 32079a5b057f0776284412702ffb2a24aa80364b Mon Sep 17 00:00:00 2001 From: Jamie Li Date: Mon, 15 Oct 2018 11:55:22 -0700 Subject: [PATCH 2/8] discount_fixed --- discount_fixed/config.json | 39 ++++++++ discount_fixed/experiment.js | 183 +++++++++++++++++++++++++++++++++++ discount_fixed/style.css | 36 +++++++ 3 files changed, 258 insertions(+) create mode 100755 discount_fixed/config.json create mode 100755 discount_fixed/experiment.js create mode 100755 discount_fixed/style.css diff --git a/discount_fixed/config.json b/discount_fixed/config.json new file mode 100755 index 000000000..71d9bb8c4 --- /dev/null +++ b/discount_fixed/config.json @@ -0,0 +1,39 @@ +[ + { + "name": "Discount Fixed", + "template":"jspsych", + "run": [ + "static/js/math.min.js", + "static/js/jspsych/jspsych.js", + "static/js/jspsych/plugins/jspsych-text.js", + "static/js/jspsych/poldrack_plugins/jspsych-poldrack-text.js", + "static/js/jspsych/poldrack_plugins/jspsych-poldrack-instructions.js", + "static/js/jspsych/poldrack_plugins/jspsych-attention-check.js", + "static/js/jspsych/poldrack_plugins/jspsych-poldrack-single-stim.js", + "static/js/jspsych/plugins/jspsych-survey-text.js", + "static/js/utils/poldrack_utils.js", + "static/js/utils/poldrack_fmri_utils.js", + "experiment.js", + "static/css/jspsych.css", + "static/css/default_style.css", + "style.css" + ], + "exp_id": "discount_fixed", + "cognitive_atlas_task_id": "tsk_4a57abb949e98", + "contributors": [ + "Zeynep Enkavi", + "Ian Eisenberg", + "Patrick Bissett", + "Vanessa Sochat", + "Russell Poldrack" + ], + "time":15, + "reference": "http://link.springer.com/article/10.3758/BF03210748", + "publish":"True", + "deployment_variables":{"jspsych_init": + {"fullscreen": true, + "display_element": "getDisplayElement", + "on_trial_finish": "addID('discount_fixed')"} + } + } +] diff --git a/discount_fixed/experiment.js b/discount_fixed/experiment.js new file mode 100755 index 000000000..df05ad600 --- /dev/null +++ b/discount_fixed/experiment.js @@ -0,0 +1,183 @@ +/* ************************************ */ +/* Define helper functions */ +/* ************************************ */ + +ITIs = [0.816,0.068,0.136,0.408,0.0,0.476,0.408,0.068,0.0,1.7,0.204,0.544,0.544,0.68,0.476,0.272,0.272,0.68,0.68,0.748,0.068,0.0,0.408,0.068,1.7,0.408,0.748,0.544,0.136,0.204,0.136,0.068,0.068,0.408,0.34,0.748,0.272,1.496,1.088,0.068,0.612,1.156,0.068,0.272,0.544,0.34,0.68,0.544,0.476,0.476,0.816,0.0,0.544,0.204,0.34,2.244,0.0,0.068,0.204,0.408,0.068,0.272,0.136,0.068,0.952,0.884,0.068,1.768,1.02,0.068,0.136,0.136,0.612,0.816,0.068,0.068,0.068,0.34,0.0,1.156,0.408,0.136,0.0,0.0,0.612,1.632,0.34,0.068,0.204,1.36,0.136,0.816,0.476,0.068,1.02,1.088,1.292,0.068,0.612,0.0,0.34,0.068,0.884,0.544,0.204,0.408,0.408,0.34,0.612,0.612,0.204,0.34,0.34,2.38,0.068,0.272,2.516,0.204,0.68,0.544] + +var get_ITI = function() { + return 4500 + ITIs.shift()*1000 // 500 minimum ITI + } + + var randomDraw = function(lst) { + var index = Math.floor(Math.random() * (lst.length)) + return lst[index] +} + +/* ************************************ */ +/* Define experimental variables */ +/* ************************************ */ + +// task specific variables +var choices = [89, 71] +var bonus_list = [] //keeps track of choices for bonus +//hard coded options +var options = { + small_amt: [20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20], + large_amt: [77,50,43,71,75,36,36,50,73,33,69,63,39,66,23,41,45,39,44,80,30,23,24,40,25,57,49,78,67,25,27,44,54,28,45,71,32,31,43,78,67,79,66,22,54,77,24,80,77,23,55,28,83,29,58,32,33,23,55,22,27,58,28,65,25,74,74,56,41,65,62,71,23,48,64,81,58,60,66,25,35,29,32,45,30,27,76,23,67,56,58,72,34,28,43,41,34,65,82,52,39,24,61,31,54,24,67,45,29,50,41,33,70,42,25,85,58,24,75,49], + later_del: [161, 59, 38,176, 60,114,140, 41, 44, 78,172, 37, 95, 58, 61,129,157,161,143,145, 36,134, 87,159,141, 89,140,108, 74,108, 91, 92, 23, 59,107, 88,111, 76,120,129, 41, 92,145, 21, 22,142,139, 39, 24,110,163,132,105, 44, 72, 57,103, 42,107, 27,142, 36,163,156,176, 52,121,172, 55,137,180, 76,176,128, 89, 58, 55,124, 71, 70,171, 75, 74, 72, 23,130,161, 77,103, 93, 53, 95,176,123, 19,174, 43,159, 74,139,104, 38,141, 74,126,125, 23, 26, 58,129, 27,163,108,145, 74,129, 73, 89, 41,172] +} + +var stim_html = [] + +var stim_index = [37,94,77,60,79,31,110,74,27,19,95,113,5,76,75,36,24,106,0,50,23,86,73,12,52,40,67,93,109,14,41,102,2,42,84,55,30,38,4,92,101,98,90,32,68,45,29,111,81,16,103,47,43,99,104,72,22,6,80,96,66,34,48,17,70,46,54,89,107,57,7,64,44,53,117,87,85,21,58,18,49,63,59,1,115,13,119,8,116,71,28,108,100,56,9,65,51,33,62,82,25,112,91,20,15,39,35,97,105,61,11,118,83,114,69,26,88,10,78,3] +//loop through each option to create html +for (var i = 0; i < stim_index.length; i++) { + var index = stim_index[i] + stim_html[i] = + '
$'+options.large_amt[index]+'


'+ + '
'+ options.later_del[index]+' days
' +} + +data_prop = [] + +for (var i = 0; i < stim_index.length; i++) { + var index = stim_index[i] + data_prop.push({ + small_amount: options.small_amt[index], + large_amount: options.large_amt[index], + later_delay: options.later_del[index] + }); +} + +trials = [] + +//used new features to include the stimulus properties in recorded data +for (var i = 0; i < stim_html.length; i++) { + trials.push({ + stimulus: stim_html[i], + data: data_prop[i] + }); +} + +/* ************************************ */ +/* Set up jsPsych blocks */ +/* ************************************ */ + +var instructions_block = { + type: 'poldrack-single-stim', + stimulus: '
Choose between hypothetical options, $20 today or the presented option.

Index: Accept option on screen (reject $20 today).

Middle: Reject option on screen (accept $20 today)

We will start with a practice trial.
', + is_html: true, + timing_stim: -1, + timing_response: -1, + response_ends_trial: true, + choices: [32], + data: { + trial_id: "instructions", + }, + timing_post_trial: 500 +}; + +var practice_block = { + type: 'poldrack-single-stim', + data: { + trial_id: "stim", + exp_stage: "practice" + }, + stimulus: '
$53.75


34 days
', + is_html: true, + choices: choices, + response_ends_trial: true, +}; + +var start_test_block = { + type: 'poldrack-single-stim', + stimulus: '
Get ready!

Stay as still as possible. Do not swallow.
', + is_html: true, + choices: 'none', + timing_stim: 1500, + timing_response: 1500, + data: { + trial_id: "test_start_block" + }, + timing_post_trial: 500, + on_finish: function() { + current_trial = 0 + exp_stage = 'test' + } +}; + +var end_block = { + type: 'poldrack-single-stim', + stimulus: '
Fin
', + is_html: true, + choices: [32], + timing_response: -1, + response_ends_trial: true, + data: { + trial_id: "end", + exp_id: 'discount_fixed' + }, + timing_post_trial: 0, + on_finish: function() { + var bonus = randomDraw(bonus_list) + jsPsych.data.addDataToLastTrial({'bonus': bonus}) + } +}; + +var rest_block = { + type: 'poldrack-single-stim', + stimulus: '
In this next block of trials
Index: Accept option on screen (reject $20 today).
Middle: Reject option on screen (accept $20 today)
Next run will start in a moment
', + is_html: true, + choices: 'none', + timing_response: 7500, + data: { + trial_id: "rest_block" + }, + timing_post_trial: 1000 +}; + +//Set up experiment +var discount_fixed_experiment = [] +test_keys(discount_fixed_experiment,choices) +discount_fixed_experiment.push(instructions_block); +discount_fixed_experiment.push(practice_block); +setup_fmri_intro(discount_fixed_experiment) +discount_fixed_experiment.push(start_test_block); + + +for (i = 0; i < stim_index.length; i++) { + var test_block = { + type: 'poldrack-single-stim', + data: { + trial_id: "stim", + exp_stage: "test" + }, + stimulus:trials[i].stimulus, + timing_stim: 4000, + timing_response: get_ITI, + data: trials[i].data, + is_html: true, + choices: choices, + response_ends_trial: false, + timing_post_trial: 0, + on_finish: function(data) { + var choice = false; + if (data.key_press == 89) { + choice = 'larger_later'; + bonus_list.push({'amount': data.large_amount, 'delay': data.later_delay}) + } else if (data.key_press == 71) { + choice = 'smaller_sooner'; + bonus_list.push({'amount': data.small_amount, 'delay': 0}) + } + jsPsych.data.addDataToLastTrial({ + choice: choice + }); + } +}; + + discount_fixed_experiment.push(test_block) + if ((i%60 == 0) && (i > 0)) { + discount_fixed_experiment.push(rest_block) + } +} +discount_fixed_experiment.push(end_block); \ No newline at end of file diff --git a/discount_fixed/style.css b/discount_fixed/style.css new file mode 100755 index 000000000..066e694cb --- /dev/null +++ b/discount_fixed/style.css @@ -0,0 +1,36 @@ +.dd-stim { + text-align: center; + font-size: 80px; + position: absolute; + transform: translate(-50%, -50%); + background: black; + width: 50vw; + height: 60vh; + top: 50%; + left: 50%; +} + +.amtbox { + position: absolute; + top: 35%; + width:100%; + z-index: 2 +} + +.delbox { + position: absolute; + top: 60%; + width:100%; + z-index: 3 +} + +.black-centerbox { + width: 50vw; + height: 60vh; + position:absolute; + top:50%; + left:50%; + margin-right:-50%; + transform: translate(-50%,-50%); + background: black; +} \ No newline at end of file From e1f5f3d69f61ecc3fd2f052d4156c1e85e986789 Mon Sep 17 00:00:00 2001 From: Jamie Li Date: Mon, 15 Oct 2018 11:58:39 -0700 Subject: [PATCH 3/8] discount to circle.yml file --- circle.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/circle.yml b/circle.yml index 7e7242c04..acc1c368e 100644 --- a/circle.yml +++ b/circle.yml @@ -39,6 +39,7 @@ test: - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('dietary_decision','web','.');" - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('digit_span','web','.');" - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('dimensional_set_shifting','web','.');" + - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('discount_fixed','web','.');" - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('directed_forgetting','web','.');" - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('discount_titrate','web','.');" - $HOME/miniconda2/bin/python -c "from expfactory.tests import circle_ci_test; circle_ci_test('dospert_eb','web','.');" From 650dda6a61994862bec724927aa9191113e00a5c Mon Sep 17 00:00:00 2001 From: Jamie Li Date: Mon, 15 Oct 2018 16:32:57 -0700 Subject: [PATCH 4/8] discount fix local version --- discount_fixed/experiment.js | 19 ++++++++++--------- discount_fixed/style.css | 13 ++++++++++++- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/discount_fixed/experiment.js b/discount_fixed/experiment.js index df05ad600..ce8258ca5 100755 --- a/discount_fixed/experiment.js +++ b/discount_fixed/experiment.js @@ -19,6 +19,7 @@ var get_ITI = function() { // task specific variables var choices = [89, 71] +var choices = [['N key',78],['M key', 77]] var bonus_list = [] //keeps track of choices for bonus //hard coded options var options = { @@ -65,7 +66,7 @@ for (var i = 0; i < stim_html.length; i++) { var instructions_block = { type: 'poldrack-single-stim', - stimulus: '
Choose between hypothetical options, $20 today or the presented option.

Index: Accept option on screen (reject $20 today).

Middle: Reject option on screen (accept $20 today)

We will start with a practice trial.
', + stimulus: '
Choose between hypothetical options, $20 today or the presented option.

'+choices[0][0]+': Accept option on screen (reject $20 today).

'+choices[1][0]+': Reject option on screen (accept $20 today)

We will start with a practice trial.
', is_html: true, timing_stim: -1, timing_response: -1, @@ -85,13 +86,13 @@ var practice_block = { }, stimulus: '
$53.75


34 days
', is_html: true, - choices: choices, + choices: [choices[0][1], choices[1][1]], response_ends_trial: true, }; var start_test_block = { type: 'poldrack-single-stim', - stimulus: '
Get ready!

Stay as still as possible. Do not swallow.
', + stimulus: '
Starting test block. Get Ready!
', is_html: true, choices: 'none', timing_stim: 1500, @@ -126,7 +127,7 @@ var end_block = { var rest_block = { type: 'poldrack-single-stim', - stimulus: '
In this next block of trials
Index: Accept option on screen (reject $20 today).
Middle: Reject option on screen (accept $20 today)
Next run will start in a moment
', + stimulus: '
In this next block of trials
'+choices[0][0]+': Accept option on screen (reject $20 today).
'+choices[1][0]+': Reject option on screen (accept $20 today)
Next run will start in a moment
', is_html: true, choices: 'none', timing_response: 7500, @@ -138,10 +139,10 @@ var rest_block = { //Set up experiment var discount_fixed_experiment = [] -test_keys(discount_fixed_experiment,choices) +//test_keys(discount_fixed_experiment,choices) discount_fixed_experiment.push(instructions_block); discount_fixed_experiment.push(practice_block); -setup_fmri_intro(discount_fixed_experiment) +//setup_fmri_intro(discount_fixed_experiment) discount_fixed_experiment.push(start_test_block); @@ -157,15 +158,15 @@ for (i = 0; i < stim_index.length; i++) { timing_response: get_ITI, data: trials[i].data, is_html: true, - choices: choices, + choices: [choices[0][1], choices[1][1]], response_ends_trial: false, timing_post_trial: 0, on_finish: function(data) { var choice = false; - if (data.key_press == 89) { + if (data.key_press == choices[0][1]) { choice = 'larger_later'; bonus_list.push({'amount': data.large_amount, 'delay': data.later_delay}) - } else if (data.key_press == 71) { + } else if (data.key_press == choices[1][1]) { choice = 'smaller_sooner'; bonus_list.push({'amount': data.small_amount, 'delay': 0}) } diff --git a/discount_fixed/style.css b/discount_fixed/style.css index 066e694cb..2adb567b4 100755 --- a/discount_fixed/style.css +++ b/discount_fixed/style.css @@ -33,4 +33,15 @@ margin-right:-50%; transform: translate(-50%,-50%); background: black; -} \ No newline at end of file +} + +.bigbox { + width: 100vw; + height: 100vh; + position:absolute; + top:50%; + left:50%; + margin-right:-50%; + transform: translate(-50%,-50%); + background: black; +} \ No newline at end of file From 123ae5900b30b6db5da96a376b513e06d7ecb557 Mon Sep 17 00:00:00 2001 From: Jamie Li Date: Mon, 15 Oct 2018 16:40:08 -0700 Subject: [PATCH 5/8] finished discount fix mri to local --- discount_fixed/experiment.js | 10 +++++----- discount_fixed/style.css | 27 ++++++++++++++++----------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/discount_fixed/experiment.js b/discount_fixed/experiment.js index ce8258ca5..c6c30ec18 100755 --- a/discount_fixed/experiment.js +++ b/discount_fixed/experiment.js @@ -66,12 +66,12 @@ for (var i = 0; i < stim_html.length; i++) { var instructions_block = { type: 'poldrack-single-stim', - stimulus: '
Choose between hypothetical options, $20 today or the presented option.

'+choices[0][0]+': Accept option on screen (reject $20 today).

'+choices[1][0]+': Reject option on screen (accept $20 today)

We will start with a practice trial.
', + stimulus: '

Choose between hypothetical options, $20 today or the presented option.

'+choices[0][0]+': Accept option on screen (reject $20 today).

'+choices[1][0]+': Reject option on screen (accept $20 today)

We will start with a practice trial. Press Enter to continue.

', is_html: true, timing_stim: -1, timing_response: -1, response_ends_trial: true, - choices: [32], + choices: [13], data: { trial_id: "instructions", }, @@ -92,7 +92,7 @@ var practice_block = { var start_test_block = { type: 'poldrack-single-stim', - stimulus: '
Starting test block. Get Ready!
', + stimulus: '

Starting test block. Get Ready!

', is_html: true, choices: 'none', timing_stim: 1500, @@ -109,7 +109,7 @@ var start_test_block = { var end_block = { type: 'poldrack-single-stim', - stimulus: '
Fin
', + stimulus: '

Fin.

', is_html: true, choices: [32], timing_response: -1, @@ -127,7 +127,7 @@ var end_block = { var rest_block = { type: 'poldrack-single-stim', - stimulus: '
In this next block of trials
'+choices[0][0]+': Accept option on screen (reject $20 today).
'+choices[1][0]+': Reject option on screen (accept $20 today)
Next run will start in a moment
', + stimulus: '

In this next block of trials
'+choices[0][0]+': Accept option on screen (reject $20 today).
'+choices[1][0]+': Reject option on screen (accept $20 today)
Next run will start in a moment

', is_html: true, choices: 'none', timing_response: 7500, diff --git a/discount_fixed/style.css b/discount_fixed/style.css index 2adb567b4..b0ced0dba 100755 --- a/discount_fixed/style.css +++ b/discount_fixed/style.css @@ -1,3 +1,19 @@ +.display_stage { + position: fixed; + background: black; + left: 5vw; + top: 2vh; + height: 94vh; + width: 90vw; + border-radius: 15px; + border: 1vh solid #D0D0D0; + z-index: 0; +} + +.display_stage > div, .display_stage > p { + color: white; +} + .dd-stim { text-align: center; font-size: 80px; @@ -34,14 +50,3 @@ transform: translate(-50%,-50%); background: black; } - -.bigbox { - width: 100vw; - height: 100vh; - position:absolute; - top:50%; - left:50%; - margin-right:-50%; - transform: translate(-50%,-50%); - background: black; -} \ No newline at end of file From d19f577d10f5a324c0e12b0008dc464dcc4b7502 Mon Sep 17 00:00:00 2001 From: Jamie Li Date: Mon, 15 Oct 2018 17:10:52 -0700 Subject: [PATCH 6/8] cue control smoking -> local --- cue_control_smoking/experiment.js | 40 ++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/cue_control_smoking/experiment.js b/cue_control_smoking/experiment.js index 2082167ba..210fe4e83 100644 --- a/cue_control_smoking/experiment.js +++ b/cue_control_smoking/experiment.js @@ -281,7 +281,9 @@ var subject_ID = 472 var numStimsPerCategory = 36 var totalStims = (numStimsPerCategory/2) * 5 // 5 total conditions -var possible_responses = [['Thumb', 66],['Index Finger',89],['Middle Finger',71],['Ring Finger',82],['Pinky',77]] +//var possible_responses = [['Thumb', 66],['Index Finger',89],['Middle Finger',71],['Ring Finger',82],['Pinky',77]] +//above are the responses for mri, below are the ones for local computer +var possible_responses = [['1', 49],['2',50],['3',51],['4',52],['5',53]] @@ -368,8 +370,8 @@ var end_block = { }, timing_response: -1, text: '
'+ - '

Thanks for completing!

'+ - '

Press enter to continue.

'+ + '

Thanks for completing!

'+ + '

Press enter to continue.

'+ '
', cont_key: [13], timing_post_trial: 0 @@ -382,8 +384,8 @@ var welcome_block = { }, timing_response: -1, text: '
'+ - '

Welcome to the task!

'+ - '

Press enter to continue.

'+ + '

Welcome to the task!

'+ + '

Press enter to continue.

'+ '
', cont_key: [13], timing_post_trial: 0 @@ -487,6 +489,21 @@ var scanner_rest_block = { response_ends_trial: true }; +var start_test_block = { + type: 'poldrack-single-stim', + stimulus: '
'+ + '

Starting a test block. Press enter to continue.

'+ + '
', + is_html: true, + choices: [13], + data: { + trial_id: "scanner_wait" + }, + timing_post_trial: 0, + timing_stim: -1, + timing_response: -1, + response_ends_trial: true +}; /* ************************************ */ /* Set up timeline blocks */ @@ -524,6 +541,7 @@ var check_finger_node = { var training_trials = [] +training_trials.push(start_test_block) for(var i = 0; i < numStimsPerBlock; i++){ //numStims before, should be # of trials per block (40??) var cue_block = { @@ -577,7 +595,7 @@ for(var i = 0; i < numStimsPerBlock; i++){ //numStims before, should be # of tri training_trials.push(probe_block) training_trials.push(rating_block) } -training_trials.push(scanner_rest_block) +//training_trials.push(scanner_rest_block) @@ -607,17 +625,17 @@ var cue_control_smoking_experiment = [] cue_control_smoking_experiment.push(welcome_block); -cue_control_smoking_experiment.push(check_finger_node); +//cue_control_smoking_experiment.push(check_finger_node); cue_control_smoking_experiment.push(instructions_block); -cue_control_smoking_experiment.push(experimentor_wait_block); +//cue_control_smoking_experiment.push(experimentor_wait_block); -cue_control_smoking_experiment.push(scanner_wait_block_first); +//cue_control_smoking_experiment.push(scanner_wait_block_first); -cue_control_smoking_experiment.push(scanner_wait_block_second); +//cue_control_smoking_experiment.push(scanner_wait_block_second); -cue_control_smoking_experiment.push(scanner_wait_block_third); +//cue_control_smoking_experiment.push(scanner_wait_block_third); cue_control_smoking_experiment.push(training_node); From 068c78fc4b08a7a0e012773f75940e9751873f5f Mon Sep 17 00:00:00 2001 From: Jamie Li Date: Mon, 15 Oct 2018 17:23:42 -0700 Subject: [PATCH 7/8] cue controls, fmri to local --- cue_control_food/experiment.js | 239 ++++-------------------------- cue_control_smoking/experiment.js | 234 ++--------------------------- 2 files changed, 41 insertions(+), 432 deletions(-) diff --git a/cue_control_food/experiment.js b/cue_control_food/experiment.js index 6fdc0a709..873a2b06d 100644 --- a/cue_control_food/experiment.js +++ b/cue_control_food/experiment.js @@ -1,8 +1,6 @@ /* ************************************ */ /* Define Helper Functions */ /* ************************************ */ - - function getDisplayElement() { $('
').appendTo('body') return $('
').appendTo('body') @@ -32,15 +30,12 @@ var createStims = function(numStims,numIterations,numZeroes){ var stimArray = jsPsych.randomization.repeat(numberArray,numIterations) return stimArray } - function createAllStims(numStimsPerCategory, numIterations, numZeroes, nullType){ var neutral_stim_array = jsPsych.randomization.repeat(neutral_pics,1) var valued_stim_array = jsPsych.randomization.repeat(valued_pics,1) - - var stims = [] for(var i = 0; i < numStimsPerCategory/2; i++){ @@ -87,24 +82,6 @@ function createAllStims(numStimsPerCategory, numIterations, numZeroes, nullType) stims = jsPsych.randomization.repeat(stims,1,true) return stims } - - -function getRestText(){ - if(currBlock == numBlocks - 1){ - return '
'+ - '

This phase is over.

'+ - '
' - - }else if(currBlock < numBlocks - 1){ - return '
'+ - '

Take a break!

'+ - '

Task will start in 10 seconds.

'+ - '
' - } - -} - - function getCue(){ @@ -112,54 +89,33 @@ function getCue(){ stim_type = stims.stim_type.pop() current_stim = stims.stim.pop() - if (whichCue == "null"){ - return '
' - } else { - return '
'+whichCue+'
' - } - } - function getProbe(){ - - if(stim_type == experiment_stim_type){ - return probeBoard1 + valued_stim_directory + current_stim + "'>" + probeBoard2 }else if(stim_type == "neutral"){ - return probeBoard1 + neutral_directory + current_stim + "'>" + probeBoard2 }else if (stim_type == "null"){ return '
' - } - - + } } - function getRatingBoard(){ - - - if(stim_type == experiment_stim_type){ - - return ratingBoard1 + valued_stim_directory + current_stim + "'>" + ratingBoard2 - } else if(stim_type == "neutral"){ - - return ratingBoard1 + neutral_directory + current_stim + "'>" + ratingBoard2 - } else if (stim_type == "null"){ - - return '
' - } - - + if(stim_type == experiment_stim_type){ + return ratingBoard1 + valued_stim_directory + current_stim + "'>" + ratingBoard2 + } else if(stim_type == "neutral"){ + return ratingBoard1 + neutral_directory + current_stim + "'>" + ratingBoard2 + } else if (stim_type == "null"){ + return '
' + } } var hitKey = function(whichKey){ @@ -173,8 +129,6 @@ var hitKey = function(whichKey){ $(document).trigger(e) } - - document.addEventListener("keydown", function(e){ var keynum; @@ -189,17 +143,12 @@ document.addEventListener("keydown", function(e){ (keynum == possible_responses[2][1]) || (keynum == possible_responses[3][1]) || (keynum == possible_responses[4][1])){ - - if (exp_target_phase == 1){ - response_tracker.push(keynum) - } } - if ((keynum == possible_responses[0][1]) && (response_tracker.length == 1)){ $('#btn1').removeClass('unselected'); $('#btn1').addClass('selected'); @@ -231,13 +180,8 @@ document.addEventListener("keydown", function(e){ hitKey(keynum) } - - - }); - - var appendData = function(){ curr_trial = jsPsych.progress().current_trial_global @@ -260,28 +204,16 @@ var appendData = function(){ response_tracker = [] exp_target_phase = 0 } - -var check_finger_counter = 0 -function getCheckFingerStim(){ - return '
'+ - '

Press your ' + possible_responses[check_finger_counter][0] + '

'+ - '
' - - -} - -function getChoice(){ - return [possible_responses[check_finger_counter][1]] -} - - /* ************************************ */ /* Define Experimental Variables */ /* ************************************ */ var subject_ID = 472 var numStimsPerCategory = 36 var totalStims = (numStimsPerCategory/2) * 5 // 5 total conditions -var possible_responses = [['Thumb', 66],['Index Finger',89],['Middle Finger',71],['Ring Finger',82],['Pinky',77]] + +//var possible_responses = [['Thumb', 66],['Index Finger',89],['Middle Finger',71],['Ring Finger',82],['Pinky',77]] +//above are the responses for mri, below are the ones for local computer +var possible_responses = [['1', 49],['2',50],['3',51],['4',52],['5',53]] @@ -372,8 +304,8 @@ var end_block = { }, timing_response: -1, text: '
'+ - '

Thanks for completing!

'+ - '

Press enter to continue.

'+ + '

Thanks for completing!

'+ + '

Press enter to continue.

'+ '
', cont_key: [13], timing_post_trial: 0 @@ -386,75 +318,14 @@ var welcome_block = { }, timing_response: -1, text: '
'+ - '

Welcome to the task!

'+ - '

Press enter to continue.

'+ + '

Welcome to the task!

'+ + '

Press enter to continue.

'+ '
', cont_key: [13], timing_post_trial: 0 }; -var experimentor_wait_block = { - type: 'poldrack-text', - data: { - trial_id: "experimentor_wait" - }, - timing_response: -1, - text: '
'+ - '

Scanner Setup

'+ - '
', - cont_key: [32], - timing_post_trial: 0 -}; - -var scanner_wait_block_first = { - type: 'poldrack-single-stim', - stimulus: '
'+ - '

Task about to start!

'+ - '
', - is_html: true, - choices: [84], - data: { - trial_id: "scanner_wait" - }, - timing_post_trial: 0, - timing_stim: -1, - timing_response: -1, - response_ends_trial: true -}; - - -var scanner_wait_block_second = { - type: 'poldrack-single-stim', - stimulus: '
'+ - '

Task about to start!

'+ - '
', - is_html: true, - choices: 'none', - data: { - trial_id: "scanner_wait" - }, - timing_post_trial: 0, - timing_stim: 8160, - timing_response: 8160, - response_ends_trial: false -}; - -var scanner_wait_block_third = { - type: 'poldrack-single-stim', - stimulus: '
'+ - '

Get Ready!

'+ - '
', - is_html: true, - choices: 'none', - data: { - trial_id: "scanner_wait" - }, - timing_post_trial: 0, - timing_stim: 2720, - timing_response: 2720, - response_ends_trial: false -}; var instructions_block = { type: 'poldrack-text', @@ -474,58 +345,26 @@ var instructions_block = { timing_post_trial: 0 }; - -var scanner_rest_block = { +var start_test_block = { type: 'poldrack-single-stim', - stimulus: getRestText, + stimulus: '
'+ + '

Starting a test block. Press enter to continue.

'+ + '
', is_html: true, choices: [13], data: { - trial_id: "scanner_rest" + trial_id: "scanner_wait" }, timing_post_trial: 0, - timing_stim: 10000, - timing_response: 10000, + timing_stim: -1, + timing_response: -1, response_ends_trial: true }; - - /* ************************************ */ /* Set up timeline blocks */ /* ************************************ */ - -var check_finger_trials = [] -for(var i = 0; i < possible_responses.length; i++){ - var check_finger_block = { - type: 'poldrack-single-stim', - stimulus: getCheckFingerStim, - is_html: true, - choices: getChoice, //'none' - data: { - trial_id: "cue" - }, - timing_post_trial: 0, - timing_stim: -1, - timing_response: -1, - response_ends_trial: true, - on_finish: function(){ - check_finger_counter += 1 - } - }; - - check_finger_trials.push(check_finger_block) -} - -var check_finger_node = { - timeline: check_finger_trials, - loop_function: function(data){ - return false - - } -} - - var training_trials = [] +training_trials.push(start_test_block) for(var i = 0; i < numStimsPerBlock; i++){ //numStims before, should be # of trials per block (40??) var cue_block = { @@ -579,28 +418,18 @@ for(var i = 0; i < numStimsPerBlock; i++){ //numStims before, should be # of tri training_trials.push(probe_block) training_trials.push(rating_block) } -training_trials.push(scanner_rest_block) - - var training_node = { timeline: training_trials, loop_function: function(data){ currBlock += 1 - - if(currBlock == numBlocks){ - - + if(currBlock == numBlocks){ return false - }else if (currBlock < numBlocks){ - - + }else if (currBlock < numBlocks){ return true } - } } - /* ************************************ */ /* Set up Experiment */ /* ************************************ */ @@ -609,22 +438,8 @@ var cue_control_food_experiment = [] cue_control_food_experiment.push(welcome_block); -cue_control_food_experiment.push(check_finger_node); - cue_control_food_experiment.push(instructions_block); -cue_control_food_experiment.push(experimentor_wait_block); - -cue_control_food_experiment.push(scanner_wait_block_first); - -cue_control_food_experiment.push(scanner_wait_block_second); - -cue_control_food_experiment.push(scanner_wait_block_third); - cue_control_food_experiment.push(training_node); -cue_control_food_experiment.push(end_block); - - - - +cue_control_food_experiment.push(end_block); \ No newline at end of file diff --git a/cue_control_smoking/experiment.js b/cue_control_smoking/experiment.js index 210fe4e83..700ed8a76 100644 --- a/cue_control_smoking/experiment.js +++ b/cue_control_smoking/experiment.js @@ -12,7 +12,6 @@ function addID() { jsPsych.data.addDataToLastTrial({exp_id: 'cue_control_smoking', subject_ID: subject_ID}) } - var createStims = function(numStims,numIterations,numZeroes){ var lowEnd = 1 var numberArray = [] @@ -33,14 +32,12 @@ var createStims = function(numStims,numIterations,numZeroes){ return stimArray } - - + function createAllStims(numStimsPerCategory, numIterations, numZeroes, nullType){ var neutral_stim_array = jsPsych.randomization.repeat(neutral_pics,1) var valued_stim_array = jsPsych.randomization.repeat(valued_pics,1) - var stims = [] for(var i = 0; i < numStimsPerCategory/2; i++){ valued_now = { @@ -86,23 +83,6 @@ function createAllStims(numStimsPerCategory, numIterations, numZeroes, nullType) stims = jsPsych.randomization.repeat(stims,1,true) return stims } - - -function getRestText(){ - if(currBlock == numBlocks - 1){ - return '
'+ - '

This phase is over.

'+ - '
' - - }else if(currBlock < numBlocks - 1){ - return '
'+ - '

Take a break!

'+ - '

Task will start in 10 seconds.

'+ - '
' - } - -} - function getCue(){ @@ -110,53 +90,33 @@ function getCue(){ stim_type = stims.stim_type.pop() current_stim = stims.stim.pop() - if (whichCue == "null"){ - return '
' - } else { - return '
'+whichCue+'
' - } - } - function getProbe(){ - - if(stim_type == experiment_stim_type){ - return probeBoard1 + valued_stim_directory + current_stim + "'>" + probeBoard2 }else if(stim_type == "neutral"){ - return probeBoard1 + neutral_directory + current_stim + "'>" + probeBoard2 }else if (stim_type == "null"){ return '
' - } - - + } } - -function getRatingBoard(){ - - - if(stim_type == experiment_stim_type){ - - return ratingBoard1 + valued_stim_directory + current_stim + "'>" + ratingBoard2 - } else if(stim_type == "neutral"){ - - return ratingBoard1 + neutral_directory + current_stim + "'>" + ratingBoard2 - } else if (stim_type == "null"){ - - return '
' - } - +function getRatingBoard(){ + if(stim_type == experiment_stim_type){ + return ratingBoard1 + valued_stim_directory + current_stim + "'>" + ratingBoard2 + } else if(stim_type == "neutral"){ + return ratingBoard1 + neutral_directory + current_stim + "'>" + ratingBoard2 + } else if (stim_type == "null"){ + return '
' + } } @@ -172,7 +132,6 @@ var hitKey = function(whichKey){ } - document.addEventListener("keydown", function(e){ var keynum; @@ -187,17 +146,12 @@ document.addEventListener("keydown", function(e){ (keynum == possible_responses[2][1]) || (keynum == possible_responses[3][1]) || (keynum == possible_responses[4][1])){ - - if (exp_target_phase == 1){ - response_tracker.push(keynum) - } } - if ((keynum == possible_responses[0][1]) && (response_tracker.length == 1)){ $('#btn1').removeClass('unselected'); $('#btn1').addClass('selected'); @@ -228,14 +182,10 @@ document.addEventListener("keydown", function(e){ subject_response = keynum hitKey(keynum) - } - - - + } }); - var appendData = function(){ curr_trial = jsPsych.progress().current_trial_global @@ -253,27 +203,10 @@ var appendData = function(){ response: subject_response }) - } response_tracker = [] exp_target_phase = 0 } - - -var check_finger_counter = 0 -function getCheckFingerStim(){ - return '
'+ - '

Press your ' + possible_responses[check_finger_counter][0] + '

'+ - '
' - - -} - -function getChoice(){ - return [possible_responses[check_finger_counter][1]] -} - - /* ************************************ */ /* Define Experimental Variables */ /* ************************************ */ @@ -285,8 +218,6 @@ var totalStims = (numStimsPerCategory/2) * 5 // 5 total conditions //above are the responses for mri, below are the ones for local computer var possible_responses = [['1', 49],['2',50],['3',51],['4',52],['5',53]] - - var numIterations = 1 //number of a certain stim, in each of the one conditions var numBlocks = totalStims / 30 var numStimsPerBlock = totalStims / numBlocks @@ -294,8 +225,6 @@ var numStimsPerBlock = totalStims / numBlocks var submitPressMax = 5 var exp_target_phase = 0 - - var now_cue = 'NOW' var later_cue = 'LATER' var experiment_stim_type = 'smoking' @@ -303,10 +232,8 @@ var current_game_state = "start" var mainNullType = 1 var postRateNullType = 0 - var preFileType = "'+ "
"+preFileType @@ -391,70 +315,6 @@ var welcome_block = { timing_post_trial: 0 }; - -var experimentor_wait_block = { - type: 'poldrack-text', - data: { - trial_id: "experimentor_wait" - }, - timing_response: -1, - text: '
'+ - '

Scanner Setup

'+ - '
', - cont_key: [32], - timing_post_trial: 0 -}; - -var scanner_wait_block_first = { - type: 'poldrack-single-stim', - stimulus: '
'+ - '

Task about to start!

'+ - '
', - is_html: true, - choices: [84], - data: { - trial_id: "scanner_wait" - }, - timing_post_trial: 0, - timing_stim: -1, - timing_response: -1, - response_ends_trial: true -}; - - -var scanner_wait_block_second = { - type: 'poldrack-single-stim', - stimulus: '
'+ - '

Task about to start!

'+ - '
', - is_html: true, - choices: 'none', - data: { - trial_id: "scanner_wait" - }, - timing_post_trial: 0, - timing_stim: 8160, - timing_response: 8160, - response_ends_trial: false -}; - -var scanner_wait_block_third = { - type: 'poldrack-single-stim', - stimulus: '
'+ - '

Get Ready!

'+ - '
', - is_html: true, - choices: 'none', - data: { - trial_id: "scanner_wait" - }, - timing_post_trial: 0, - timing_stim: 2720, - timing_response: 2720, - response_ends_trial: false -}; - - var instructions_block = { type: 'poldrack-text', data: { @@ -474,21 +334,6 @@ var instructions_block = { timing_post_trial: 0 }; - -var scanner_rest_block = { - type: 'poldrack-single-stim', - stimulus: getRestText, - is_html: true, - choices: [13], - data: { - trial_id: "scanner_rest" - }, - timing_post_trial: 0, - timing_stim: 10000, - timing_response: 10000, - response_ends_trial: true -}; - var start_test_block = { type: 'poldrack-single-stim', stimulus: '
'+ @@ -508,38 +353,6 @@ var start_test_block = { /* ************************************ */ /* Set up timeline blocks */ /* ************************************ */ - -var check_finger_trials = [] -for(var i = 0; i < possible_responses.length; i++){ - var check_finger_block = { - type: 'poldrack-single-stim', - stimulus: getCheckFingerStim, - is_html: true, - choices: getChoice, //'none' - data: { - trial_id: "cue" - }, - timing_post_trial: 0, - timing_stim: -1, - timing_response: -1, - response_ends_trial: true, - on_finish: function(){ - check_finger_counter += 1 - } - }; - - check_finger_trials.push(check_finger_block) -} - -var check_finger_node = { - timeline: check_finger_trials, - loop_function: function(data){ - return false - - } -} - - var training_trials = [] training_trials.push(start_test_block) for(var i = 0; i < numStimsPerBlock; i++){ //numStims before, should be # of trials per block (40??) @@ -595,28 +408,20 @@ for(var i = 0; i < numStimsPerBlock; i++){ //numStims before, should be # of tri training_trials.push(probe_block) training_trials.push(rating_block) } -//training_trials.push(scanner_rest_block) - - var training_node = { timeline: training_trials, loop_function: function(data){ currBlock += 1 - if(currBlock == numBlocks){ - - + if(currBlock == numBlocks){ return false - }else if (currBlock < numBlocks){ - - + }else if (currBlock < numBlocks){ return true } } } - /* ************************************ */ /* Set up Experiment */ /* ************************************ */ @@ -625,19 +430,8 @@ var cue_control_smoking_experiment = [] cue_control_smoking_experiment.push(welcome_block); -//cue_control_smoking_experiment.push(check_finger_node); - cue_control_smoking_experiment.push(instructions_block); -//cue_control_smoking_experiment.push(experimentor_wait_block); - -//cue_control_smoking_experiment.push(scanner_wait_block_first); - -//cue_control_smoking_experiment.push(scanner_wait_block_second); - -//cue_control_smoking_experiment.push(scanner_wait_block_third); - cue_control_smoking_experiment.push(training_node); -cue_control_smoking_experiment.push(end_block); - +cue_control_smoking_experiment.push(end_block); \ No newline at end of file From bd479a1c4299e3ee0d8c8dfd619c27a99290a00c Mon Sep 17 00:00:00 2001 From: Jamie Li Date: Mon, 15 Oct 2018 17:28:43 -0700 Subject: [PATCH 8/8] finished conversion from mri to local for cue controls and discount --- cue_control_food/experiment.js | 4 +-- discount_fixed/experiment.js | 45 +++++++++++++++++++++++----------- discount_fixed/style.css | 11 +++++++++ 3 files changed, 43 insertions(+), 17 deletions(-) diff --git a/cue_control_food/experiment.js b/cue_control_food/experiment.js index 873a2b06d..687cae045 100644 --- a/cue_control_food/experiment.js +++ b/cue_control_food/experiment.js @@ -10,7 +10,6 @@ function addID() { jsPsych.data.addDataToLastTrial({exp_id: 'cue_control_food', subject_ID: subject_ID}) } - var createStims = function(numStims,numIterations,numZeroes){ var lowEnd = 1 var numberArray = [] @@ -29,8 +28,7 @@ var createStims = function(numStims,numIterations,numZeroes){ var stimArray = jsPsych.randomization.repeat(numberArray,numIterations) return stimArray -} - +} function createAllStims(numStimsPerCategory, numIterations, numZeroes, nullType){ diff --git a/discount_fixed/experiment.js b/discount_fixed/experiment.js index c6c30ec18..1011c01f6 100755 --- a/discount_fixed/experiment.js +++ b/discount_fixed/experiment.js @@ -66,7 +66,7 @@ for (var i = 0; i < stim_html.length; i++) { var instructions_block = { type: 'poldrack-single-stim', - stimulus: '

Choose between hypothetical options, $20 today or the presented option.

'+choices[0][0]+': Accept option on screen (reject $20 today).

'+choices[1][0]+': Reject option on screen (accept $20 today)

We will start with a practice trial. Press Enter to continue.

', + stimulus: '

Choose between hypothetical options, $20 today or the presented option.

'+choices[0][0]+': Accept option on screen (reject $20 today).

'+choices[1][0]+': Reject option on screen (accept $20 today)

We will start with a practice trial. Press Enter to continue.

', is_html: true, timing_stim: -1, timing_response: -1, @@ -92,7 +92,7 @@ var practice_block = { var start_test_block = { type: 'poldrack-single-stim', - stimulus: '

Starting test block. Get Ready!

', + stimulus: '

Starting test block. Get Ready!

', is_html: true, choices: 'none', timing_stim: 1500, @@ -108,23 +108,39 @@ var start_test_block = { }; var end_block = { - type: 'poldrack-single-stim', - stimulus: '

Fin.

', - is_html: true, - choices: [32], - timing_response: -1, - response_ends_trial: true, - data: { - trial_id: "end", - exp_id: 'discount_fixed' - }, - timing_post_trial: 0, - on_finish: function() { + type: 'poldrack-text', + data: { + trial_id: "end" + }, + timing_response: -1, + text: '
'+ + '

Thanks for completing!

'+ + '

Press enter to continue.

'+ + '
', + cont_key: [13], + timing_post_trial: 0, + on_finish: function() { var bonus = randomDraw(bonus_list) jsPsych.data.addDataToLastTrial({'bonus': bonus}) } }; +var welcome_block = { + type: 'poldrack-text', + data: { + trial_id: "welcome" + }, + timing_response: -1, + text: '
'+ + '

Welcome to the task!

'+ + '

Press enter to continue.

'+ + '
', + cont_key: [13], + timing_post_trial: 0 +}; + + + var rest_block = { type: 'poldrack-single-stim', stimulus: '

In this next block of trials
'+choices[0][0]+': Accept option on screen (reject $20 today).
'+choices[1][0]+': Reject option on screen (accept $20 today)
Next run will start in a moment

', @@ -140,6 +156,7 @@ var rest_block = { //Set up experiment var discount_fixed_experiment = [] //test_keys(discount_fixed_experiment,choices) +discount_fixed_experiment.push(welcome_block); discount_fixed_experiment.push(instructions_block); discount_fixed_experiment.push(practice_block); //setup_fmri_intro(discount_fixed_experiment) diff --git a/discount_fixed/style.css b/discount_fixed/style.css index b0ced0dba..43784edd6 100755 --- a/discount_fixed/style.css +++ b/discount_fixed/style.css @@ -14,6 +14,17 @@ color: white; } +/* used for large text shown in the center of the screen, like FB or stimuli */ +.center-textJamie { + text-align:center; + font-size: 26px; + position: relative; + top: 40%; + -ms-transform: translateY(-50%); + -webkit-transform: translateY(-50%); + transform: translateY(-50%); +} + .dd-stim { text-align: center; font-size: 80px;