Commit db8170f3 authored by Thomas Pronk's avatar Thomas Pronk

_

parent 83f6b162
......@@ -19,6 +19,7 @@ psychoJS.openWindow({
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,
......@@ -68,7 +69,7 @@ var frameDur;
function updateInfo() {
expInfo['date'] = util.MonotonicClock.getDateStr(); // add a simple timestamp
expInfo['expName'] = expName;
expInfo['psychopyVersion'] = '2020.2.5';
expInfo['psychopyVersion'] = '2021.1.4';
expInfo['OS'] = window.navigator.platform;
// store frame rate of monitor if we can measure it successfully
......@@ -197,6 +198,7 @@ function experimentInit() {
var t;
var frameN;
var continueRoutine;
var loading_trialComponents;
function loading_trialRoutineBegin(snapshot) {
return function () {
......@@ -204,6 +206,7 @@ function loading_trialRoutineBegin(snapshot) {
t = 0;
loading_trialClock.reset(); // clock
frameN = -1;
continueRoutine = true; // until we're told otherwise
// update component parameters for each repeat
// keep track of which components have finished
loading_trialComponents = [];
......@@ -213,19 +216,14 @@ function loading_trialRoutineBegin(snapshot) {
if ('status' in thisComponent)
thisComponent.status = PsychoJS.Status.NOT_STARTED;
});
// check if the Routine should terminate
if (!continueRoutine) { // a component has requested a forced-end of Routine
return Scheduler.Event.NEXT;
}
};
return Scheduler.Event.NEXT;
}
}
var continueRoutine;
function loading_trialRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'loading_trial'-------
let continueRoutine = true; // until we're told otherwise
// get current time
t = loading_trialClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
......@@ -292,11 +290,12 @@ function webcam_trialRoutineBegin(snapshot) {
t = 0;
webcam_trialClock.reset(); // clock
frameN = -1;
continueRoutine = true; // until we're told otherwise
// update component parameters for each repeat
// Show webcam thumbnail and face feedback box, but not face overlay and gaze dot
window.webgazer.params.showVideoPreview = true;
window.webgazer.params.showFaceFeedbackBox = true;
window.webgazer.params.showFaceOverlay = false;
window.webgazer.params.showFaceOverlay = true;
window.webgazer.params.showGazeDot = false
// Start eye tracking
window.webgazer
......@@ -321,18 +320,14 @@ function webcam_trialRoutineBegin(snapshot) {
if ('status' in thisComponent)
thisComponent.status = PsychoJS.Status.NOT_STARTED;
});
// check if the Routine should terminate
if (!continueRoutine) { // a component has requested a forced-end of Routine
return Scheduler.Event.NEXT;
}
};
return Scheduler.Event.NEXT;
}
}
function webcam_trialRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'webcam_trial'-------
let continueRoutine = true; // until we're told otherwise
// get current time
t = webcam_trialClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
......@@ -403,6 +398,7 @@ function intro_calibatrion_trialRoutineBegin(snapshot) {
t = 0;
intro_calibatrion_trialClock.reset(); // clock
frameN = -1;
continueRoutine = true; // until we're told otherwise
// update component parameters for each repeat
// setup some python lists for storing info about the mouse_2
gotValidClick = false; // until a click is received
......@@ -415,11 +411,8 @@ function intro_calibatrion_trialRoutineBegin(snapshot) {
if ('status' in thisComponent)
thisComponent.status = PsychoJS.Status.NOT_STARTED;
});
// check if the Routine should terminate
if (!continueRoutine) { // a component has requested a forced-end of Routine
return Scheduler.Event.NEXT;
}
};
return Scheduler.Event.NEXT;
}
}
......@@ -428,7 +421,6 @@ var _mouseButtons;
function intro_calibatrion_trialRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'intro_calibatrion_trial'-------
let continueRoutine = true; // until we're told otherwise
// get current time
t = intro_calibatrion_trialClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
......@@ -558,6 +550,7 @@ function calibration_trialRoutineBegin(snapshot) {
t = 0;
calibration_trialClock.reset(); // clock
frameN = -1;
continueRoutine = true; // until we're told otherwise
// update component parameters for each repeat
// setup some python lists for storing info about the mouse_3
mouse_3.clicked_name = [];
......@@ -583,18 +576,14 @@ function calibration_trialRoutineBegin(snapshot) {
if ('status' in thisComponent)
thisComponent.status = PsychoJS.Status.NOT_STARTED;
});
// check if the Routine should terminate
if (!continueRoutine) { // a component has requested a forced-end of Routine
return Scheduler.Event.NEXT;
}
};
return Scheduler.Event.NEXT;
}
}
function calibration_trialRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'calibration_trial'-------
let continueRoutine = true; // until we're told otherwise
// get current time
t = calibration_trialClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
......@@ -716,6 +705,7 @@ function tracking_trialRoutineBegin(snapshot) {
t = 0;
tracking_trialClock.reset(); // clock
frameN = -1;
continueRoutine = true; // until we're told otherwise
// update component parameters for each repeat
// Remove the click tracker used for calibration
window.webgazer.removeMouseEventListeners();
......@@ -727,18 +717,14 @@ function tracking_trialRoutineBegin(snapshot) {
if ('status' in thisComponent)
thisComponent.status = PsychoJS.Status.NOT_STARTED;
});
// check if the Routine should terminate
if (!continueRoutine) { // a component has requested a forced-end of Routine
return Scheduler.Event.NEXT;
}
};
return Scheduler.Event.NEXT;
}
}
function tracking_trialRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'tracking_trial'-------
let continueRoutine = true; // until we're told otherwise
// get current time
t = tracking_trialClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
......
......@@ -2,13 +2,13 @@
* Demo_Eye_Tracking2 Test *
***************************/
import { PsychoJS } from './lib/core-2020.2.js';
import * as core from './lib/core-2020.2.js';
import { TrialHandler } from './lib/data-2020.2.js';
import { Scheduler } from './lib/util-2020.2.js';
import * as visual from './lib/visual-2020.2.js';
import * as sound from './lib/sound-2020.2.js';
import * as util from './lib/util-2020.2.js';
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;
......@@ -30,6 +30,7 @@ psychoJS.openWindow({
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,
......@@ -79,7 +80,7 @@ var frameDur;
function updateInfo() {
expInfo['date'] = util.MonotonicClock.getDateStr(); // add a simple timestamp
expInfo['expName'] = expName;
expInfo['psychopyVersion'] = '2020.2.5';
expInfo['psychopyVersion'] = '2021.1.4';
expInfo['OS'] = window.navigator.platform;
// store frame rate of monitor if we can measure it successfully
......@@ -208,6 +209,7 @@ function experimentInit() {
var t;
var frameN;
var continueRoutine;
var loading_trialComponents;
function loading_trialRoutineBegin(snapshot) {
return function () {
......@@ -215,6 +217,7 @@ function loading_trialRoutineBegin(snapshot) {
t = 0;
loading_trialClock.reset(); // clock
frameN = -1;
continueRoutine = true; // until we're told otherwise
// update component parameters for each repeat
// keep track of which components have finished
loading_trialComponents = [];
......@@ -223,19 +226,14 @@ function loading_trialRoutineBegin(snapshot) {
for (const thisComponent of loading_trialComponents)
if ('status' in thisComponent)
thisComponent.status = PsychoJS.Status.NOT_STARTED;
// check if the Routine should terminate
if (!continueRoutine) { // a component has requested a forced-end of Routine
return Scheduler.Event.NEXT;
}
};
return Scheduler.Event.NEXT;
}
}
var continueRoutine;
function loading_trialRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'loading_trial'-------
let continueRoutine = true; // until we're told otherwise
// get current time
t = loading_trialClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
......@@ -302,11 +300,12 @@ function webcam_trialRoutineBegin(snapshot) {
t = 0;
webcam_trialClock.reset(); // clock
frameN = -1;
continueRoutine = true; // until we're told otherwise
// update component parameters for each repeat
// Show webcam thumbnail and face feedback box, but not face overlay and gaze dot
window.webgazer.params.showVideoPreview = true;
window.webgazer.params.showFaceFeedbackBox = true;
window.webgazer.params.showFaceOverlay = false;
window.webgazer.params.showFaceOverlay = true;
window.webgazer.params.showGazeDot = false
// Start eye tracking
window.webgazer
......@@ -330,18 +329,14 @@ function webcam_trialRoutineBegin(snapshot) {
for (const thisComponent of webcam_trialComponents)
if ('status' in thisComponent)
thisComponent.status = PsychoJS.Status.NOT_STARTED;
// check if the Routine should terminate
if (!continueRoutine) { // a component has requested a forced-end of Routine
return Scheduler.Event.NEXT;
}
};
return Scheduler.Event.NEXT;
}
}
function webcam_trialRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'webcam_trial'-------
let continueRoutine = true; // until we're told otherwise
// get current time
t = webcam_trialClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
......@@ -412,6 +407,7 @@ function intro_calibatrion_trialRoutineBegin(snapshot) {
t = 0;
intro_calibatrion_trialClock.reset(); // clock
frameN = -1;
continueRoutine = true; // until we're told otherwise
// update component parameters for each repeat
// setup some python lists for storing info about the mouse_2
gotValidClick = false; // until a click is received
......@@ -423,11 +419,8 @@ function intro_calibatrion_trialRoutineBegin(snapshot) {
for (const thisComponent of intro_calibatrion_trialComponents)
if ('status' in thisComponent)
thisComponent.status = PsychoJS.Status.NOT_STARTED;
// check if the Routine should terminate
if (!continueRoutine) { // a component has requested a forced-end of Routine
return Scheduler.Event.NEXT;
}
};
return Scheduler.Event.NEXT;
}
}
......@@ -436,7 +429,6 @@ var _mouseButtons;
function intro_calibatrion_trialRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'intro_calibatrion_trial'-------
let continueRoutine = true; // until we're told otherwise
// get current time
t = intro_calibatrion_trialClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
......@@ -565,6 +557,7 @@ function calibration_trialRoutineBegin(snapshot) {
t = 0;
calibration_trialClock.reset(); // clock
frameN = -1;
continueRoutine = true; // until we're told otherwise
// update component parameters for each repeat
// setup some python lists for storing info about the mouse_3
mouse_3.clicked_name = [];
......@@ -589,18 +582,14 @@ function calibration_trialRoutineBegin(snapshot) {
for (const thisComponent of calibration_trialComponents)
if ('status' in thisComponent)
thisComponent.status = PsychoJS.Status.NOT_STARTED;
// check if the Routine should terminate
if (!continueRoutine) { // a component has requested a forced-end of Routine
return Scheduler.Event.NEXT;
}
};
return Scheduler.Event.NEXT;
}
}
function calibration_trialRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'calibration_trial'-------
let continueRoutine = true; // until we're told otherwise
// get current time
t = calibration_trialClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
......@@ -722,6 +711,7 @@ function tracking_trialRoutineBegin(snapshot) {
t = 0;
tracking_trialClock.reset(); // clock
frameN = -1;
continueRoutine = true; // until we're told otherwise
// update component parameters for each repeat
// Remove the click tracker used for calibration
window.webgazer.removeMouseEventListeners();
......@@ -732,18 +722,14 @@ function tracking_trialRoutineBegin(snapshot) {
for (const thisComponent of tracking_trialComponents)
if ('status' in thisComponent)
thisComponent.status = PsychoJS.Status.NOT_STARTED;
// check if the Routine should terminate
if (!continueRoutine) { // a component has requested a forced-end of Routine
return Scheduler.Event.NEXT;
}
};
return Scheduler.Event.NEXT;
}
}
function tracking_trialRoutineEachFrame(snapshot) {
return function () {
//------Loop for each frame of Routine 'tracking_trial'-------
let continueRoutine = true; // until we're told otherwise
// get current time
t = tracking_trialClock.getTime();
frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
......
......@@ -8,7 +8,7 @@
<!-- styles -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">
<link rel="stylesheet" href="https://lib.pavlovia.org/psychojs-2020.2.css">
<link rel="stylesheet" href="https://lib.pavlovia.org/psychojs-2021.1.4.css">
</head>
<body>
......@@ -18,13 +18,13 @@
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/seedrandom/3.0.1/seedrandom.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/5.3.3/pixi.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/pixi.js-legacy@5.3.3/dist/pixi-legacy.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/PreloadJS/1.0.1/preloadjs.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.14.2/xlsx.full.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.16.7/xlsx.full.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/log4javascript/1.4.9/log4javascript.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.7.61/Tone.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.1.2/howler.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.2.1/howler.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pako/1.0.10/pako.min.js"></script>
<!-- experiment -->
......@@ -33,7 +33,7 @@
<!-- legacy browsers -->
<script nomodule type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.6.0/polyfill.min.js"></script>
<script nomodule type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/url-search-params/1.1.0/url-search-params.js"></script>
<script nomodule type="text/javascript" src="https://lib.pavlovia.org/psychojs-2020.2.js"></script>
<script nomodule type="text/javascript" src="https://lib.pavlovia.org/psychojs-2021.1.4.js"></script>
<script nomodule type="text/javascript" src="./demo_eye_tracking2-legacy-browsers.js"></script>
</body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment