From 3c8abc96f0443a01454ef4dd0c86dd348f7abd36 Mon Sep 17 00:00:00 2001 From: HSINYUAN CHEN Date: Mon, 7 Dec 2020 17:08:22 +0800 Subject: [PATCH] move coder component move the coder from top to bottom --- IncorrectStopEXP.psyexp | 34 +++++++++--------- IncorrectStopEXP_lastrun.py | 36 +++++++++---------- html/IncorrectStopEXP-legacy-browsers.js | 46 ++++++++++++------------ html/IncorrectStopEXP.js | 46 ++++++++++++------------ 4 files changed, 81 insertions(+), 81 deletions(-) diff --git a/IncorrectStopEXP.psyexp b/IncorrectStopEXP.psyexp index 7196b80..e058789 100644 --- a/IncorrectStopEXP.psyexp +++ b/IncorrectStopEXP.psyexp @@ -35,23 +35,6 @@ - - - - - - - - - - - - - - - - - @@ -94,6 +77,23 @@ + + + + + + + + + + + + + + + + + diff --git a/IncorrectStopEXP_lastrun.py b/IncorrectStopEXP_lastrun.py index 20c28c0..34ede9b 100644 --- a/IncorrectStopEXP_lastrun.py +++ b/IncorrectStopEXP_lastrun.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ This experiment was created using PsychoPy3 Experiment Builder (v2020.2.8), - on Mon Dec 7 17:02:05 2020 + on Mon Dec 7 17:06:28 2020 If you publish work using this script the most relevant publication is: Peirce J, Gray JR, Simpson S, MacAskill M, Höchenberger R, Sogo H, Kastman E, Lindeløv JK. (2019) @@ -99,7 +99,7 @@ word = visual.TextStim(win=win, name='word', pos=[0, 0], height=0.2, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', - depth=-1.0); + depth=0.0); resp = keyboard.Keyboard() # Initialize components for Routine "thanks" @@ -244,13 +244,13 @@ for thisTrials2 in trials2: # ------Prepare to start Routine "trial"------- continueRoutine = True # update component parameters for each repeat - if trials1.thisN == 0: - number_correct = 0 word.setColor(letterColor, colorSpace='rgb') word.setText(text) resp.keys = [] resp.rt = [] _resp_allKeys = [] + if trials1.thisN == 0: + number_correct = 0 # keep track of which components have finished trialComponents = [word, resp] for thisComponent in trialComponents: @@ -332,20 +332,6 @@ for thisTrials2 in trials2: for thisComponent in trialComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) - if resp.corr: - number_correct = number_correct + 1 - print('Correct: ' + str(number_correct)) - else: - print('Not correct') - - if trials1.thisN + 1 == trials1.nTotal: - if number_correct/(trials1.nTotal + 1) >= 0.5: - trials2.finished = True - print('Finished.') - else: - print('Score: ' + str(number_correct/(trials1.nTotal + 1))) - else: - print('Trial: ' + str(trials1.thisN)) trials1.addData('word.started', word.tStartRefresh) trials1.addData('word.stopped', word.tStopRefresh) # check responses @@ -363,6 +349,20 @@ for thisTrials2 in trials2: trials1.addData('resp.rt', resp.rt) trials1.addData('resp.started', resp.tStartRefresh) trials1.addData('resp.stopped', resp.tStopRefresh) + if resp.corr: + number_correct = number_correct + 1 + print('Correct: ' + str(number_correct)) + else: + print('Not correct') + + if trials1.thisN + 1 == trials1.nTotal: + if number_correct/(trials1.nTotal + 1) >= 0.85: + trials2.finished = True + print('Finished.') + else: + print('Score: ' + str(number_correct/(trials1.nTotal + 1))) + else: + print('Trial: ' + str(trials1.thisN)) # the Routine "trial" was not non-slip safe, so reset the non-slip timer routineTimer.reset() thisExp.nextEntry() diff --git a/html/IncorrectStopEXP-legacy-browsers.js b/html/IncorrectStopEXP-legacy-browsers.js index 993a89e..ea2dcfe 100644 --- a/html/IncorrectStopEXP-legacy-browsers.js +++ b/html/IncorrectStopEXP-legacy-browsers.js @@ -110,7 +110,7 @@ function experimentInit() { units: undefined, pos: [0, 0], height: 0.2, wrapWidth: undefined, ori: 0, color: new util.Color('white'), opacity: 1, - depth: -1.0 + depth: 0.0 }); resp = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true}); @@ -328,8 +328,8 @@ function instructRoutineEnd(snapshot) { } -var number_correct; var _resp_allKeys; +var number_correct; var trialComponents; function trialRoutineBegin(snapshot) { return function () { @@ -338,15 +338,15 @@ function trialRoutineBegin(snapshot) { trialClock.reset(); // clock frameN = -1; // update component parameters for each repeat - if ((trials1.thisN === 0)) { - number_correct = 0; - } - word.setColor(new util.Color(letterColor)); word.setText(text); resp.keys = undefined; resp.rt = undefined; _resp_allKeys = []; + if ((trials1.thisN === 0)) { + number_correct = 0; + } + // keep track of which components have finished trialComponents = []; trialComponents.push(word); @@ -447,23 +447,6 @@ function trialRoutineEnd(snapshot) { thisComponent.setAutoDraw(false); } }); - if (resp.corr) { - number_correct = (number_correct + 1); - console.log(("Correct: " + number_correct.toString())); - } else { - console.log("Not correct"); - } - if (((trials1.thisN + 1) === trials1.nTotal)) { - if (((number_correct / (trials1.nTotal + 1)) >= 0.5)) { - trials2.finished = true; - console.log("Finished."); - } else { - console.log(("Score: " + (number_correct / (trials1.nTotal + 1)).toString())); - } - } else { - console.log(("Trial: " + trials1.thisN.toString())); - } - // was no response the correct answer?! if (resp.keys === undefined) { if (['None','none',undefined].includes(corrAns)) { @@ -481,6 +464,23 @@ function trialRoutineEnd(snapshot) { } resp.stop(); + if (resp.corr) { + number_correct = (number_correct + 1); + console.log(("Correct: " + number_correct.toString())); + } else { + console.log("Not correct"); + } + if (((trials1.thisN + 1) === trials1.nTotal)) { + if (((number_correct / (trials1.nTotal + 1)) >= 0.85)) { + trials2.finished = true; + console.log("Finished."); + } else { + console.log(("Score: " + (number_correct / (trials1.nTotal + 1)).toString())); + } + } else { + console.log(("Trial: " + trials1.thisN.toString())); + } + // the Routine "trial" was not non-slip safe, so reset the non-slip timer routineTimer.reset(); diff --git a/html/IncorrectStopEXP.js b/html/IncorrectStopEXP.js index 3b9d5b2..f88f376 100644 --- a/html/IncorrectStopEXP.js +++ b/html/IncorrectStopEXP.js @@ -121,7 +121,7 @@ function experimentInit() { units: undefined, pos: [0, 0], height: 0.2, wrapWidth: undefined, ori: 0, color: new util.Color('white'), opacity: 1, - depth: -1.0 + depth: 0.0 }); resp = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true}); @@ -336,8 +336,8 @@ function instructRoutineEnd(snapshot) { } -var number_correct; var _resp_allKeys; +var number_correct; var trialComponents; function trialRoutineBegin(snapshot) { return function () { @@ -346,15 +346,15 @@ function trialRoutineBegin(snapshot) { trialClock.reset(); // clock frameN = -1; // update component parameters for each repeat - if ((trials1.thisN === 0)) { - number_correct = 0; - } - word.setColor(new util.Color(letterColor)); word.setText(text); resp.keys = undefined; resp.rt = undefined; _resp_allKeys = []; + if ((trials1.thisN === 0)) { + number_correct = 0; + } + // keep track of which components have finished trialComponents = []; trialComponents.push(word); @@ -454,23 +454,6 @@ function trialRoutineEnd(snapshot) { thisComponent.setAutoDraw(false); } } - if (resp.corr) { - number_correct = (number_correct + 1); - console.log(("Correct: " + number_correct.toString())); - } else { - console.log("Not correct"); - } - if (((trials1.thisN + 1) === trials1.nTotal)) { - if (((number_correct / (trials1.nTotal + 1)) >= 0.5)) { - trials2.finished = true; - console.log("Finished."); - } else { - console.log(("Score: " + (number_correct / (trials1.nTotal + 1)).toString())); - } - } else { - console.log(("Trial: " + trials1.thisN.toString())); - } - // was no response the correct answer?! if (resp.keys === undefined) { if (['None','none',undefined].includes(corrAns)) { @@ -488,6 +471,23 @@ function trialRoutineEnd(snapshot) { } resp.stop(); + if (resp.corr) { + number_correct = (number_correct + 1); + console.log(("Correct: " + number_correct.toString())); + } else { + console.log("Not correct"); + } + if (((trials1.thisN + 1) === trials1.nTotal)) { + if (((number_correct / (trials1.nTotal + 1)) >= 0.85)) { + trials2.finished = true; + console.log("Finished."); + } else { + console.log(("Score: " + (number_correct / (trials1.nTotal + 1)).toString())); + } + } else { + console.log(("Trial: " + trials1.thisN.toString())); + } + // the Routine "trial" was not non-slip safe, so reset the non-slip timer routineTimer.reset(); -- 2.18.1