Howdy, Stranger!

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

Supported by

[solved] PyGazeAnalyser Assistance

edited March 2016 in PyGaze

I am hoping that someone can assist me on where to start with the PyGazeAnalyser toolkit. I am having some issues figuring out where to start in terms of building heat maps / scan paths. Here is a rundown of what I have tried / what I need:

My experiment was created in openSesame. On the eye-tracking side, I used an Eye Tribe eye-tracker and I collected my data using PyGaze logging inside openSesame. A dummy example of how my data file is here.

This is a tiny portion of sample data from "participant 1" in my study. Of particular note are the MSG lines on 32, 45, 74, 83, 94..., This was how I separated my test cases of which there were 10, each test case was a different image centred on the screen awaiting some keyboard input. The data files average around 16k lines each (60FPS collection), each structured exactly as mentioned above, with "start of test case x" and "end of test case x" as well as fixation point markers written to the logfile as trial separators.

I have looked particularly at the "eyetribereader.py" file in the source code for PyGazeAnalyser and noticed that it reads in exactly my structure of data file and outputs a list of lists detailed some basic fixation, saccade and blink data. I think I have this file working but I am unsure A - How to separate out each trial, it only seems to give me a big list when I feed it "start of test case" as the start parameter and B - How / What I can use this data for then. Is this then used for something else or is it stand-alone? Should I be instead feeding my files in elsewhere and if so, what pre-formatting might I need to do to make things function?

The primary thing I need to do is to feed in my data file and produce a scan-path and heat map. Is there any documentation on how I go about doing this / could anyone offer me any assistance with this here? I am a little stuck for time so I would really appreciate a nudge in the right direction.

Thanks in advance!

Comments

  • edited 1:48AM

    Will post a more detailed response later. Until then, maybe you can get some inspiration from the example script on GitHub?

    See: https://github.com/esdalmaijer/PyGazeAnalyser/blob/master/examples/analysis/analysis.py

    Cheers,

    Edwin

  • edited March 2016

    Hi Edwin,

    Thanks for your reply! I've been fiddling around with the example script this evening and have hit a bit of a brick wall. Here's a rundown for you:

    • I have a test copy of my data set up as the file asks in a data and imgs folder inside the same directory as the analysis.py script.

    • I have modified my participants list to reflect this new test subject.

    • First Problem: I am unsure what EDFSTART, EDFSTOP and TRIALORDER variables should be set to. As detailed above, I have variable "testcase" start and stop MSG lines in my .tsv. I am really not sure how to make this script recognize my trial separators in it's current form. I also don't know what "image online" and "image offline" are referring to at all.

    • I modified the path line to "fp = os.path.join(DATADIR, '%s.tsv' % ppname)" since my files are tsv and not txt.

    • Second Problem: When I try to run at this stage I get the error "Exception: No eye data file (neither ASC, nor EDF) file found for participant 'subject-1-test'". I do not have any such EDF file in my data. All that I use is this standard PyGaze .tsv for eye-tracking data and a fairly standard openSesame log file which contains efficacy data and timing etc. The basic trial stuff. What should this EDF file be, do I need one and how to I do this without one?

    • Third Issue: For the plotting section then (which I haven't gotten to test because I can't get around the EDF error), how does it recognize which images go with which trial? (Once my trial numbering problem above is sorted). My filenames all happen to be of the form "Test_x_PREPILOT" where x is from 1-10. Does the imgname variable try to pull the image name from the eye-tracking file currently? I assume I can instead just said it to my format here and increment x for each loop of the trialnr.

    Once these few issues are fixed it looks like this should then work well for me! I appreciate you taking the time to help me on this and fair play on making the toolkit open source! If you want me to send on the script with the small changes I've made, I can email it on to you.

    Looking forward to your response,

    Mark.

  • edited 1:48AM

    Hi Edwin / Others,

    Still eagerly awaiting a response on this when someone has time! I have tried putting in my .tsv file for both input files (since it takes in a behavioural and some other file) and was still getting no results. I only have another week or so to spend on this analysis. Any help will be much appreciated!

    Mark.

  • edited 1:48AM

    Hi Mark,

    Sorry for the late reply, stuff gets busy around here! As for your questions:

    1) Usually, you log a specific message to the gaze data file when a trial starts and when a trial ends, and when specific events happen within a trial, for example when a target is shown on the screen (i.e. is "online"). The START is when your trial starts, or when your event-of-interest happens. The STOP is when your trial ends, or your event-of-interest is over. For example, if you logged the message "TRIALSTART" at the start of your trial and "TRIALEND" at the end of your trial, these would be your start and stop events.

    2) I think this might be a fundamental issue. In PyGaze Analyser, there are three different readers. You seem to be using the one for EDF files, which are produced by EyeLink trackers. If you are using an EyeTribe, you want the eyetribereader module rather than the edfreader.

    3) The imgname keyword argument requires the path to the image that you used for a trial, e.g. 'C:\my_experiment\example.jpg'.

    Hope this helps!

    Cheers,

    Edwin

  • edited 1:48AM

    Hey Edwin,

    Don't worry about it, I understand everyone is fairly busy at this time of the year! You guys are doing great work so I appreciate you taking the time at all.

    Thanks for the answers, I can see where the mistakes lay now. When you linked me to the script initially I made the mistake of thinking it already incorporated an EyeTribe example. I have it producing results now that look pretty accurate, I'll have to go through them still to verify over the next few days.

    I'll give you a shout if I need any further help but now that I have this working it should work for most of my experiments in the future.

    All the best,
    Mark.

  • edited March 2016

    That's very good news! Will mark the thread as 'solved' for now, but do feel free to continue posting here if you run into any similar issues. Or just create a new thread, if any new issues pop up :)

    Cheers,

    Edwin

    PS: Sorry for the communication across different channels; I prefer to post my answers on the forum rather than via email, so that others might be able to benefit from them. So wasn't ignoring your emails, was just asynchronously replying ;)

  • edited 1:48AM

    Hello Edwin,

    I'm struggling with my analysis code, since I'm also using an Eyetribe and the analysis code provided by default uses the edfreader module. Is there an example of analysis code file specifically designed to use the eyetribereader module somewhere? I'm not the best at coding and that would help me understand the code structure, the different functions and what I should be doing next.

    Many thanks in advance,
    Cyril

  • edited 1:48AM

    Hi Cyril,

    Instead of from edfreader import read_edf, use from eyetribereader import read_eyetribe. The rest of the code can be exactly the same.

    Cheers,

    Edwin

  • Hi Edwin!

    I'm struggeling with the same thing as Cyril, and swapping line 11 in your example out with from pygazeanalyser.eyetribereader import read_eyetribe is not helping.

    I'm getting this output, and I've placed the .tsv and .txt file I got from the PyGaze-slideshow example in the data folder, and that is all there is in there as well.

    loading behavioural data loading gaze data Traceback (most recent call last): File "analysis.py", line 103, in <module> raise Exception("No eye data file (neither ASC, nor EDF) file found for participant '%s' (tried paths:\nASC: %s\nEDF: %s" % (ppname, fp, edfp)) Exception: No eye data file (neither ASC, nor EDF) file found for participant 'b' (tried paths: ASC: data\b.asc EDF: data\b.edf

    Is the read_eyetribe supposed to transform the .tsv file?

    Any help would be much appriciated!

  • Ah, yeah, sorry. The rest of the code does have to be changed around a bit.

    Essentially, just read the code, and make sure that you change all the references to '.asc' and '.edf' to the relevant alternative. In the case of the EyeTribe that would indeed be '.tsv', and the alternative to read_edf would be read_eyetribe.

Sign In or Register to comment.