diff --git a/circle.yml b/circle.yml
index e208b7c9c..acc1c368e 100644
--- a/circle.yml
+++ b/circle.yml
@@ -27,12 +27,19 @@ 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','.');"
- $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','.');"
diff --git a/cue_control_food/experiment.js b/cue_control_food/experiment.js
index 97e7bda00..687cae045 100644
--- a/cue_control_food/experiment.js
+++ b/cue_control_food/experiment.js
@@ -1,8 +1,6 @@
/* ************************************ */
/* Define Helper Functions */
/* ************************************ */
-
-
function getDisplayElement() {
$('
"+preFileType
@@ -368,8 +294,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,77 +308,13 @@ 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: '
',
- 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: {
@@ -472,58 +334,27 @@ 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 = {
@@ -577,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 */
/* ************************************ */
@@ -607,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
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 = ""
}
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..1011c01f6
--- /dev/null
+++ b/discount_fixed/experiment.js
@@ -0,0 +1,201 @@
+/* ************************************ */
+/* 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 choices = [['N key',78],['M key', 77]]
+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.
'+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: [13],
+ data: {
+ trial_id: "instructions",
+ },
+ timing_post_trial: 500
+};
+
+var practice_block = {
+ type: 'poldrack-single-stim',
+ data: {
+ trial_id: "stim",
+ exp_stage: "practice"
+ },
+ stimulus: '
',
+ is_html: true,
+ choices: [choices[0][1], choices[1][1]],
+ response_ends_trial: true,
+};
+
+var start_test_block = {
+ type: 'poldrack-single-stim',
+ stimulus: '
Starting test block. Get Ready!
',
+ 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-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
',
+ 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(welcome_block);
+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[0][1], choices[1][1]],
+ response_ends_trial: false,
+ timing_post_trial: 0,
+ on_finish: function(data) {
+ var choice = false;
+ 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 == choices[1][1]) {
+ 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..43784edd6
--- /dev/null
+++ b/discount_fixed/style.css
@@ -0,0 +1,63 @@
+.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;
+}
+
+/* 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;
+ 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;
+}