-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrtpuhhome.js
154 lines (144 loc) · 6.2 KB
/
rtpuhhome.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/* Change 1: Adding the image hosting site */
// define the site that hosts stimuli images
// usually https://<your-github-username>.github.io/<your-experiment-name>/
var repo_site = "https://spoggesi.github.io/Qualtrics-test/";
/* create timeline */
var timeline = [];
/* define instructions trial */
var instructions = {
type: "html-keyboard-response",
stimulus: "<p><strong>Please eat the rest of the sample. You can now finish all the yoghurt left in the pot.</strong></p>" +
"<p>Please respond to whether you associate the word shown with the yoghurt you have just eaten or your experience of eating this yoghurt.</p>" +
"<p>There are no incorrect answers, just your opinion.</p>" +
"<p><strong>Place your fingers over the F and J keys ready to make your choices.</strong></p>" +
"<p>Press any key to begin.</p>",
post_trial_gap: 2000
};
timeline.push(instructions);
/* test trials */
var test_stimuli = [{
stimulus: '<div style="font-size:60px;">energetic</div>',
data: {test_part: 'energeticpuhhome', correct_response: 'j'}
},
{
stimulus: '<div style="font-size:60px;">indulgent</div>',
data: {test_part: 'indulgentpuhhome', correct_response: 'j'}
},
{
stimulus: '<div style="font-size:60px;">nervous</div>',
data: {test_part: 'nervouspuhhome', correct_response: 'j'}
},
{
stimulus: '<div style="font-size:60px;">relaxed</div>',
data: {test_part: 'relaxedpuhhome', correct_response: 'j'}
},
{
stimulus: '<div style="font-size:60px;">active</div>',
data: {test_part: 'activepuhhome', correct_response: 'j'}
},
{
stimulus: '<div style="font-size:60px;">happy</div>',
data: {test_part: 'happypuhhome', correct_response: 'j'}
},
{
stimulus: '<div style="font-size:60px;">uninspired</div>',
data: {test_part: 'uninspiredpuhhome', correct_response: 'j'}
},
{
stimulus: '<div style="font-size:60px;">classic</div>',
data: {test_part: 'classicpuhhome', correct_response: 'j'}
},
{
stimulus: '<div style="font-size:60px;">impressed</div>',
data: {test_part: 'impressedpuhhome', correct_response: 'j'}
},
{
stimulus: '<div style="font-size:60px;">sour</div>',
data: {test_part: 'sourpuhhome', correct_response: 'j'}
},
{
stimulus: '<div style="font-size:60px;">sweet</div>',
data: {test_part: 'sweetpuhhome', correct_response: 'j'}
},
{
stimulus: '<div style="font-size:60px;">thick</div>',
data: {test_part: 'thickpuhhome', correct_response: 'j'}
},
{
stimulus: '<div style="font-size:60px;">creamy</div>',
data: {test_part: 'creamypuhhome', correct_response: 'j'}
},
{
stimulus: '<div style="font-size:60px;">healthy</div>',
data: {test_part: 'healthypuhhome', correct_response: 'j'}
},
{
stimulus: '<div style="font-size:60px;">tasty</div>',
data: {test_part: 'tastypuhhome', correct_response: 'j'}
}
];
var fixation = {
type: 'html-keyboard-response',
stimulus: '<div style="font-size:60px;">+</div>',
choices: jsPsych.NO_KEYS,
prompt: '<div class = leftBoxes>press "F" for NO</div> <div class = rightBoxes>press "J" for YES</div>',
trial_duration: function () {
return jsPsych.randomization.sampleWithoutReplacement([1000], 1)[0];
},
data: {
test_part: 'fixation'
}
}
var test = {
type: "html-keyboard-response",
stimulus: jsPsych.timelineVariable('stimulus'),
choices: ['f', 'j'],
data: jsPsych.timelineVariable('data'),
prompt: '<div class = leftBoxes>press "F" for NO</div> <div class = rightBoxes>press "J" for YES</div>',
on_finish: function (data) {
data.correct = data.key_press == jsPsych.pluginAPI.convertKeyCharacterToKeyCode(data.correct_response);
},
}
var test_procedure = {
timeline: [fixation, test],
timeline_variables: test_stimuli,
repetitions: 3,
randomize_order: true
}
timeline.push(test_procedure);
/* define debrief */
var debrief_block = {
type: "html-keyboard-response",
stimulus: function () {
var energetic = jsPsych.data.get().filter({test_part: 'energetic'});
var indulgent = jsPsych.data.get().filter({test_part: 'indulgent'});
var nervous = jsPsych.data.get().filter({test_part: 'nervous'});
var relaxed = jsPsych.data.get().filter({test_part: 'relaxed'});
var active = jsPsych.data.get().filter({test_part: 'active'});
var happy = jsPsych.data.get().filter({test_part: 'happy'});
var uninspired = jsPsych.data.get().filter({test_part: 'uninspired'});
var classic = jsPsych.data.get().filter({test_part: 'classic'});
var impressed= jsPsych.data.get().filter({test_part: 'impressed'});
var sour = jsPsych.data.get().filter({test_part: 'sour'});
var sweet = jsPsych.data.get().filter({test_part: 'sweet'});
var thick = jsPsych.data.get().filter({test_part: 'thick'});
var creamy = jsPsych.data.get().filter({test_part: 'creamy'});
var healthy = jsPsych.data.get().filter({test_part: 'healthy'});
var tasty = jsPsych.data.get().filter({test_part: 'tasty'});
var rt_energetic = Math.round(energetic.select('rt').mean());
var rt_indulgent = Math.round(indulgent.select('rt').mean());
var rt_nervous = Math.round(nervous.select('rt').mean());
var rt_relaxed = Math.round(relaxed.select('rt').mean());
var rt_active = Math.round(active.select('rt').mean());
var rt_happy = Math.round(happy.select('rt').mean());
var rt_uninspired = Math.round(uninspired.select('rt').mean());
var rt_classic = Math.round(classic.select('rt').mean());
var rt_impressed = Math.round(impressed.select('rt').mean());
var rt_sour= Math.round(indulgent.select('rt').mean());
var rt_sweet= Math.round(sweet.select('rt').mean());
var rt_thick= Math.round(thick.select('rt').mean());
var rt_creamy= Math.round(creamy.select('rt').mean());
var rt_healthy= Math.round(healthy.select('rt').mean());
var rt_tasty= Math.round(tasty.select('rt').mean());
}
};