Commit 17103c1f authored by Thomas Pronk's avatar Thomas Pronk

hide face overlay (now also in psyexp file)

parent 43c3094e
......@@ -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,6 +290,7 @@ 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;
......@@ -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,6 +300,7 @@ 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;
......@@ -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)
......
<?xml version="1.0" ?>
<PsychoPy2experiment encoding="utf-8" version="2020.2.4">
<PsychoPy2experiment encoding="utf-8" version="2021.1.4">
<Settings>
<Param name="Audio latency priority" updates="None" val="use prefs" valType="str"/>
<Param name="Audio lib" updates="None" val="use prefs" valType="str"/>
......@@ -54,6 +54,7 @@
<TextComponent name="loading_text">
<Param name="color" updates="constant" val="white" valType="str"/>
<Param name="colorSpace" updates="constant" val="rgb" valType="str"/>
<Param name="contrast" updates="constant" val="1" valType="num"/>
<Param name="disabled" updates="None" val="False" valType="bool"/>
<Param name="durationEstim" updates="None" val="" valType="code"/>
<Param name="flip" updates="constant" val="" valType="str"/>
......@@ -80,6 +81,7 @@
<TextComponent name="intro_text">
<Param name="color" updates="constant" val="white" valType="str"/>
<Param name="colorSpace" updates="constant" val="rgb" valType="str"/>
<Param name="contrast" updates="constant" val="1" valType="num"/>
<Param name="disabled" updates="None" val="False" valType="bool"/>
<Param name="durationEstim" updates="None" val="" valType="code"/>
<Param name="flip" updates="constant" val="" valType="str"/>
......@@ -106,7 +108,7 @@
<Param name="Before JS Experiment" updates="constant" val="" valType="extendedCode"/>
<Param name="Begin Experiment" updates="constant" val="" valType="extendedCode"/>
<Param name="Begin JS Experiment" updates="constant" val="" valType="extendedCode"/>
<Param name="Begin JS Routine" updates="constant" val="// Show webcam thumbnail and face feedback box, but not face overlay and gaze dot&amp;#10;window.webgazer.params.showVideoPreview = true;&amp;#10;window.webgazer.params.showFaceFeedbackBox = true;&amp;#10;window.webgazer.params.showFaceOverlay = true;&amp;#10;window.webgazer.params.showGazeDot = false&amp;#10;// Start eye tracking&amp;#10;window.webgazer&amp;#10; // Called on each eye tracking update&amp;#10; .setGazeListener(function(data, clock) {&amp;#10; if (data !== null) {&amp;#10; // Remove first element from gazes array, add current gaze at the end&amp;#10; window.xGazes.shift();&amp;#10; window.xGazes.push(data.x);&amp;#10; window.yGazes.shift();&amp;#10; window.yGazes.push(data.y);&amp;#10; }&amp;#10; })&amp;#10; .begin();&amp;#10; //.showPredictionPoints(true); &amp;#10;" valType="extendedCode"/>
<Param name="Begin JS Routine" updates="constant" val="// Show webcam thumbnail and face feedback box, but not face overlay and gaze dot&amp;#10;window.webgazer.params.showVideoPreview = true;&amp;#10;window.webgazer.params.showFaceFeedbackBox = true;&amp;#10;window.webgazer.params.showFaceOverlay = false;&amp;#10;window.webgazer.params.showGazeDot = false&amp;#10;// Start eye tracking&amp;#10;window.webgazer&amp;#10; // Called on each eye tracking update&amp;#10; .setGazeListener(function(data, clock) {&amp;#10; if (data !== null) {&amp;#10; // Remove first element from gazes array, add current gaze at the end&amp;#10; window.xGazes.shift();&amp;#10; window.xGazes.push(data.x);&amp;#10; window.yGazes.shift();&amp;#10; window.yGazes.push(data.y);&amp;#10; }&amp;#10; })&amp;#10; .begin();&amp;#10; //.showPredictionPoints(true); &amp;#10;" valType="extendedCode"/>
<Param name="Begin Routine" updates="constant" val="" valType="extendedCode"/>
<Param name="Code Type" updates="None" val="JS" valType="str"/>
<Param name="Each Frame" updates="constant" val="" valType="extendedCode"/>
......@@ -123,6 +125,7 @@
<TextComponent name="calibration_text">
<Param name="color" updates="constant" val="white" valType="str"/>
<Param name="colorSpace" updates="constant" val="rgb" valType="str"/>
<Param name="contrast" updates="constant" val="1" valType="num"/>
<Param name="disabled" updates="None" val="False" valType="bool"/>
<Param name="durationEstim" updates="None" val="" valType="code"/>
<Param name="flip" updates="constant" val="" valType="str"/>
......@@ -165,6 +168,8 @@
</Routine>
<Routine name="calibration_trial">
<PolygonComponent name="calibration_square">
<Param name="colorSpace" updates="constant" val="rgb" valType="str"/>
<Param name="contrast" updates="constant" val="1" valType="num"/>
<Param name="disabled" updates="None" val="False" valType="bool"/>
<Param name="durationEstim" updates="None" val="" valType="code"/>
<Param name="fillColor" updates="constant" val="$[1,1,1]" valType="str"/>
......@@ -227,6 +232,8 @@
</Routine>
<Routine name="tracking_trial">
<PolygonComponent name="tracking_square">
<Param name="colorSpace" updates="constant" val="rgb" valType="str"/>
<Param name="contrast" updates="constant" val="1" valType="num"/>
<Param name="disabled" updates="None" val="False" valType="bool"/>
<Param name="durationEstim" updates="None" val="" valType="code"/>
<Param name="fillColor" updates="constant" val="$[-1,-1,-1]" valType="str"/>
......
......@@ -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