Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Saving multiple EDF files within one experiment, using PyGaze init inline instead of plug-in

edited April 2016 in PyGaze

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

  • edited April 2016

    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

  • edited April 2016

    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:

    from pygaze.display import Display
    from pygaze.eyetracker import EyeTracker
    
    # Close the existing connection
    # (Only works if an existing connection exists!)
    self.experiment.pygaze_eyetracker.close()
    
    # Open a new connection
    self.experiment.pygaze_eyetracker = EyeTracker(self.experiment.pygaze_display, \
        trackertype=u'eyelink', logfile=u'example')
    

    I think this should do it, but there could be something I'm overlooking. (Can't actually test it here, sorry!)

  • edited 12:41AM

    That should work indeed. The only caveat is that the eyetracker object will no longer correspond to self.experiment.pygaze_eyetracker. So you'll also want to do:

    eyetracker = self.experiment.pygaze_eyetracker
    

    ... once you've re-opened the datafile.

    Cheers,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • edited 12:41AM

    Thanks a lot Sebastiaan and Edwin!

  • edited 12:41AM

    Hi Edwin & Sebastiaan,

    I still experience some difficulty in opening a new Eyelink connection using the code you've mentioned above:

    self.experiment.pygaze_eyetracker = EyeTracker(self.experiment.pygaze_display, \
        trackertype=u'eyelink', logfile=u'example')
    

    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

Sign In or Register to comment.