Replies: 2 comments
-
Hello Patlane. I'm having a hard time trying to repro your issue. I'm getting lot of errors by copy&paste your code into cognition. There is also a missing function Can you please give us the URL of the experiment? On the meantime, I'd recommend you to redirect the user using the on_finish Jspsych global callback. Cognition will call on_finish callback once the timeline is finished and the data is uploaded to the server. If the participant moves to prolific before the timeline is complete, the run will be marked as unfinished. |
Beta Was this translation helpful? Give feedback.
-
Hi @javidalpe , I greatly appreciate that you answer and take this on! The link is: https://khowpscqnh.cognition.run. I even would share the project on cognition.run with you, so that you could see what types of customized functions I use. gerList1 is a list of stimuli. But unfortunately, I can't find where I could share my code on cognition.run with collaborators. When I run this experiment in the coding window, it displays the last window. When, however, I run it in a web browser it doesn't. This is the stand of yesterdays morning. I did not test it today. Indeed, I collected my data with using automatic redirection. Thank you so much for looking into this! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks!
Today, I get exactly the message as MTuttle6 describes in a "Cognition.run Final Screen', when running an experiment that run perfectly last week Friday. I need fast help here, as I need data coming in today.
My code on cognition.run is pasted below. The problem lies in variable conclusion which should show participants a conclusion screen and provide a link to Prolific. But it never shows!!! Instead, I get the message like MTuttle6 has reported and the screen stays white. Thank you so much for your help!!!
//-------------------------------------------------------------------
//
// In this block I generate the variables and data for my experiment
//
//-------------------------------------------------------------------
randomize = true // present different set sizes in random order. if false, set sizes will be presented in ascending order
// randomly choose a list: 1 or 2
//var list = jsPsych.randomization.sampleWithoutReplacement([1,2,3,4],1)[0];
var conceptual_stimuli
if(CONDITION == 1){
conceptual_stimuli = gerList1
}
if(CONDITION == 2){
conceptual_stimuli = gerList2
}
if(CONDITION == 3){
conceptual_stimuli = gerList3
}
if(CONDITION == 4){
conceptual_stimuli = gerList4
}
console.log(CONDITION)
var possibleLetters = ["F","H","J","K","L","N","P","Q","R","S","T","V"]
//var letterDemo_setSizes = jsPsych.randomization.sampleWithoutReplacement([2,3,4,5], 4)
var letterDemo_setSizes = [2,3,4,5]
var decisionDemo_setSizes = [2,3]
var setSizes = [2,3,4,5]
var nSets = setSizes.length
if (randomize){
var test_setSizes = jsPsych.randomization.sampleWithoutReplacement(setSizes, nSets);
test_setSizes.push(jsPsych.randomization.sampleWithoutReplacement(setSizes, nSets));
test_setSizes.push(jsPsych.randomization.sampleWithoutReplacement(setSizes, nSets));
}
test_setSizes = test_setSizes.flat(1)
//test_setSizes = [2, 2]
var sumDemoTrials = 0
for (var i = 0; i < letterDemo_setSizes.length; i++) {
sumDemoTrials += letterDemo_setSizes[i];
}
var setSizesFullDemo = decisionDemo_setSizes.concat(letterDemo_setSizes)
var setSizesAll = setSizesFullDemo.concat(test_setSizes)
var sum = 0;
for (var i = 0; i < letterDemo_setSizes.length; i++) {
sum += letterDemo_setSizes[i];
}
var decisionDemo_stimuli = jsPsych.randomization.sampleWithoutReplacement(practice_stimuli, 5)
var fullDemo_stimuli = jsPsych.randomization.sampleWithoutReplacement(practice_stimuli, sum) // The new variable with the resampled order of my conceptual decision practice stimuli, adjusted to the selected set sizes
var sum = 0;
for (var i = 0; i < test_setSizes.length; i++) {
sum += test_setSizes[i];
}
var decisionTest_stimuli = jsPsych.randomization.sampleWithoutReplacement(conceptual_stimuli, sum) // The new variable with the resampled order of my conceptual decision target stimuli, adjusted to the selected set sizes
var lingtrials = decisionDemo_stimuli.concat(fullDemo_stimuli, decisionTest_stimuli) // Combine the three types of trials into one array
var letterTrial = 0 //keeps track of number of letter trials gone by
var nLoadAcc = 0 //keeps track of number of correctly resolved load trials (conceptual decision or math equasion)
var loadType = 0 // 0 = conceptual; here I track which type of load (either conceptual load (=0) or math load) is presented
var selection=[]
var trialArrays = []
var k = 0
for(var i = 0; i < setSizesAll.length; i++){
var trialObjects = []
for(var j = 0; j < setSizesAll[i]; j++){
}
trialArrays.push(trialObjects)
}
// Define the instructions
var welcome = {
type: "html-button-response",
stimulus:
Herzlich willkommen zur Gedächtnis-Studie!
In diesem Experiment können Sie Ihre kognitiven Fähigkeiten und Ihr Arbeitsgedächtnis auf die Probe stellen und gleichzeitig einen Beitrag zur Erforschung der deutschen Sprache leisten.
Vielen Dank für Ihren Beitrag!
,//
Vajuta klaviatuuril ükskõik, mis klahvi selleks, et jätkata.
,
choices: ['Weiter >'],
};
var instructions = {
type: "html-button-response",
stimulus:
In diesem Experiment lösen Sie einfache Aufgaben und erinnern sich gleichzeitig an Buchstaben, die Sie zwischendurch auf dem Bildschirm sehen. Nachdem Sie zwei bis fünf Buchstaben gesehen haben, müssen Sie anklicken, welche Buchstaben Sie in welcher Reihenfolge gesehen haben. Sie müssen sich also die Buchstaben und die Reihenfolge, in der diese erscheinen, merken.</p
Der Test besteht aus zwei Teilen. In beiden Teilen sollen Sie auf die Buchstaben achten, die auf dem Bildschirm erscheinen und sich diese merken. Gleichzeitig müssen Sie sprachliche oder mathematische Aufgaben lösen. Im ersten Teil des Experiments werden Sie gefragt, ob sich mit einem gezeigten Nomen und einem Verb ein Satz bilden lässt. Im zweiten Teil des Experiments müssen Sie bewerten, ob die Lösung der Matheaufgabe korrekt ist. Zu Beginn jedes Teils werden Sie Beispiele für die Aufgaben bearbeiten und eine Übungsphase durchlaufen können.
,
choices: ['Weiter >'],
//hinnata lausete (esimene plokk) või nimisõna ja tegusõna paaride (teine plokk) õigsust/sobivust
//post_trial_gap: 2000
//Teises plokis palutakse Sul hinnata lausete õigsust.
};
var letterdemo_instruction ={
type: "instructions",
pages: [
Mäluülesanne
Ekraanile ilmuvad ühe kaupa kaks kuni viis tähte. Püüa meelde jätta iga täht selle ilmumise järjekorras. Iga täht püsib ekraanil poolteist sekundit ning uus täht ilmub ekraanile automaatselt.
Järjestikku võivad ekraanile ilmuda kaks kuni viis tähte, nt P J Q L. Pärast tähejada näed ekraanil täheklahvistikku 12 erineva tähega. Sinu ülesandeks on märkida, milliseid tähti ja mis järjekorras sa nägid. Vastamiseks klikka tähtedel tähtede ilmumise järjekorras.
Kui teed vea, saad valitud tähe kustutada nupu 'Kustuta' abil. Pea meeles, et õige vastus sisaldab tähti nende ilmumise järjekorras. Kui juhtub, et mõni täht ununeb ära, siis klikka sellel tähel, mis sa arvad, et võis sellel kohal olla ja vali ülejäänud tähed õiges järjekorras. Tähtede sisestamiseks võid endale aega võtta nii palju kui vaja.
, Tähelepanu! Kui klikid 'Edasi' algab mäluülesanne ja ilmuvad tähed, mis tuleb meelde jätta.]
//
Press "Next" for practice trials.
,
show_clickable_nav: true,
button_label_previous: "Tagasi",
button_label_next: "Edasi",
};
var conceptualLoad_instruction ={
type: "instructions",
pages: [
Keeleülesanne
Ekraanile ilmuvad kolm nimisõna, mis tähistavad asju ja elusolendeid, nt hani, rosin ja seeme. Lisaks näed ekraanil koos nimisõnadega kolm korda ühte ja sama tegusõna, mis väljendab mingit tegevust, nt jalutama. Sinu ülesandeks on iga nimisõna kohta otsustada, kas ta võib esineda koos selle tegusõnaga ühes ja samas lauses.
Vastusevariandid on 'Jah' või 'Ei'. Kui sinu arvates sobivad selle tegusõnaga kõik kolm nimisõna, siis on vastuseks "Jah, need nimisõnad sobivad selle tegusõnaga" (nupp 'Jah'). Kui mõni neist ei sobi, tuleb vastuseks valida "Ei, need nimisõnad ei sobi selle tegusõnaga (nupp 'Ei')".
Sõnad püsivad ekraanil 4 sekundit. Katse liigub edasi niipea, kui oled oma vastusevaliku teinud. Klikka 'Edasi', et vaadata selgitavaid näiteid.
,`Esimene näide:
raamat + kirjutama = OK?
sekretär + kirjutama = OK?
sõnum + kirjutama = OK?
Selles näites on tegusõnaks kirjutama. Raamatut ja sõnumit saab kirjutada. Sekretär saab ise midagi kirjutada. See tähendab, et kõik kolm nimisõna raamat, sekretär ja sõnum sobivad kokku tegusõnaga kirjutama. Seega tuleks klikata vastusevariandil 'Jah'.`,
`Teine näide:
seeme + jalutama = OK?
rosin + jalutama = OK?
hani + jalutama = OK?
Selles näites on tegusõnaks jalutama. Seeme ja rosin ei saa jalutada. Küll aga saab jalutada hani. Selles näites sobib tegusõnaga jalutama ainult üks nimisõna, st hani. Seega on õigeks vastuseks "Ei, need nimisõnad ei sobi selle tegusõnaga kokku" ja klikata tuleks nupul 'Ei'.`, `Klikka 'Edasi', et keeleülesandega jätkata.` ], show_clickable_nav: true, button_label_previous: "Tagasi", button_label_next: "Edasi", }; var letterdemo_instruction ={ type: "instructions", pages: [
Gedächtnis-Aufgabe
Auf dem Bildschirm werden Sie zwei bis fünf Buchstaben sehen, z.B. P J Q L. Jeder Buchstabe ist für ca. eine Sekunde auf dem Bildschirm zu sehen. Dann erscheint automatisch der nächste Buchstabe. Nach der Buchstabenfolge klicken Sie bitte auf einem Tastenfeld mit zwölf Buchstaben an, welche Buchstaben Sie in welcher Reihenfolge gesehen haben. Dafür klicken Sie einfach die Buchstaben in der Abfolge an, in der Sie sie gesehen haben.
Wenn Sie einen Fehler machen, können Sie den ausgewählten Buchstaben löschen, indem Sie auf 'Löschen' klicken. Vergessen Sie nicht, dass Ihre Antwort nur dann korrekt ist, wenn Sie die Buchstaben in der richtigen Reihenfolge angeben. Wenn Sie also einen der Buchstaben vergessen haben, dann raten Sie so gut Sie können und wählen Sie die weiteren Buchstaben trotzdem entsprechend der Reihenfolge, in der sie erschienen sind. Für die Buchstabeneingabe können Sie sich so viel Zeit lassen wie Sie dafür benötigen.
, Klicken Sie auf 'Weiter', um den Übungsaufgaben zum ersten Aufgabenteil zu beginnen. ] //Press "Next" for practice trials.
,
show_clickable_nav: true,
button_label_previous: "Zurück",
button_label_next: "Weiter",
};
var conceptualLoad_instruction ={
type: "instructions",
pages: [
Sprach-Aufgabe
Auf dem Bildschirm erscheinen drei Nomen, die sowohl Objekte als auch Lebewesen bezeichnen können, z.B. Gans, Rosine und Samen. Neben jedem Nomen steht jeweils dasselbe Verb, welches eine Aktion ausdrückt, z.B. laufen. Ihre Aufgabe ist es, für jedes der Nomen zu entscheiden, ob dieses mit dem angezeigten Verb zu einem Satz verbunden werden könnte.
Wenn Sie denken, dass alle drei Nomen mit dem angezeigten Verb in einem Satz vorkommen können, dann klicken Sie auf 'Ja'. Wenn jedoch eines der drei Nomen nicht mit dem Verb einen Satz bilden kann, dann klicken Sie auf 'Nein'.
Sie sehen die Wörter auf dem Bildschirm für vier Sekunden, danach verschwinden sie. Das Experiment wird jedoch erst dann fortgesetzt, wenn Sie ihre Antwort anklicken. Klicken Sie auf 'Weiter', um zu den Beispielen von der Sprachaufgabe zu gelangen.
,// Functions
var function_opLoad = function(correct){ // generates math questions
var possibleOperations = [" + ", " - "]
operation = jsPsych.randomization.sampleWithReplacement(possibleOperations, 1)[0]
if (operation==" + "){
num1 = Math.floor(jStat.uniform.sample(1, 11))
num2 = Math.floor(jStat.uniform.sample(1, 11))
ans = num1 + num2
} else if (operation==" - "){
num1 = Math.floor(jStat.uniform.sample(1, 11))
num2 = Math.floor(jStat.uniform.sample(1, num1))
ans = num1 - num2
}
if (!correct){ // generates incorrect answers
ansDiff = jsPsych.randomization.sampleWithReplacement([1,2],1)[0]
coinFlip = jsPsych.randomization.sampleWithReplacement([true, false],1)[0]
if (coinFlip){
ans += ansDiff
} else {
ans -= ansDiff
}
if (ans<0){
ans += 2*ansDiff //ensuring no negative incorrect answers
}
}
return '
'+num1+operation+num2+' = '+ans+'
'
};
var prepare_prac_trial_type=function(trialArray, type){
var trial_variables = []
for(var i = 0; i < trialArray.length; i++){
var ld_var={...trialArray[i]}
ld_var.prac_trial_type=type
trial_variables.push(ld_var)
}
return trial_variables
}
// If the start condition is true,
// loop the given timeline collecting results with prac_trial_type: type
// After the timeline is run, a dialog is asking to repeat or continue
// the results of each run are stored in a node: {task: 'check_result', prac_trial_type: type}
// |startCondition|
// v
// |loop_node|
// v
// |timeline|... > |collectResults| > |choiceCondition|
// v
// |continue_choice|
var createLoopForTimeline=function(timeline, prac_trial_type, collectResults, startCondition, choiceCondition){
//Clone the list, so we don't change it
timeline=[...timeline]
// Collect the results in a data node after the trial was run
var check_result = {
type: 'html-keyboard-response',
choices: jsPsych.NO_KEYS,
stimulus: ' ',
trial_duration: 0,
on_condition:false,
data:function(){
return {
...collectResults(),
prac_trial_type: prac_trial_type,
task:'check_result',
practice_successful: practice_successful,
}
},
};
timeline.push(check_result, message_repeatPractice_fullDemo)
var continue_choice = {
type: 'html-button-response',
stimulus: message_progress,
choices: ['Wiederhole', 'Weiter >'],
data:{
prac_trial_type: prac_trial_type,
task:'choice',
}
}
continue_choice_if = {
timeline: [continue_choice],
conditional_function:function(){
var check_result=jsPsych.data.get().filter({task: 'check_result', prac_trial_type: prac_trial_type}).last(1).values()[0]
return choiceCondition(check_result)
}
}
timeline.push(continue_choice_if)
loop_node = {
timeline: timeline,
loop_function: function(){
var choice_trial = jsPsych.data.get().filter({prac_trial_type: prac_trial_type, task:'choice',}).last(1)
};
return {
timeline: [loop_node],
on_timeline_start: function (){
practice_successful = false
practice_count=0;
},
conditional_function: startCondition
}
}
//End functions
var showLetter = {
type: 'html-keyboard-response',
stimulus: function(){
return '
'+ selection[letterTrial] +'
'
},
choices: jsPsych.NO_KEYS,
trial_duration: 800,
on_finish: function(){
letterTrial += 1
item_type = jsPsych.timelineVariable('itemtype');
prac_trial_type = jsPsych.timelineVariable('prac_trial_type');
condition = jsPsych.timelineVariable('condition');
itemID = jsPsych.timelineVariable('itemID');
item = jsPsych.timelineVariable('item');
list = CONDITION
block = loadType
}
};
var showWordpairs = {
type: "html-button-response",
stimulus: function() {
var wordpairs = []
wordpairs[0] = '
' + jsPsych.timelineVariable('N1') + ' + ' + jsPsych.timelineVariable('verb') + " = OK?
"
wordpairs[1] = '
' + jsPsych.timelineVariable('N2') + " + " + jsPsych.timelineVariable('verb') + " = OK?
"
wordpairs[2] = '
' + jsPsych.timelineVariable('N3') + " + " + jsPsych.timelineVariable('verb') + " = OK?
"
var wordpairs_resampled = jsPsych.randomization.sampleWithoutReplacement(wordpairs, 3)
var string = ""
for(var i = 0; i < wordpairs_resampled.length; i++){
string += wordpairs_resampled[i]
}
return string;
},
stimulus_duration: 4000,
choices: ['Ja', 'Nein'],
prompt: "
Können alle Nomen mit dem Verb einen Satz bilden?
",data: {
task: 'lingLoad',
trialtype: 'load',
item_type: jsPsych.timelineVariable('itemtype'),
correct_response: jsPsych.timelineVariable('correct_response'),
prac_trial_type: jsPsych.timelineVariable('prac_trial_type'),
condition: jsPsych.timelineVariable('condition'),
itemID: jsPsych.timelineVariable('itemID'),
item: jsPsych.timelineVariable('item')
},
on_finish: function(data){
var acc = 0;
if(data.correct_response == data.response){
acc = 1;
nLoadAcc+=1
}
data.accuracy = acc
data.block = loadType
data.list = CONDITION
}
};
var showMathtask_demo = {
type: 'html-button-operationspan',
equation_accuracy: function(){
nCogLoadDemo +=1
if (nCogLoadDemo==1){
eqCorrect = true
} else if (nCogLoadDemo==2){
eqCorrect = false
} else {
eqCorrect = jsPsych.randomization.sampleWithReplacement([true, false], 1)[0]
}
return eqCorrect
},
stimulus: function(){
return function_opLoad(eqCorrect)
},
data: function(){
return {
task: 'mathLoad',
item_type: jsPsych.timelineVariable('itemtype'),
prac_trial_type: jsPsych.timelineVariable('prac_trial_type'),
block: loadType
}
},
prompt: "
Ist die Gleichung korrekt?
",
choices: ["Ja", "Nein"],
on_finish: function(){
var acc = jsPsych.data.get().last(1).values()[0].accuracy;
if (acc==1){
nLoadAcc+=1
}
}
};
var showMathtask_test = {
type: 'html-button-operationspan',
equation_accuracy: function(){
eqCorrect = jsPsych.randomization.sampleWithReplacement([true, false], 1)[0]
return eqCorrect
},
stimulus: function(){
return function_opLoad(eqCorrect)
},
data: function(){
return {
task: 'mathLoad',
trialtype: 'load',
item_type: jsPsych.timelineVariable('itemtype'),
prac_trial_type: jsPsych.timelineVariable('prac_trial_type'),
block: loadType
}
},
trial_duration:6000,
prompt: "
Ist die Gleichung korrekt?
",
choices: ["Ja", "Nein"],
on_finish: function(){
var acc = jsPsych.data.get().last(1).values()[0].accuracy;
if (acc==1){
nLoadAcc+=1
}
}
};
var recall = {
type: 'operation-span-recall',
choices: ['Kustuta', 'Edasi'],
correct_order: function(){
return selection
},
data: function(){
return {
set_size: selection.length,
task: 'recall',
item_type: item_type,
prac_trial_type: prac_trial_type,
condition: condition,
itemID : itemID,
item: item,
list: list,
block: block
}
},
on_finish: function(){
nLetters = selection.length
nLettersRecalled = jsPsych.data.get().last(1).values()[0].accuracy;
//console.log("samplesize: ", nLetters)
//console.log("lettersSelected: ", selection)
}
};
//*************************************************************
//
// FIRST EXPERIMENTAL BLOCK
//
//-------------------------------------------------------------
var timeline = [];
var practice_successful = false;
var practice_count = 0;
var letterdemo_pracSuccess = false;
var conceptualdemo_pracSuccess = false;
var conceptualFulldemo_pracSuccess = false;
var mathdemo_pracSuccess = false;
var mathFulldemo_pracSuccess = false;
timeline.push(welcome, instructions)
letter_demoproc_tl = []
letter_demoproc_tl.push(letterdemo_instruction)
for(var i = decisionDemo_setSizes.length; i < setSizesFullDemo.length; i++){
var selection_update={
type: 'html-keyboard-response',
data:{
sampleSize:trialArrays[i].length,
},
choices: jsPsych.NO_KEYS,
stimulus: ' ',
trial_duration: 200,
on_condition:false,
on_start:function(trial){
selection = jsPsych.randomization.sampleWithoutReplacement(possibleLetters, trial.data.sampleSize)
letterTrial = 0
},
};
var letterdemo_variables = prepare_prac_trial_type(trialArrays[i], 'letterdemo')
//console.log(i)
//console.log(letterdemo_variables)
var letterdemo = {
timeline: [showLetter],
timeline_variables: letterdemo_variables,
};
letter_demoproc_tl.push(selection_update, letterdemo, recall, recall_feedback)
//timeline.push(selection_update, letterdemo, recall, recall_feedback)
}
var letterdemo_check = {
type: 'html-keyboard-response',
choices: jsPsych.NO_KEYS,
stimulus: ' ',
trial_duration: 0,
on_condition:false,
on_start:function(trial){
var letterdemo_trials = setSizesFullDemo.length - decisionDemo_setSizes.length
var recall_pracs = jsPsych.data.get().filter({task: 'recall', prac_trial_type: 'letterdemo'}).last(letterdemo_trials);
if(recall_pracs.count()!=0){
var n_false = recall_pracs.filter({accuracy: 0}).count();
var prop_false = n_false/recall_pracs.count()
},
}
letter_demoproc_tl.push(letterdemo_check, message_repeatPractice_demo)
letter_demoproc_node = {
timeline: letter_demoproc_tl,
loop_function: function(){
return !practice_successful && practice_count < 2
},
on_timeline_start: function() {
practice_count++;
},
}
timeline.push(letter_demoproc_node)
var nConceptualDecinAcc = 0
conceptualLoad_demoproc_tl = [conceptualLoad_instruction];
for(var i = 0; i < decisionDemo_setSizes.length; i++){
var conceptualdemo_variables = prepare_prac_trial_type(trialArrays[i],'conceptualDemo')
//console.log("conceptual counter: ", i)
//console.log("variables: ", conceptualdemo_variables)
var conceptualDemo = {
timeline: [showWordpairs, load_feedback],
timeline_variables: conceptualdemo_variables,
};
conceptualLoad_demoproc_tl.push(conceptualDemo)
}
var conceptualdemo_check = {
type: 'html-keyboard-response',
choices: jsPsych.NO_KEYS,
stimulus: ' ',
trial_duration: 0,
on_condition:false,
on_start:function(trial){
var conceptualdemo_trials = 5
var recall_pracs = jsPsych.data.get().filter({prac_trial_type: 'conceptualDemo'}).last(conceptualdemo_trials);
if(recall_pracs.count()!=0){
var n_false = recall_pracs.filter({accuracy: 0}).count();
var prop_false = n_false/recall_pracs.count()
},
};
conceptualLoad_demoproc_tl.push(conceptualdemo_check, message_repeatPractice_demo)
conceptualLoad_demoproc_node = {
timeline: conceptualLoad_demoproc_tl,
loop_function: function(){
return !practice_successful && practice_count < 2
},
on_timeline_start: function() {
practice_count++;
},
};
var conceptual_demoproc_success = {
timeline: [conceptualLoad_demoproc_node],
on_timeline_start: function (){
practice_successful = false
practice_count=0;
},
conditional_function: function(){
return practice_successful
}
}
timeline.push(conceptual_demoproc_success)
conceptualLoad_fullDemo_proc_tl = [conceptualLoad_fullDemo_instruction];
for(var i = decisionDemo_setSizes.length; i < setSizesFullDemo.length; i++){
var selection_update={
type: 'html-keyboard-response',
data:{
sampleSize:trialArrays[i].length,
},
choices: jsPsych.NO_KEYS,
stimulus: ' ',
trial_duration: 200,
on_condition:false,
on_start:function(trial){
selection = jsPsych.randomization.sampleWithoutReplacement(possibleLetters, trial.data.sampleSize)
letterTrial = 0
},
};
var conceptual_fulldemo_variables = prepare_prac_trial_type(trialArrays[i], 'conceptual_fulldemo')
var conceptualLoad_fullDemo = {
timeline: [showWordpairs, showLetter],
timeline_variables: conceptual_fulldemo_variables,
};
conceptualLoad_fullDemo_proc_tl.push(selection_update, conceptualLoad_fullDemo, recall, fullDemo_feedback)
//timeline.push(selection_update, conceptualLoad_fullDemo, recall)
}
var conceptualLoad_fullDemo_check = {
type: 'html-keyboard-response',
choices: jsPsych.NO_KEYS,
stimulus: ' ',
trial_duration: 0,
on_condition:false,
data:function(){
var letterdemo_trials = setSizesFullDemo.length - decisionDemo_setSizes.length
var recalls = jsPsych.data.get().filter({task: 'recall', prac_trial_type: 'conceptual_fulldemo'}).last(letterdemo_trials);
var decins = jsPsych.data.get().filter({task: 'lingLoad', prac_trial_type: 'conceptual_fulldemo'}).last(5);
if(recalls.count()!=0){
var recalls_false = recalls.filter({accuracy: 0}).count();
var recalls_prop_false = recalls_false/recalls.count()
},
};
conceptualLoad_fullDemo_proc_tl.push(conceptualLoad_fullDemo_check, message_repeatPractice_fullDemo)
var conceptual_fullDemo_choice = {
type: 'html-button-response',
stimulus: message_progress,
choices: ['Wiederhole', 'Weiter >'],
data:{
prac_trial_type: 'conceptual_fulldemo',
task:'choice',
}
}
conceptualLoad_fullDemo_if = {
timeline: [conceptual_fullDemo_choice],
conditional_function:function(){
result=jsPsych.data.get().filter({task: 'check_result', prac_trial_type: 'conceptual_fulldemo'}).last(1).values()[0]
}
}
conceptualLoad_fullDemo_proc_tl.push(conceptualLoad_fullDemo_if)
conceptualLoad_fullDemo_proc_node = {
timeline: conceptualLoad_fullDemo_proc_tl,
loop_function: function(){
var choice_trial = jsPsych.data.get().filter({prac_trial_type: 'conceptual_fulldemo',task:'choice',}).last(1)
},
on_timeline_start: function() {
practice_count++;
},
};
var conceptualLoad_demoproc_success = {
timeline: [conceptualLoad_fullDemo_proc_node],
on_timeline_start: function (){
practice_successful = false
practice_count=0;
},
conditional_function: function(){
return practice_successful
}
}
timeline.push(conceptualLoad_demoproc_success)
var memtest_conceptualLoad_proc = [warning_firstblock];
for(var i = setSizesFullDemo.length; i < trialArrays.length; i++){
var selection_update={
type: 'html-keyboard-response',
data:{
sampleSize:trialArrays[i].length,
},
choices: jsPsych.NO_KEYS,
stimulus: ' ',
trial_duration: 200,
on_condition:false,
on_start:function(trial){
selection = jsPsych.randomization.sampleWithoutReplacement(possibleLetters, trial.data.sampleSize)
letterTrial = 0
},
};
var memtest_conceptualLoad = {
timeline: [showWordpairs, showLetter],
timeline_variables: trialArrays[i]
};
memtest_conceptualLoad_proc.push(selection_update, memtest_conceptualLoad, recall)
if ((i-setSizesFullDemo.length) % 4 == 3 && i < trialArrays.length){
memtest_conceptualLoad_proc.push(interim_summary)
}
//timeline.push(selection_update, memtest_conceptualLoad, recall)
}
var memtest_conceptualLoad_if = {
timeline: [...memtest_conceptualLoad_proc, debrief_firstblock],
conditional_function:function(){
return practice_successful
}
}
timeline.push(memtest_conceptualLoad_if)
//timeline.push(debrief_firstblock)
//*************************************************************
//
// SECOND EXPERIMENTAL BLOCK
//
//--------------------------------------------------------------
//timeline.push(mathLoad_instruction)
var nCogLoadDemo = 0
var mathLoad_demoproc_tl = [mathLoad_instruction]
for(var i = 0; i < decisionDemo_setSizes.length; i++){
var variables= prepare_prac_trial_type(trialArrays[i], 'mathLoad_demoproc')
var mathLoad_demo = {
timeline: [showMathtask_demo, load_feedback],
timeline_variables: variables,
}
mathLoad_demoproc_tl.push(mathLoad_demo)
}
var mathLoad_demoproc_check = {
type: 'html-keyboard-response',
choices: jsPsych.NO_KEYS,
stimulus: ' ',
trial_duration: 0,
on_condition:false,
data:function(){
var conceptualdemo_trials = 5
var recall_pracs = jsPsych.data.get().filter({prac_trial_type: 'mathLoad_demoproc'}).last(conceptualdemo_trials);
if(recall_pracs.count()!=0){
var n_false = recall_pracs.filter({accuracy: 0}).count();
var prop_false = n_false/recall_pracs.count()
},
};
mathLoad_demoproc_tl.push(mathLoad_demoproc_check, message_repeatPractice_demo)
mathLoad_demoproc_node = {
timeline: mathLoad_demoproc_tl,
loop_function: function(){
var choice_trial = jsPsych.data.get().filter({prac_trial_type: 'mathLoad_demoproc', task:'choice',}).last(1)
},
on_timeline_start: function() {
practice_count++;
},
};
var mathLoad_demoproc_pre = {
timeline: [mathLoad_demoproc_node],
on_timeline_start: function (){
practice_successful = false
practice_count=0;
},
conditional_function:function(){
return practice_successful
},
}
timeline.push(mathLoad_demoproc_pre)
var mathLoad_fullDemo_proc_tl = [mathLoad_fullDemo_instruction]
for(var i = decisionDemo_setSizes.length; i < setSizesFullDemo.length; i++){
var selection_update={
type: 'html-keyboard-response',
data:{
sampleSize:trialArrays[i].length,
},
choices: jsPsych.NO_KEYS,
stimulus: ' ',
trial_duration: 200,
on_condition:false,
on_start:function(trial){
selection = jsPsych.randomization.sampleWithoutReplacement(possibleLetters, trial.data.sampleSize)
letterTrial = 0
},
};
var variables = prepare_prac_trial_type(trialArrays[i], 'mathLoad_fullDemo')
var mathLoad_fullDemo = {
timeline: [showMathtask_demo, showLetter],
timeline_variables: variables,
};
mathLoad_fullDemo_proc_tl.push(selection_update, mathLoad_fullDemo, recall, fullDemo_feedback)
}
var mathLoad_fullDemo_collect=function(){
//collectResults
var trials = setSizesFullDemo.length - decisionDemo_setSizes.length
var recalls = jsPsych.data.get().filter({task: 'recall', prac_trial_type: 'mathLoad_fullDemo'}).last(trials);
var decins = jsPsych.data.get().filter({task: 'mathLoad', prac_trial_type: 'mathLoad_fullDemo'}).last(5);
if(recalls.count()!=0){
var recalls_false = recalls.filter({accuracy: 0}).count();
var recalls_prop_false = recalls_false/recalls.count()
}
if(decins.count()!=0){
var decins_false = decins.filter({accuracy: 0}).count();
var decins_prop_false = decins_false/decins.count()
}
practice_successful = recalls_successful || decins_successful
return {
recalls_successful: recalls_successful,
decins_successful: decins_successful,
practice_successful: practice_successful,
}
}
var mathLoad_fullDemo = createLoopForTimeline(
mathLoad_fullDemo_proc_tl,
'mathLoad_fullDemo',
mathLoad_fullDemo_collect,
function(){
//startCondition
return practice_successful
},
function(result){
//choiceCondition
return result.recalls_successful != result.decins_successful
}
)
timeline.push(mathLoad_fullDemo)
var memtest_mathLoad_proc = [warning_secondblock];
for(var i = setSizesFullDemo.length; i < trialArrays.length; i++){
var selection_update={
type: 'html-keyboard-response',
data:{
sampleSize:trialArrays[i].length,
},
choices: jsPsych.NO_KEYS,
stimulus: ' ',
trial_duration: 200,
on_condition:false,
on_start:function(trial){
selection = jsPsych.randomization.sampleWithoutReplacement(possibleLetters, trial.data.sampleSize)
letterTrial = 0
},
}
var memtest_mathLoad = {
timeline: [showMathtask_test, showLetter],
timeline_variables: trialArrays[i]
};
memtest_mathLoad_proc.push(selection_update, memtest_mathLoad, recall)
if ((i-setSizesFullDemo.length) % 4 == 3 && i < trialArrays.length){
memtest_mathLoad_proc.push(interim_summary)
};
};
memtest_mathLoad_proc_if = {
timeline: [...memtest_mathLoad_proc, debrief_secondblock, debrief_final, conclusion],
conditional_function:function(){
return practice_successful
}
}
timeline.push(memtest_mathLoad_proc_if)
var terminate_experiment = {
type: 'html-keyboard-response',
stimulus: message_termination,
//choices: jsPsych.NO_KEYS,
}
var terminate_experiment_if = {
timeline: [terminate_experiment],
conditional_function:function(){
return !practice_successful
}
}
timeline.push(terminate_experiment_if)
// timeline.push(conclusion)
//-------------------------------------------------------------------
//
// Initializing the experiment
//
//-------------------------------------------------------------------
jsPsych.init({
timeline: timeline,
//experiment_width: 900,ˇ
show_progress_bar: true,
message_progress_bar: 'Fortschritt',
});
****************************************************** End code
Beta Was this translation helpful? Give feedback.
All reactions