Skip to content

Commit

Permalink
put experiment in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
chuqihu8 committed Nov 1, 2023
1 parent c2d8f65 commit 91ff70c
Show file tree
Hide file tree
Showing 148 changed files with 289 additions and 0 deletions.
Binary file added docs/img/.DS_Store
Binary file not shown.
Binary file added docs/img/social/.DS_Store
Binary file not shown.
Binary file added docs/img/social/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/21.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/22.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/23.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/25.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/26.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/27.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/28.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/29.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/30.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/31.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/social/32.png
Binary file added docs/img/social/4.png
Binary file added docs/img/social/5.png
Binary file added docs/img/social/6.png
Binary file added docs/img/social/7.png
Binary file added docs/img/social/8.png
Binary file added docs/img/social/9.png
Binary file added docs/img/social/practice/.DS_Store
Binary file not shown.
Binary file added docs/img/social/practice/1.png
Binary file added docs/img/social/practice/2.png
Binary file added docs/img/social/practice/3.png
Binary file added docs/img/social/version2/.DS_Store
Binary file not shown.
Binary file added docs/img/social/version2/1.png
Binary file added docs/img/social/version2/10.png
Binary file added docs/img/social/version2/11.png
Binary file added docs/img/social/version2/12.png
Binary file added docs/img/social/version2/13.png
Binary file added docs/img/social/version2/14.png
Binary file added docs/img/social/version2/15.png
Binary file added docs/img/social/version2/16.png
Binary file added docs/img/social/version2/17.png
Binary file added docs/img/social/version2/18.png
Binary file added docs/img/social/version2/19.png
Binary file added docs/img/social/version2/2.png
Binary file added docs/img/social/version2/20.png
Binary file added docs/img/social/version2/21.png
Binary file added docs/img/social/version2/22.png
Binary file added docs/img/social/version2/23.png
Binary file added docs/img/social/version2/24.png
Binary file added docs/img/social/version2/25.png
Binary file added docs/img/social/version2/26.png
Binary file added docs/img/social/version2/27.png
Binary file added docs/img/social/version2/28.png
Binary file added docs/img/social/version2/29.png
Binary file added docs/img/social/version2/3.png
Binary file added docs/img/social/version2/30.png
Binary file added docs/img/social/version2/31.png
Binary file added docs/img/social/version2/32.png
Binary file added docs/img/social/version2/4.png
Binary file added docs/img/social/version2/5.png
Binary file added docs/img/social/version2/6.png
Binary file added docs/img/social/version2/7.png
Binary file added docs/img/social/version2/8.png
Binary file added docs/img/social/version2/9.png
Binary file added docs/img/social/version2/p1.png
Binary file added docs/img/social/version2/p2.png
Binary file added docs/img/social/version2/p3.png
Binary file added docs/img/spatial/.DS_Store
Binary file not shown.
Binary file added docs/img/spatial/1.png
Binary file added docs/img/spatial/10.png
Binary file added docs/img/spatial/11.png
Binary file added docs/img/spatial/12.png
Binary file added docs/img/spatial/13.png
Binary file added docs/img/spatial/14.png
Binary file added docs/img/spatial/15.png
Binary file added docs/img/spatial/16.png
Binary file added docs/img/spatial/17.png
Binary file added docs/img/spatial/18.png
Binary file added docs/img/spatial/19.png
Binary file added docs/img/spatial/2.png
Binary file added docs/img/spatial/20.png
Binary file added docs/img/spatial/21.png
Binary file added docs/img/spatial/22.png
Binary file added docs/img/spatial/23.png
Binary file added docs/img/spatial/24.png
Binary file added docs/img/spatial/25.png
Binary file added docs/img/spatial/26.png
Binary file added docs/img/spatial/27.png
Binary file added docs/img/spatial/28.png
Binary file added docs/img/spatial/29.png
Binary file added docs/img/spatial/3.png
Binary file added docs/img/spatial/30.png
Binary file added docs/img/spatial/31.png
Binary file added docs/img/spatial/32.png
Binary file added docs/img/spatial/4.png
Binary file added docs/img/spatial/5.png
Binary file added docs/img/spatial/6.png
Binary file added docs/img/spatial/7.png
Binary file added docs/img/spatial/8.png
Binary file added docs/img/spatial/9.png
Binary file added docs/img/spatial/practice/.DS_Store
Binary file not shown.
Binary file added docs/img/spatial/practice/1.png
Binary file added docs/img/spatial/practice/2.png
Binary file added docs/img/spatial/practice/3.png
Binary file added docs/img/spatial/version2/.DS_Store
Binary file not shown.
Binary file added docs/img/spatial/version2/1.png
Binary file added docs/img/spatial/version2/10.png
Binary file added docs/img/spatial/version2/11.png
Binary file added docs/img/spatial/version2/12.png
Binary file added docs/img/spatial/version2/13.png
Binary file added docs/img/spatial/version2/14.png
Binary file added docs/img/spatial/version2/15.png
Binary file added docs/img/spatial/version2/16.png
Binary file added docs/img/spatial/version2/17.png
Binary file added docs/img/spatial/version2/18.png
Binary file added docs/img/spatial/version2/19.png
Binary file added docs/img/spatial/version2/2.png
Binary file added docs/img/spatial/version2/20.png
Binary file added docs/img/spatial/version2/21.png
Binary file added docs/img/spatial/version2/22.png
Binary file added docs/img/spatial/version2/23.png
Binary file added docs/img/spatial/version2/24.png
Binary file added docs/img/spatial/version2/25.png
Binary file added docs/img/spatial/version2/26.png
Binary file added docs/img/spatial/version2/27.png
Binary file added docs/img/spatial/version2/28.png
Binary file added docs/img/spatial/version2/29.png
Binary file added docs/img/spatial/version2/3.png
Binary file added docs/img/spatial/version2/30.png
Binary file added docs/img/spatial/version2/31.png
Binary file added docs/img/spatial/version2/32.png
Binary file added docs/img/spatial/version2/4.png
Binary file added docs/img/spatial/version2/5.png
Binary file added docs/img/spatial/version2/6.png
Binary file added docs/img/spatial/version2/7.png
Binary file added docs/img/spatial/version2/8.png
Binary file added docs/img/spatial/version2/9.png
Binary file added docs/img/spatial/version2/p1.png
Binary file added docs/img/spatial/version2/p2.png
Binary file added docs/img/spatial/version2/p3.png
289 changes: 289 additions & 0 deletions docs/social2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,289 @@
<!DOCTYPE html>
<html>

<head>
<title>Experiment-Spatial</title>
<script src="https://unpkg.com/[email protected]"></script>
<script src="https://unpkg.com/@jspsych/[email protected]"></script>
<script src="https://unpkg.com/@jspsych/[email protected]"></script>
<script src="https://unpkg.com/@jspsych/[email protected]"></script>
<script src="https://unpkg.com/@jspsych/[email protected]"></script>
<script src="https://unpkg.com/@jspsych/[email protected]"></script>
<script src="https://unpkg.com/@jspsych-contrib/plugin-pipe"></script>
<script src="https://unpkg.com/@jspsych/[email protected]"></script>
<script src="https://unpkg.com/@jspsych/[email protected]"></script>
<script src="https://unpkg.com/@jspsych/[email protected]"></script>
<link href="https://unpkg.com/[email protected]/css/jspsych.css" rel="stylesheet" type="text/css" />

</head>
<body></body>
<script>



/* initialize jsPsych */
var jsPsych = initJsPsych({
override_safe_mode: true,
on_finish: function () {
jsPsych.data.displayData("csv");
}});

// capture info from Prolific
var subject_id = jsPsych.data.getURLVariable('PROLIFIC_PID');
var study_id = jsPsych.data.getURLVariable('STUDY_ID');
var session_id = jsPsych.data.getURLVariable('SESSION_ID');

jsPsych.data.addProperties({
subject_id: subject_id,
study_id: study_id,
session_id: session_id
});
var timeline = [];

//welcome page

var consent = {
type: jsPsychHtmlButtonResponse,
stimulus: '<p style="font-size:20px; color:black;"><p>By answering the following questions, you are participating in a study being performed by cognitive scientists in the Stanford Department of Psychology. </p><p>If you have questions about this research, please contact us at [email protected]. </p><p>You must be at least 18 years old to participate. Your participation in this research is voluntary. You may decline to answer any or all of the following questions. You may decline further participation, at any time, without adverse consequences. </p><p>Your anonymity is assured; the researchers who have requested your participation will not receive any personal information about you.</p>',
choices: ['Start'],

}
timeline.push(consent);

var instruction_one = {
type: jsPsychHtmlButtonResponse,
stimulus: '<p style="font-size:20px; color:black;">Our experiment is a task that tests your perspective taking ability.</p>',
choices: ['Next'],
};
timeline.push(instruction_one);

var instruction_two= {
type: jsPsychHtmlButtonResponse,
stimulus: '<p style="font-size:20px; color:black;">Perspective taking ability can be thought of as a measure of <strong>empathetic ability</strong>.</p>',
choices: ['Next'],
};
timeline.push(instruction_two);
var instruction_three= {
type: jsPsychHtmlButtonResponse,
stimulus: '<p style="font-size:20px; color:black;"><p>Spatial ability is a cognitive ability that is defined as understanding the relations between objects in space </p><p> and being able to mentally manipulate them and respond correctly.</p>',
choices: ['Next'],
};
timeline.push(instruction_three);
var instruction_four= {
type: jsPsychHtmlButtonResponse,
stimulus: '<p style="font-size:20px; color:black;">Previous studies have shown that <strong>females often score higher on measures of empathetic ability</strong>.</p>',
choices: ['Next'],
};
timeline.push(instruction_four);

var instruction_spatial = {
type: jsPsychHtmlButtonResponse,
stimulus:
`<p>In this test, you will be shown a map of a city with a path drawn through it. </p>
<p>Imagine yourself taking the perspective of the person on the map. Suppose that one day, you went for walk and followed the path through the city that is shown. </p>
<p>At each turn that the path takes,
your task is to decide whether you would turn to your right or your left as you are walking. </p>
<p>If it is a <strong> right turn</strong>, click on the <strong> right arrow key</strong> on your keyboard,</p>
<p>and if it is a <strong> left turn</strong>, click on the <strong> left arrow key</strong> on your keyboard.</p>
<p>You will first see three practice trials. </p>
<p>Please do not turn your computer screen/head.</p>`,
choices: ['I have read the instructions and I am ready'],
show_clickable_nav: true,

};
timeline.push(instruction_spatial);

var instruction_practice= {
type: jsPsychHtmlButtonResponse,
stimulus: '<p style="font-size:20px; color:black;">You will first see three practice trials</p><p><p>If it is a <strong> right turn</strong>, click on the <strong> right arrow key</strong> on your keyboard,</p><p>and if it is a <strong> left turn</strong>, click on the <strong> left arrow key</strong> on your keyboard.</p> ',
choices: ['Next'],
};

timeline.push(instruction_practice);

var practice_trials = {
type: jsPsychImageKeyboardResponse,
choices: ['ArrowLeft', 'ArrowRight'],
stimulus_height: 500,
stimulus_width: 800,
timeline: [
{stimulus: 'img/social/version2/p1.png'},
{stimulus: 'img/social/version2/p2.png'},
{stimulus: 'img/social/version2/p3.png'}
]
}
timeline.push(practice_trials);
var instruction_experiment_trials= {
type: jsPsychHtmlButtonResponse,
stimulus: '<p style="font-size:20px; color:black;"> Now, you will have 30 seconds to complete as many of the 32 trials as you can.',
choices: ['Next'],
};
timeline.push(instruction_experiment_trials);

var time_limit = 30000;
var start_time;
var end_test_timer;
var trial_count = 0;




var test_stimuli = [
{ stimulus: "img/social/version2/1.png", correct_response: 'ArrowLeft'},
{ stimulus: "img/social/version2/2.png", correct_response: 'ArrowLeft'},
{ stimulus: "img/social/version2/3.png", correct_response: 'ArrowRight'},
{ stimulus: "img/social/version2/4.png", correct_response: 'ArrowRight' },
{ stimulus: "img/social/version2/5.png", correct_response: 'ArrowLeft' },
{ stimulus: "img/social/version2/6.png",correct_response: 'ArrowLeft' },
{ stimulus: "img/social/version2/7.png" ,correct_response: 'ArrowRight' },
{ stimulus: "img/social/version2/8.png",correct_response: 'ArrowRight' },
{ stimulus: "img/social/version2/9.png",correct_response: 'ArrowRight' },
{ stimulus: "img/social/version2/10.png",correct_response: 'ArrowLeft' },
{ stimulus: "img/social/version2/11.png",correct_response: 'ArrowRight' },
{ stimulus: "img/social/version2/12.png",correct_response: 'ArrowLeft' },
{ stimulus: "img/social/version2/13.png",correct_response: 'ArrowLeft' },
{ stimulus: "img/social/version2/14.png",correct_response: 'ArrowRight' },
{ stimulus: "img/social/version2/15.png",correct_response: 'ArrowRight'},
{ stimulus: "img/social/version2/16.png",correct_response: 'ArrowLeft'},
{ stimulus: "img/social/version2/17.png",correct_response: 'ArrowLeft' },
{ stimulus: "img/social/version2/18.png",correct_response: 'ArrowRight' },
{ stimulus: "img/social/version2/19.png",correct_response: 'ArrowRight' },
{ stimulus: "img/social/version2/20.png",correct_response: 'ArrowLeft' },
{ stimulus: "img/social/version2/21.png",correct_response: 'ArrowLeft' },
{ stimulus: "img/social/version2/22.png",correct_response: 'ArrowRight' },
{ stimulus: "img/social/version2/23.png",correct_response: 'ArrowRight' },
{ stimulus: "img/social/version2/24.png",correct_response: 'ArrowRight' },
{ stimulus: "img/social/version2/25.png",correct_response: 'ArrowLeft' },
{ stimulus: "img/social/version2/26.png",correct_response: 'ArrowLeft' },
{ stimulus: "img/social/version2/27.png",correct_response: 'ArrowLeft' },
{ stimulus: "img/social/version2/28.png",correct_response: 'ArrowRight' },
{ stimulus: "img/social/version2/29.png",correct_response: 'ArrowRight' },
{ stimulus: "img/social/version2/30.png",correct_response: 'ArrowLeft' },
{ stimulus: "img/social/version2/31.png",correct_response: 'ArrowRight' },
{ stimulus: "img/social/version2/32.png",correct_response: 'ArrowRight' },
];

var n_trials = test_stimuli.length;
function getKeyCodeFromKeyCharacter(keyCharacter) {
switch(keyCharacter.toLowerCase()) { // Convert to lowercase for comparison
case 'arrowleft':
return 37;
case 'arrowright':
return 39;
// Add cases for other keys if needed
default:
return -1; // return a non-valid key code
}
}

var test = {
type: jsPsychImageKeyboardResponse,
stimulus: jsPsych.timelineVariable('stimulus'),
choices: ['ArrowLeft', 'ArrowRight'],
stimulus_height: 800,
stimulus_width: 500,
on_load: function() {
trial_count++;
// we need to set up the timer to end the current timeline after a certain duration, but only on the first trial
if (trial_count == 1) {
start_time = performance.now();
end_test_timer = setTimeout(function() {
// this stuff is just for testing
var end_time = performance.now();
var elapsed_time = end_time - start_time;
console.log("elapsed time: ", elapsed_time);
// this function is all you need to end the current timeline
jsPsych.endCurrentTimeline();
// this function ends the current trial
jsPsych.finishTrial({status: "ended early"});
}, time_limit);
}
},
on_finish: function(data) {
var correct_response = jsPsych.timelineVariable('correct_response', true).toLowerCase();

// Check if the response matches the correct response and record it
data.correct = data.response === correct_response;

// Existing code to clear the timer
if (trial_count == 32) {
clearTimeout(end_test_timer);
}
}
}

var test_procedure = {
timeline: [test],
timeline_variables: test_stimuli
};


timeline.push(test_procedure);

var last_instruction= {
on_start: function(data) {

clearTimeout(end_test_timer);
},

type: jsPsychHtmlButtonResponse,
stimulus: '<p style="font-size:20px; color:black;"><p>You have finished the task - thanks for participating! Three more questions before you go. </p>',
choices: ['OK'],

};

timeline.push(last_instruction);

var Question1 = {
type: jsPsychSurveyMultiChoice,
questions: [
{
prompt: "What is your biological sex",
name: 'sex',
options: ['Male', 'Female','Other'],
required: true
}
],
};
timeline.push(Question1);
var Question2 = {
type: jsPsychSurveyMultiChoice,
questions: [
{
prompt: "Perspective-taking ability can be thought of as a measure of _______.",
name: 'q2',
options: ['spatial ability', 'empathetic ability'],
required: true
},

],
};
timeline.push(Question2);

var Question3 = {
type: jsPsychSurveyMultiChoice,
questions: [
{
prompt: "_______ often score higher on measures of empathetic ability.",
name: 'q3',
options: ['Males', 'Females'],
required: true
}
],
};
timeline.push(Question3);


var Debrief= {
type: jsPsychHtmlButtonResponse,
stimulus: '<p style="font-size:20px; color:black;"><p>Thanks for participating! In this study the task is framed either as a spatial task (which male participants typically perform better on) or a social task (which female participants typically perform better on). We are looking at the effect of gender bias in problem framing on performance. We ask that you please do not share this information with other potential participants. </p>',
choices: ['Submit'],

};

timeline.push(Debrief);

jsPsych.run(timeline);
</script>

</html>

0 comments on commit 91ff70c

Please sign in to comment.