simonarvin / eyeloop

EyeLoop is a Python 3-based eye-tracker tailored specifically to dynamic, closed-loop experiments on consumer-grade hardware.
GNU General Public License v3.0
479 stars 68 forks source link

Closed-loop example doesn't work #32

Closed catubc closed 3 years ago

catubc commented 3 years ago

Hi

Great tool, we are trying to use your tool at our lab and had a couple of questions.

  1. The closed-loop example is unclear how to follow. For example, where are the commands to be run? I tried running them in a jupyter notebook and they work after fixing the path of the imports. But this command

python eyeloop.py

presumably has to be run from the command line? But how are the CAL values to be passed downstream to another method?

  1. Also, there is no file "eyeloop.py" that I could find.

Is there a complete example python file that is available somewhere?

Thanks so much for this tool. Cat

simonarvin commented 3 years ago

Hi Cat, thanks for reaching out.

We recently restructured our code structure, which has generated some inconsistencies in our documentation. I just updated the README of the closed-loop to fix this.

In the "run_eyeloop.py"-file (within the eyeloop dir), import the closed-loop and calibration extractors:

from eyeloop.extractors.closed_loop import ClosedLoop_Extractor
from eyeloop.extractors.calibration import Calibration_Extractor

We'll have to obtain a calibration value for the closed-loop experiment. This is essentially the mean max dilated pupil size. Load the calibrator:

ENGINE.load_extractors(Calibration_Extractor(x=0, y=0, width = 100, height = 100))

Change class arguments to fit your setup. Calibrator should fill the monitor screen entirely.

Run eyeloop

eyeloop

Select the pupil and initiate tracking (press z, then y). This returns a calibration value (saved in file format {time_stamp}._cal_).

Now, load the closed-loop Extractor and insert this value (found in {time_stamp}._cal_) as the first parameter:

ENGINE.load_extractors(ClosedLoop_Extractor(*calibration-value*,  x=0, y=0, w=100, h=100))

For example,

ENGINE.load_extractors(ClosedLoop_Extractor(794.58, x=0, y=0, w=100, h=100))

Test your closed-loop experiment:

eyeloop

Let me know how this goes!

Best, Simon Arvin

catubc commented 3 years ago

Thanks Simon, I will check this again.