Saving multiple EDF files within one experiment, using PyGaze init inline instead of plug-in
Hi Forum,
I was wondering whether it's possible to use PyGaze init() within an inline script, just as the old Eyelink init function can do:
libeyelink.init(experiment, resolution, data_file=u'default.edf', fg_color=(255, 255, 255), bg_color=(0, 0, 0), saccade_velocity_threshold=35, saccade_acceleration_threshold=9500, force_drift_correct=False)
We want to create multiple EDF files within one session, using different filenames depending on variables in the inline script. As I understand now, using PyGaze you can only give a name to the EDF file at the start of the experiment, which would mean we have to start and stop Opensesame for each run within the experiment.
I realise we could start recording continuously throughout all the runs and later on reconstruct the run types, however, if something goes wrong within a 2hour recording session, all data is lost.
Any comments, tips are welcome!
Kind regards,
Joanne & Anouk

Comments
Hi Joanne and Anouk,
Just to note: Your data isn't actually lost if something goes wrong in a long session. It's continuously saved on the EyeLink PC, even though it might not be transferred to the experiment PC when an experiment crashes. (BTW: There is a chance that it will be transferred, as OpenSesame will make an attempt to close the connection to the tracker.) To get the data, either open SR Research' data transfer utility, or boot the EyeLink PC in Windows instead of in EyeLink OS.
More on your actual question later!
Cheers,
Edwin
There is a similar way of opening the connection to an EyeLink using the PyGaze plug-ins. It comes down to the following, assuming that you have a pygaze_init item at the start of your experiment:
I think this should do it, but there could be something I'm overlooking. (Can't actually test it here, sorry!)
That should work indeed. The only caveat is that the
eyetrackerobject will no longer correspond toself.experiment.pygaze_eyetracker. So you'll also want to do:... once you've re-opened the datafile.
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thanks a lot Sebastiaan and Edwin!
Hi Edwin & Sebastiaan,
I still experience some difficulty in opening a new Eyelink connection using the code you've mentioned above:
After importing the necessary Display and Eyetracker modules, the display argument self.experiment.pygaze_display is not found when initialising the self.experiment.pygaze_eyetracker object.
Within the imported Pygaze module, I see the _display.py function exists, so I'm wondering why it's not being found when I call it (or am I looking into the wrong file?)
Thanks again,
Joanne