Howdy, Stranger!

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

Supported by

[open] PyGaze message logging format

edited July 2016 in PyGaze

Hi again!

I had posted this to my previous message, but I fear that maybe it will go unnoticed there, and I do need help with this further.

I have successfully gotten pygaze to log the stimulus file name, but it is logging it as a separate message at the end of the trial, rather than in conjunction with the time stamps.

Is there a way to log the stimulus with the timestamps as an eyetracking sample? I have a feeling this could be done with an inline_script, but I have no experience in python code. It may also be just how my eyetracker logs things, so perhaps it cannot be done.

For clarity, here is what the pygaze_log looks like for my experiment:

And here is my output (the stimulus is highlighted in yellow).

Column A is the time stamp, column B is the time in milliseconds, Column C is "fix" and Column D is the eyetracker state.

Any ideas?

Thank you and sorry for the double posting!



  • edited 9:05AM

    Hi Sarah,

    You can write variables to the Eyetracker logfile, by typing the command exp.pygaze_eyetracker.log("!V TRIAL_VAR <variable> %s" % <variable>) into an inline_script at the position of your experiment, where you need it. The Part !V TRIAL_VARmakes sure that the stuff that you log is treated as a variable and not just as a simple message.

    does this help?


  • edited 9:05AM

    Hi Sarah,

    Please disregard @eduard's comment; he's referring to an EyeLink specific feature, whereas you are using the EyeTribe.

    As for your question: I'm not sure what you mean by logging "with the time stamps"? Is the time stamp associated with your log message wrong? Or did you mean you would like to have the message in the same format as the actual samples?

    If you meant the latter, than I'm afraid that's impossible. All trackers that I know of store their events in a slightly different way than the samples. Usually, it's impossible to give them the same format as the samples (what x, y, pupil size etc. are you going to log for a message event?), and it's not necessary. There are parsers and data analysis packages available that are perfectly capable of reading data files in the current format.

    If that doesn't answer your question, please do let me know. And please do add a bit of an explanation of why you're concerned about the current data format.



  • edited 9:05AM

    Hi Edwin,

    Thank you for your answer!

    The way that it is formatted right now is not so much a problem when I am presenting one stimulus per trial (like I am with the example above). It is a problem though, when I present multiple stimuli per trial in different locations. For example, in one of our passive viewing tasks, the participants are presented with 4 images of 4 different emotions simultaneously. In the block loop, I have a variable that represents the person being shown, a variable that represents the emotion, and variables for the x and y positions of each emotion. I can log this as a message at the end of the trial, but it comes up in a disorganized way, and it is unclear to me how I can map eye movements with that information.

    We are using OGAMA to analyze the data, and it does not recognize the log message as a variable in the way it is currently formatted, which is why I was asking if the stimuli being presented can be logged as an eyetracking sample. Is there another analysis package that would be able to read this information better? Pygaze Analyzer looks like it could, but I don't understand the installation procedure.

    I basically need to map the eye movements onto the stimuli being shown, and as of right now I'm not sure that I can do that. If there is a way to log what the sketchpad itself is showing per trial, that may be better. However, if it boils down to the analysis software I am using, then it may be time for a change!



  • edited 9:05AM

    Hi Sarah,

    I was thinking of using Ogama myself, but having had a quick play with it, I am more likely to develop my own script for analysis, as I'd have to write something fiddly to reformat my data for Ogama to be able to read anyway.

    If you can get what you want from pygaze analyser, I'd recommend that - do I recall from another post that you have someone with decent Python experience to hand? If so, I am sure they could help with the install of pygaze analyser - and @Edwin (who wrote it) is extremely helpful too.

    As you have all the information you need (x,y co-ordinates of the images, the emotion being shown etc.) theoretically you should be able to tie all this together if you make sure this is exported per trial, and have someone who could write a script for you.
    Also don't forget that you have the 'normal' Opensesame logging - this is the most usual place you would export all of the trial info. It shouldn't be too onerous for someone with reasonable programming/scripting skills to be able to write something that could parse both logs, and create something more suitable for your requirements.

    Hope this is of some use.
    Good luck,


  • edited 9:05AM

    Hi Neon,

    Thank you for your reply! I spoke with our programmer yesterday and he will look into formatting my log files so that they are in a usable format, and can modify them to suit my needs. And if all I need is that basic stimulus information to analyze the data, that would be great.

    Thank you so much everyone for your help with this and my other issues! Very much appreciated!! :)


Sign In or Register to comment.