Commit ecdb25f6 authored by yangyishu's avatar yangyishu

gg

parent d94c42ef
participant,session,date,expName,psychopyVersion,frameRate,
1.1199 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use ['sounddevice', 'PTB', 'pyo', 'pygame'] (in that order).
4.9436 WARNING User requested fullscreen with size [1536 960], but screen is actually [1920, 1080]. Using actual size
9.2275 EXP Created window1 = Window(allowGUI=False, allowStencil=False, autoLog=True, backendConf=UNKNOWN, bitsMode=UNKNOWN, blendMode='avg', bpc=(8, 8, 8), color=array([-1, -1, -1]), colorSpace='rgb', depthBits=8, fullscr=<method-wrapper '__getattribute__' of attributeSetter object at 0x000001F778FAC0F0>, gamma=None, gammaErrorPolicy='raise', lms=UNKNOWN, monitor=<psychopy.monitors.calibTools.Monitor object at 0x000001F778FF8710>, multiSample=False, name='window1', numSamples=2, pos=[0.0, 0.0], screen=0, size=array([1920, 1080]), stencilBits=0, stereo=False, units='height', useFBO=True, useRetina=False, viewOri=0.0, viewPos=None, viewScale=None, waitBlanking=True, winType='pyglet')
9.2282 EXP window1: mouseVisible = True
9.2283 EXP window1: recordFrameIntervals = False
9.3927 EXP window1: recordFrameIntervals = True
9.5767 EXP window1: recordFrameIntervals = False
9.8129 EXP Created webcamWarning = TextStim(__class__=<class 'psychopy.visual.text.TextStim'>, alignHoriz=method-wrapper(...), alignText='center', alignVert=method-wrapper(...), anchorHoriz='center', anchorVert='center', antialias=True, autoLog=True, bold=False, color=array([1, 1, 1]), colorSpace='rgb', contrast=1.0, depth=-1.0, flipHoriz=False, flipVert=False, font='Arial', fontFiles=[], height=0.05, italic=False, languageStyle='LTR', name='webcamWarning', opacity=1, ori=0.0, pos=array([0., 0.]), rgb=UNKNOWN, text=str(...), units='height', win=Window(...), wrapWidth=1)
9.8214 EXP Created instruction1Txt = TextStim(__class__=<class 'psychopy.visual.text.TextStim'>, alignHoriz=method-wrapper(...), alignText='center', alignVert=method-wrapper(...), anchorHoriz='center', anchorVert='center', antialias=True, autoLog=True, bold=False, color=array([1, 1, 1]), colorSpace='rgb', contrast=1.0, depth=-1.0, flipHoriz=False, flipVert=False, font='Arial', fontFiles=[], height=0.05, italic=False, languageStyle='LTR', name='instruction1Txt', opacity=1, ori=0.0, pos=array([0., 0.]), rgb=UNKNOWN, text=str(...), units='height', win=Window(...), wrapWidth=1)
9.8481 EXP Created calibrationTxt = TextStim(__class__=<class 'psychopy.visual.text.TextStim'>, alignHoriz=method-wrapper(...), alignText='center', alignVert=method-wrapper(...), anchorHoriz='center', anchorVert='center', antialias=True, autoLog=True, bold=False, color=array([1, 1, 1]), colorSpace='rgb', contrast=1.0, depth=0.0, flipHoriz=False, flipVert=False, font='Arial', fontFiles=[], height=0.05, italic=False, languageStyle='LTR', name='calibrationTxt', opacity=1, ori=0.0, pos=array([0., 0.]), rgb=UNKNOWN, text=str(...), units='height', win=Window(...), wrapWidth=1)
9.8482 EXP window1: mouseVisible = True
9.8509 EXP Created calibration_square = Rect(__class__=<class 'psychopy.visual.rect.Rect'>, autoDraw=False, autoLog=True, closeShape=True, color=method-wrapper(...), colorSpace='rgb', contrast=None, depth=-1.0, fillColor=array([1, 1, 1]), fillColorSpace='rgb', fillRGB=UNKNOWN, interpolate=True, lineColor=array([1, 1, 1]), lineColorSpace='rgb', lineRGB=UNKNOWN, lineWidth=1.0, name='calibration_square', opacity=1, ori=0.0, pos=array([0., 0.]), size=array([0.02, 0.02]), units='height', vertices=ndarray(...), win=Window(...))
9.8510 EXP window1: mouseVisible = True
9.8523 EXP Created polygon = ShapeStim(__class__=<class 'psychopy.visual.shape.ShapeStim'>, autoDraw=False, autoLog=True, closeShape=True, color=method-wrapper(...), colorSpace='rgb', contrast=None, depth=-1.0, fillColor=array([1, 1, 1]), fillColorSpace='rgb', fillRGB=UNKNOWN, interpolate=True, lineColor=array([1, 1, 1]), lineColorSpace='rgb', lineRGB=UNKNOWN, lineWidth=1.0, name='polygon', opacity=1, ori=0.0, pos=array([0., 0.]), size=array([1., 1.]), units='height', vertices=ndarray(...), win=Window(...), windingRule=None)
9.8533 EXP Created tracking_square = Rect(__class__=<class 'psychopy.visual.rect.Rect'>, autoDraw=False, autoLog=True, closeShape=True, color=method-wrapper(...), colorSpace='rgb', contrast=None, depth=-2.0, fillColor=array([1, 1, 1]), fillColorSpace='rgb', fillRGB=UNKNOWN, interpolate=True, lineColor=array([1, 1, 1]), lineColorSpace='rgb', lineRGB=UNKNOWN, lineWidth=1.0, name='tracking_square', opacity=1, ori=0.0, pos=array([0., 0.]), size=array([0.02, 0.02]), units='height', vertices=ndarray(...), win=Window(...))
9.8668 EXP Created trackingTxt = TextStim(__class__=<class 'psychopy.visual.text.TextStim'>, alignHoriz=method-wrapper(...), alignText='center', alignVert=method-wrapper(...), anchorHoriz='center', anchorVert='center', antialias=True, autoLog=True, bold=False, color=array([1, 1, 1]), colorSpace='rgb', contrast=1.0, depth=-3.0, flipHoriz=False, flipVert=False, font='Arial', fontFiles=[], height=0.05, italic=False, languageStyle='LTR', name='trackingTxt', opacity=1, ori=0.0, pos=array([0., 0.]), rgb=UNKNOWN, text=str(...), units='height', win=Window(...), wrapWidth=1)
9.8991 EXP webcamWarning: autoDraw = True
11.7167 DATA Keypress: space
13.8775 DATA Keypress: space
21.8251 DATA Keypress: space
22.0103 DATA Keypress: space
22.1913 DATA Keypress: space
37.0699 DATA Mouse: Left button down, pos=(1010,575)
37.1536 DATA Mouse: Left button up, pos=(1010,575)
38.2212 DATA Mouse: Left button down, pos=(986,527)
38.2869 DATA Mouse: Left button up, pos=(986,527)
38.3699 DATA Mouse: Left button down, pos=(986,527)
38.4358 DATA Mouse: Left button up, pos=(986,527)
38.4857 DATA Mouse: Left button down, pos=(986,527)
38.5695 DATA Mouse: Left button up, pos=(986,527)
38.6198 DATA Mouse: Left button down, pos=(986,527)
38.7026 DATA Mouse: Left button up, pos=(986,527)
39.2196 DATA Mouse: Left button down, pos=(1068,580)
39.2865 DATA Mouse: Left button up, pos=(1068,580)
39.3692 DATA Mouse: Left button down, pos=(1068,580)
39.4532 DATA Mouse: Left button up, pos=(1068,580)
40.2692 DATA Mouse: Left button down, pos=(736,484)
40.3520 DATA Mouse: Left button up, pos=(735,485)
41.2026 DATA Mouse: Left button down, pos=(737,506)
41.3348 DATA Mouse: Left button up, pos=(737,506)
42.0191 DATA Mouse: Left button down, pos=(645,440)
42.1347 DATA Mouse: Left button up, pos=(645,440)
42.6010 DATA Mouse: Left button down, pos=(685,366)
42.7346 DATA Mouse: Left button up, pos=(685,366)
43.1517 DATA Mouse: Left button down, pos=(846,304)
43.2691 DATA Mouse: Left button up, pos=(846,304)
50.0166 DATA Mouse: Left button down, pos=(908,311)
50.1491 DATA Mouse: Left button up, pos=(908,311)
51.8008 DATA Mouse: Left button down, pos=(854,630)
51.9154 DATA Mouse: Left button up, pos=(854,630)
54.8145 DATA Keypress: escape
57.4681 EXP window1: mouseVisible = True
......@@ -2,12 +2,6 @@
* Demo_Eye_Tracking2 Test *
***************************/
// store info about the experiment session:
let expName = 'demo_eye_tracking2'; // from the Builder filename that created this script
let expInfo = {'participant': '', 'session': '001'};
// Start code blocks for 'Before Experiment'
// init psychoJS:
const psychoJS = new PsychoJS({
debug: true
......@@ -20,6 +14,12 @@ psychoJS.openWindow({
units: 'height',
waitBlanking: true
});
// store info about the experiment session:
let expName = 'demo_eye_tracking2'; // from the Builder filename that created this script
let expInfo = {'participant': '', 'session': '001'};
// Start code blocks for 'Before Experiment'
// schedule the experiment:
psychoJS.schedule(psychoJS.gui.DlgFromDict({
dictionary: expInfo,
......@@ -43,7 +43,7 @@ flowScheduler.add(calibrationIntroRoutineBegin());
flowScheduler.add(calibrationIntroRoutineEachFrame());
flowScheduler.add(calibrationIntroRoutineEnd());
const trialsLoopScheduler = new Scheduler(psychoJS);
flowScheduler.add(trialsLoopBegin(trialsLoopScheduler));
flowScheduler.add(trialsLoopBegin, trialsLoopScheduler);
flowScheduler.add(trialsLoopScheduler);
flowScheduler.add(trialsLoopEnd);
flowScheduler.add(trackingTrialRoutineBegin());
......@@ -67,10 +67,10 @@ psychoJS.experimentLogger.setLevel(core.Logger.ServerLevel.EXP);
var frameDur;
async function updateInfo() {
function updateInfo() {
expInfo['date'] = util.MonotonicClock.getDateStr(); // add a simple timestamp
expInfo['expName'] = expName;
expInfo['psychopyVersion'] = '2021.2.3';
expInfo['psychopyVersion'] = '2021.1.4';
expInfo['OS'] = window.navigator.platform;
// store frame rate of monitor if we can measure it successfully
......@@ -99,12 +99,13 @@ var calibrationClock;
var calibration_square;
var calibrationClick;
var trackingTrialClock;
var polygon;
var tracking_square;
var trackingTxt;
var tracking_resp;
var globalClock;
var routineTimer;
async function experimentInit() {
function experimentInit() {
// Initialize components for Routine "initializeEyetracking"
initializeEyetrackingClock = new util.Clock();
//initialize params of the webgazer package (used for eye tracking)
......@@ -176,13 +177,22 @@ async function experimentInit() {
calibrationClick.mouseClock = new util.Clock();
// Initialize components for Routine "trackingTrial"
trackingTrialClock = new util.Clock();
polygon = new visual.ShapeStim ({
win: psychoJS.window, name: 'polygon',
vertices: [[-[(- 0.25), 0.3][0]/2.0, -[(- 0.25), 0.3][1]/2.0], [+[(- 0.25), 0.3][0]/2.0, -[(- 0.25), 0.3][1]/2.0], [0, [(- 0.25), 0.3][1]/2.0]],
ori: 0.0, pos: [0, 0],
lineWidth: 1.0, lineColor: new util.Color('white'),
fillColor: new util.Color('white'),
opacity: undefined, depth: -1, interpolate: true,
});
tracking_square = new visual.Rect ({
win: psychoJS.window, name: 'tracking_square',
width: [0.02, 0.02][0], height: [0.02, 0.02][1],
ori: 0.0, pos: [0, 0],
lineWidth: 1.0, lineColor: new util.Color('white'),
fillColor: new util.Color('white'),
opacity: undefined, depth: 0, interpolate: true,
opacity: undefined, depth: -2, interpolate: true,
});
trackingTxt = new visual.TextStim({
......@@ -193,7 +203,7 @@ async function experimentInit() {
units: undefined,
pos: [0, 0], height: 0.05, wrapWidth: undefined, ori: 0.0,
color: new util.Color('white'), opacity: undefined,
depth: -1.0
depth: -3.0
});
tracking_resp = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true});
......@@ -211,9 +221,7 @@ var frameN;
var continueRoutine;
var initializeEyetrackingComponents;
function initializeEyetrackingRoutineBegin(snapshot) {
return async function () {
TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
return function () {
//------Prepare to start Routine 'initializeEyetracking'-------
t = 0;
initializeEyetrackingClock.reset(); // clock
......@@ -254,8 +262,8 @@ function initializeEyetrackingRoutineBegin(snapshot) {
}
function initializeEyetrackingRoutineEachFrame() {
return async function () {
function initializeEyetrackingRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'initializeEyetracking'-------
// get current time
t = initializeEyetrackingClock.getTime();
......@@ -303,8 +311,8 @@ function initializeEyetrackingRoutineEachFrame() {
}
function initializeEyetrackingRoutineEnd() {
return async function () {
function initializeEyetrackingRoutineEnd(snapshot) {
return function () {
//------Ending Routine 'initializeEyetracking'-------
initializeEyetrackingComponents.forEach( function(thisComponent) {
if (typeof thisComponent.setAutoDraw === 'function') {
......@@ -322,9 +330,7 @@ function initializeEyetrackingRoutineEnd() {
var _inst1_resp_allKeys;
var inst1Components;
function inst1RoutineBegin(snapshot) {
return async function () {
TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
return function () {
//------Prepare to start Routine 'inst1'-------
t = 0;
inst1Clock.reset(); // clock
......@@ -350,8 +356,8 @@ function inst1RoutineBegin(snapshot) {
}
function inst1RoutineEachFrame() {
return async function () {
function inst1RoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'inst1'-------
// get current time
t = inst1Clock.getTime();
......@@ -418,8 +424,8 @@ function inst1RoutineEachFrame() {
}
function inst1RoutineEnd() {
return async function () {
function inst1RoutineEnd(snapshot) {
return function () {
//------Ending Routine 'inst1'-------
inst1Components.forEach( function(thisComponent) {
if (typeof thisComponent.setAutoDraw === 'function') {
......@@ -444,9 +450,7 @@ function inst1RoutineEnd() {
var gotValidClick;
var calibrationIntroComponents;
function calibrationIntroRoutineBegin(snapshot) {
return async function () {
TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
return function () {
//------Prepare to start Routine 'calibrationIntro'-------
t = 0;
calibrationIntroClock.reset(); // clock
......@@ -471,8 +475,8 @@ function calibrationIntroRoutineBegin(snapshot) {
var prevButtonState;
var _mouseButtons;
function calibrationIntroRoutineEachFrame() {
return async function () {
function calibrationIntroRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'calibrationIntro'-------
// get current time
t = calibrationIntroClock.getTime();
......@@ -536,15 +540,15 @@ function calibrationIntroRoutineEachFrame() {
var _mouseXYs;
function calibrationIntroRoutineEnd() {
return async function () {
function calibrationIntroRoutineEnd(snapshot) {
return function () {
//------Ending Routine 'calibrationIntro'-------
calibrationIntroComponents.forEach( function(thisComponent) {
if (typeof thisComponent.setAutoDraw === 'function') {
thisComponent.setAutoDraw(false);
}
});
// store data for psychoJS.experiment (ExperimentHandler)
// store data for thisExp (ExperimentHandler)
_mouseXYs = calibrationMouse.getPos();
_mouseButtons = calibrationMouse.getPressed();
psychoJS.experiment.addData('calibrationMouse.x', _mouseXYs[0]);
......@@ -562,38 +566,34 @@ function calibrationIntroRoutineEnd() {
var trials;
var currentLoop;
function trialsLoopBegin(trialsLoopScheduler, snapshot) {
return async function() {
TrialHandler.fromSnapshot(snapshot); // update internal variables (.thisN etc) of the loop
// set up handler to look after randomisation of conditions etc
trials = new TrialHandler({
psychoJS: psychoJS,
nReps: 1, method: TrialHandler.Method.RANDOM,
extraInfo: expInfo, originPath: undefined,
trialList: 'calibration_trials.xlsx',
seed: undefined, name: 'trials'
});
psychoJS.experiment.addLoop(trials); // add the loop to the experiment
currentLoop = trials; // we're now the current loop
// Schedule all the trials in the trialList:
trials.forEach(function() {
const snapshot = trials.getSnapshot();
trialsLoopScheduler.add(importConditions(snapshot));
trialsLoopScheduler.add(calibrationRoutineBegin(snapshot));
trialsLoopScheduler.add(calibrationRoutineEachFrame());
trialsLoopScheduler.add(calibrationRoutineEnd());
trialsLoopScheduler.add(endLoopIteration(trialsLoopScheduler, snapshot));
});
return Scheduler.Event.NEXT;
}
function trialsLoopBegin(trialsLoopScheduler) {
// set up handler to look after randomisation of conditions etc
trials = new TrialHandler({
psychoJS: psychoJS,
nReps: 1, method: TrialHandler.Method.RANDOM,
extraInfo: expInfo, originPath: undefined,
trialList: 'calibration_trials.xlsx',
seed: undefined, name: 'trials'
});
psychoJS.experiment.addLoop(trials); // add the loop to the experiment
currentLoop = trials; // we're now the current loop
// Schedule all the trials in the trialList:
trials.forEach(function() {
const snapshot = trials.getSnapshot();
trialsLoopScheduler.add(importConditions(snapshot));
trialsLoopScheduler.add(calibrationRoutineBegin(snapshot));
trialsLoopScheduler.add(calibrationRoutineEachFrame(snapshot));
trialsLoopScheduler.add(calibrationRoutineEnd(snapshot));
trialsLoopScheduler.add(endLoopIteration(trialsLoopScheduler, snapshot));
});
return Scheduler.Event.NEXT;
}
async function trialsLoopEnd() {
function trialsLoopEnd() {
psychoJS.experiment.removeLoop(trials);
return Scheduler.Event.NEXT;
......@@ -603,9 +603,7 @@ async function trialsLoopEnd() {
var callib_color;
var calibrationComponents;
function calibrationRoutineBegin(snapshot) {
return async function () {
TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
return function () {
//------Prepare to start Routine 'calibration'-------
t = 0;
calibrationClock.reset(); // clock
......@@ -645,8 +643,8 @@ function calibrationRoutineBegin(snapshot) {
var frameRemains;
function calibrationRoutineEachFrame() {
return async function () {
function calibrationRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'calibration'-------
// get current time
t = calibrationClock.getTime();
......@@ -758,15 +756,15 @@ function calibrationRoutineEachFrame() {
}
function calibrationRoutineEnd() {
return async function () {
function calibrationRoutineEnd(snapshot) {
return function () {
//------Ending Routine 'calibration'-------
calibrationComponents.forEach( function(thisComponent) {
if (typeof thisComponent.setAutoDraw === 'function') {
thisComponent.setAutoDraw(false);
}
});
// store data for psychoJS.experiment (ExperimentHandler)
// store data for thisExp (ExperimentHandler)
_mouseXYs = calibrationClick.getPos();
_mouseButtons = calibrationClick.getPressed();
psychoJS.experiment.addData('calibrationClick.x', _mouseXYs[0]);
......@@ -784,9 +782,7 @@ function calibrationRoutineEnd() {
var _tracking_resp_allKeys;
var trackingTrialComponents;
function trackingTrialRoutineBegin(snapshot) {
return async function () {
TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
return function () {
//------Prepare to start Routine 'trackingTrial'-------
t = 0;
trackingTrialClock.reset(); // clock
......@@ -804,6 +800,7 @@ function trackingTrialRoutineBegin(snapshot) {
document.getElementById('webgazerVideoFeed').style.display = 'none';
// keep track of which components have finished
trackingTrialComponents = [];
trackingTrialComponents.push(polygon);
trackingTrialComponents.push(tracking_square);
trackingTrialComponents.push(trackingTxt);
trackingTrialComponents.push(tracking_resp);
......@@ -817,14 +814,28 @@ function trackingTrialRoutineBegin(snapshot) {
}
function trackingTrialRoutineEachFrame() {
return async function () {
function trackingTrialRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'trackingTrial'-------
// get current time
t = trackingTrialClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
// update/draw components on each frame
// *polygon* updates
if (t >= 0.0 && polygon.status === PsychoJS.Status.NOT_STARTED) {
// keep track of start time/frame for later
polygon.tStart = t; // (not accounting for frame time here)
polygon.frameNStart = frameN; // exact frame index
polygon.setAutoDraw(true);
}
if (polygon.status === PsychoJS.Status.STARTED){ // only update if being drawn
polygon.setFillColor(new util.Color(thisCol), false);
}
// *tracking_square* updates
if (t >= 0.0 && tracking_square.status === PsychoJS.Status.NOT_STARTED) {
// keep track of start time/frame for later
......@@ -926,8 +937,8 @@ function trackingTrialRoutineEachFrame() {
}
function trackingTrialRoutineEnd() {
return async function () {
function trackingTrialRoutineEnd(snapshot) {
return function () {
//------Ending Routine 'trackingTrial'-------
trackingTrialComponents.forEach( function(thisComponent) {
if (typeof thisComponent.setAutoDraw === 'function') {
......@@ -951,7 +962,7 @@ function trackingTrialRoutineEnd() {
function endLoopIteration(scheduler, snapshot) {
// ------Prepare for next entry------
return async function () {
return function () {
if (typeof snapshot !== 'undefined') {
// ------Check if user ended loop early------
if (snapshot.finished) {
......@@ -973,14 +984,14 @@ function endLoopIteration(scheduler, snapshot) {
function importConditions(currentLoop) {
return async function () {
return function () {
psychoJS.importAttributes(currentLoop.getCurrentTrial());
return Scheduler.Event.NEXT;
};
}
async function quitPsychoJS(message, isCompleted) {
function quitPsychoJS(message, isCompleted) {
// Check for and save orphaned data
if (psychoJS.experiment.isEntryEmpty()) {
psychoJS.experiment.nextEntry();
......@@ -995,6 +1006,8 @@ async function quitPsychoJS(message, isCompleted) {
psychoJS.window.close();
psychoJS.quit({message: message, isCompleted: isCompleted});
......
......@@ -2,20 +2,17 @@
* Demo_Eye_Tracking2 Test *
***************************/
import { core, data, sound, util, visual } from './lib/psychojs-2021.2.3.js';
const { PsychoJS } = core;
const { TrialHandler } = data;
const { Scheduler } = util;
import { PsychoJS } from './lib/core-2021.1.4.js';
import * as core from './lib/core-2021.1.4.js';
import { TrialHandler } from './lib/data-2021.1.4.js';
import { Scheduler } from './lib/util-2021.1.4.js';
import * as visual from './lib/visual-2021.1.4.js';
import * as sound from './lib/sound-2021.1.4.js';
import * as util from './lib/util-2021.1.4.js';
//some handy aliases as in the psychopy scripts;
const { abs, sin, cos, PI: pi, sqrt } = Math;
const { round } = util;
// store info about the experiment session:
let expName = 'demo_eye_tracking2'; // from the Builder filename that created this script
let expInfo = {'participant': '', 'session': '001'};
// Start code blocks for 'Before Experiment'
// init psychoJS:
const psychoJS = new PsychoJS({
debug: true
......@@ -28,6 +25,12 @@ psychoJS.openWindow({
units: 'height',
waitBlanking: true
});
// store info about the experiment session:
let expName = 'demo_eye_tracking2'; // from the Builder filename that created this script
let expInfo = {'participant': '', 'session': '001'};
// Start code blocks for 'Before Experiment'
// schedule the experiment:
psychoJS.schedule(psychoJS.gui.DlgFromDict({
dictionary: expInfo,
......@@ -51,7 +54,7 @@ flowScheduler.add(calibrationIntroRoutineBegin());
flowScheduler.add(calibrationIntroRoutineEachFrame());
flowScheduler.add(calibrationIntroRoutineEnd());
const trialsLoopScheduler = new Scheduler(psychoJS);
flowScheduler.add(trialsLoopBegin(trialsLoopScheduler));
flowScheduler.add(trialsLoopBegin, trialsLoopScheduler);
flowScheduler.add(trialsLoopScheduler);
flowScheduler.add(trialsLoopEnd);
flowScheduler.add(trackingTrialRoutineBegin());
......@@ -75,10 +78,10 @@ psychoJS.experimentLogger.setLevel(core.Logger.ServerLevel.EXP);
var frameDur;
async function updateInfo() {
function updateInfo() {
expInfo['date'] = util.MonotonicClock.getDateStr(); // add a simple timestamp
expInfo['expName'] = expName;
expInfo['psychopyVersion'] = '2021.2.3';
expInfo['psychopyVersion'] = '2021.1.4';
expInfo['OS'] = window.navigator.platform;
// store frame rate of monitor if we can measure it successfully
......@@ -107,12 +110,13 @@ var calibrationClock;
var calibration_square;
var calibrationClick;
var trackingTrialClock;
var polygon;
var tracking_square;
var trackingTxt;
var tracking_resp;
var globalClock;
var routineTimer;
async function experimentInit() {
function experimentInit() {
// Initialize components for Routine "initializeEyetracking"
initializeEyetrackingClock = new util.Clock();
//initialize params of the webgazer package (used for eye tracking)
......@@ -184,13 +188,22 @@ async function experimentInit() {
calibrationClick.mouseClock = new util.Clock();
// Initialize components for Routine "trackingTrial"
trackingTrialClock = new util.Clock();
polygon = new visual.ShapeStim ({
win: psychoJS.window, name: 'polygon',
vertices: [[-[(- 0.25), 0.3][0]/2.0, -[(- 0.25), 0.3][1]/2.0], [+[(- 0.25), 0.3][0]/2.0, -[(- 0.25), 0.3][1]/2.0], [0, [(- 0.25), 0.3][1]/2.0]],
ori: 0.0, pos: [0, 0],
lineWidth: 1.0, lineColor: new util.Color('white'),
fillColor: new util.Color('white'),
opacity: undefined, depth: -1, interpolate: true,
});
tracking_square = new visual.Rect ({
win: psychoJS.window, name: 'tracking_square',
width: [0.02, 0.02][0], height: [0.02, 0.02][1],
ori: 0.0, pos: [0, 0],
lineWidth: 1.0, lineColor: new util.Color('white'),
fillColor: new util.Color('white'),
opacity: undefined, depth: 0, interpolate: true,
opacity: undefined, depth: -2, interpolate: true,
});
trackingTxt = new visual.TextStim({
......@@ -201,7 +214,7 @@ async function experimentInit() {
units: undefined,
pos: [0, 0], height: 0.05, wrapWidth: undefined, ori: 0.0,
color: new util.Color('white'), opacity: undefined,
depth: -1.0
depth: -3.0
});
tracking_resp = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true});
......@@ -219,9 +232,7 @@ var frameN;
var continueRoutine;
var initializeEyetrackingComponents;
function initializeEyetrackingRoutineBegin(snapshot) {
return async function () {
TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
return function () {
//------Prepare to start Routine 'initializeEyetracking'-------
t = 0;
initializeEyetrackingClock.reset(); // clock
......@@ -261,8 +272,8 @@ function initializeEyetrackingRoutineBegin(snapshot) {
}
function initializeEyetrackingRoutineEachFrame() {
return async function () {
function initializeEyetrackingRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'initializeEyetracking'-------
// get current time
t = initializeEyetrackingClock.getTime();
......@@ -310,8 +321,8 @@ function initializeEyetrackingRoutineEachFrame() {
}
function initializeEyetrackingRoutineEnd() {
return async function () {
function initializeEyetrackingRoutineEnd(snapshot) {
return function () {
//------Ending Routine 'initializeEyetracking'-------
for (const thisComponent of initializeEyetrackingComponents) {
if (typeof thisComponent.setAutoDraw === 'function') {
......@@ -329,9 +340,7 @@ function initializeEyetrackingRoutineEnd() {
var _inst1_resp_allKeys;
var inst1Components;
function inst1RoutineBegin(snapshot) {
return async function () {
TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
return function () {
//------Prepare to start Routine 'inst1'-------
t = 0;
inst1Clock.reset(); // clock
......@@ -356,8 +365,8 @@ function inst1RoutineBegin(snapshot) {
}
function inst1RoutineEachFrame() {
return async function () {
function inst1RoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'inst1'-------
// get current time
t = inst1Clock.getTime();
......@@ -424,8 +433,8 @@ function inst1RoutineEachFrame() {
}
function inst1RoutineEnd() {
return async function () {
function inst1RoutineEnd(snapshot) {
return function () {
//------Ending Routine 'inst1'-------
for (const thisComponent of inst1Components) {
if (typeof thisComponent.setAutoDraw === 'function') {
......@@ -450,9 +459,7 @@ function inst1RoutineEnd() {
var gotValidClick;
var calibrationIntroComponents;
function calibrationIntroRoutineBegin(snapshot) {
return async function () {
TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
return function () {
//------Prepare to start Routine 'calibrationIntro'-------
t = 0;
calibrationIntroClock.reset(); // clock
......@@ -476,8 +483,8 @@ function calibrationIntroRoutineBegin(snapshot) {
var prevButtonState;
var _mouseButtons;
function calibrationIntroRoutineEachFrame() {
return async function () {
function calibrationIntroRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'calibrationIntro'-------
// get current time
t = calibrationIntroClock.getTime();
......@@ -541,15 +548,15 @@ function calibrationIntroRoutineEachFrame() {
var _mouseXYs;
function calibrationIntroRoutineEnd() {
return async function () {
function calibrationIntroRoutineEnd(snapshot) {
return function () {
//------Ending Routine 'calibrationIntro'-------
for (const thisComponent of calibrationIntroComponents) {
if (typeof thisComponent.setAutoDraw === 'function') {
thisComponent.setAutoDraw(false);
}
}
// store data for psychoJS.experiment (ExperimentHandler)
// store data for thisExp (ExperimentHandler)
_mouseXYs = calibrationMouse.getPos();
_mouseButtons = calibrationMouse.getPressed();
psychoJS.experiment.addData('calibrationMouse.x', _mouseXYs[0]);
......@@ -567,37 +574,33 @@ function calibrationIntroRoutineEnd() {
var trials;
var currentLoop;
function trialsLoopBegin(trialsLoopScheduler, snapshot) {
return async function() {
TrialHandler.fromSnapshot(snapshot); // update internal variables (.thisN etc) of the loop
// set up handler to look after randomisation of conditions etc
trials = new TrialHandler({
psychoJS: psychoJS,
nReps: 1, method: TrialHandler.Method.RANDOM,
extraInfo: expInfo, originPath: undefined,
trialList: 'calibration_trials.xlsx',
seed: undefined, name: 'trials'
});
psychoJS.experiment.addLoop(trials); // add the loop to the experiment
currentLoop = trials; // we're now the current loop
// Schedule all the trials in the trialList:
for (const thisTrial of trials) {
const snapshot = trials.getSnapshot();
trialsLoopScheduler.add(importConditions(snapshot));
trialsLoopScheduler.add(calibrationRoutineBegin(snapshot));
trialsLoopScheduler.add(calibrationRoutineEachFrame());
trialsLoopScheduler.add(calibrationRoutineEnd());
trialsLoopScheduler.add(endLoopIteration(trialsLoopScheduler, snapshot));
}
return Scheduler.Event.NEXT;
function trialsLoopBegin(trialsLoopScheduler) {
// set up handler to look after randomisation of conditions etc
trials = new TrialHandler({
psychoJS: psychoJS,
nReps: 1, method: TrialHandler.Method.RANDOM,
extraInfo: expInfo, originPath: undefined,
trialList: 'calibration_trials.xlsx',
seed: undefined, name: 'trials'
});
psychoJS.experiment.addLoop(trials); // add the loop to the experiment
currentLoop = trials; // we're now the current loop
// Schedule all the trials in the trialList:
for (const thisTrial of trials) {
const snapshot = trials.getSnapshot();
trialsLoopScheduler.add(importConditions(snapshot));
trialsLoopScheduler.add(calibrationRoutineBegin(snapshot));
trialsLoopScheduler.add(calibrationRoutineEachFrame(snapshot));
trialsLoopScheduler.add(calibrationRoutineEnd(snapshot));
trialsLoopScheduler.add(endLoopIteration(trialsLoopScheduler, snapshot));
}
return Scheduler.Event.NEXT;
}
async function trialsLoopEnd() {
function trialsLoopEnd() {
psychoJS.experiment.removeLoop(trials);
return Scheduler.Event.NEXT;
......@@ -607,9 +610,7 @@ async function trialsLoopEnd() {
var callib_color;
var calibrationComponents;
function calibrationRoutineBegin(snapshot) {
return async function () {