PennController for IBEX › Forums › Support › inserting getEyetracker start and stop into the code › Reply To: inserting getEyetracker start and stop into the code
March 14, 2023 at 8:13 am
#10388
Participant
Ok. We have success with running all images and logging the way I wanted. I need to run a longer csv list so I will let you know if there are other issues.
Even though it works, I am just posting the main script below if you can see and let me know I did this correctly. otherwise the links are above for demo to see the script
Template( "eng_01_geo_List_tense_old.csv", row=>
newTrial("eyetracking",
newCanvas("imageContainer", 1280, 720)
//defaultImage.size(1280,720).(0,0,getCanvas("imageContainer"))
//defaultImage.size(1280,720).print()//,
//.print("center at 50vw", "center at 50vh")
//defaultText.center().print()
,
newEyeTracker("tracker",1).callback( function (x,y) {
if (this != getEyeTracker("tracker")._element.elements[0]) return; // The callback commands lets us log the X and Y coordinates of the estimated gaze-locations at each recorded moment in time
getEyeTracker("tracker")._element.counts._Xs.push(x);
getEyeTracker("tracker")._element.counts._Ys.push(y);
})
,
newFunction(()=>{
getEyeTracker("tracker")._element.counts._Xs = [];
getEyeTracker("tracker")._element.counts._Ys = [];
}).call()
,
getEyeTracker("tracker")
.calibrate(5) // Make sure that the tracker is still calibrated
.log() // log the calibration test.index
,
getCanvas("imageContainer").print("center at 50vw", "middle at 50vh")
,
getEyeTracker("tracker")
.add(
getCanvas("imageContainer"))
.log()
.start()
,
newTimer("pre-trial0", 500).start().wait()
,
newImage("image0", row.Static_image1).print(0,0,getCanvas("imageContainer")),
newTimer("displayTime0", 2000).start().wait(),
getImage("image0").remove()
.log()
,
newTimer("pre-trial1", 500).start().wait()
,
newImage("image1", row.action_image).print(0,0,getCanvas("imageContainer")),
newTimer("displayTime1", 2500).start().wait(),
getImage("image1").remove()
.log()
,
newTimer("pre-trial2", 500).start().wait()
,
newImage("image2", row.Static_image2).print(0,0,getCanvas("imageContainer")),
newAudio("audio", row.wav_file).play(), // the audio file is set in design.csv
getAudio("audio").wait("first"),
newTimer("displayTime2", 400).start().wait(),
getImage("image2").remove()
.log()
,
newTimer("pre-trial3", 500).start().wait()//remain for 1000 ms on screen
,
newImage("image3", row.action_image2).print(0,0,getCanvas("imageContainer")),
newTimer("displayTime3", 2500).start().wait(),
getImage("image3").remove()
.log()
,
// Stop now to prevent collecting unnecessary data
getEyeTracker("tracker")
.stop()
)
.noHeader()
.log("Subject" , getVar("Subject") )
.log("Static_image1" ,row.Static_image1)
.log("action1_image" ,row.action_image)
.log("ID_No" ,row.random)
.log("Static_image2" ,row.Static_image2)
.log("wav_file" ,row.wav_file)
.log("action_image2" ,row.action_image2)
.log("ViewportWidth" ,window.innerWidth ) //
.log("ViewportHeight" ,window.innerHeight ) // Screensize:
)
I have other questions but I will post later