psychopy.org | Reference | Downloads | Github

Questions on eye tracking and iohub

So I’ve tried some of the demos from http://www.psychopy.org/resources/ECEM_Python_materials.zip and generated my own data set from running selectTracker → run.py . The gaze_x and gaze_y data as shown below seems like it has been smoothened.

. This isn’t a plot of the full 1000hz resolution, is it? (Ignore the second plot as I tweaked them to be duplicates, since I’ve only ran the eye tracker on a single eye.)

My questions are, how do I check the resolution of the eye tracking data using iohub? If the data was somehow smoothened out through some process, how was it done so?

Did you get this data from the HDF data file produced by ioHub? If so, it can be very informative to use the free HDFView application to browse the data. It allows you to explore the tables contained within the file, allowing you to see how many samples are gathered, their timestamps and so on (and even do some very basic plotting to check you are looking at the right variables).

1 Like

Thanks Michael, that was actually useful even though I wasn’t expecting that initially. I think what I meant to ask is the sampling rate (this should be the right term). Did a little more research and found that this could be defined at the iohub_config.yaml file in the same directory as the run.py file. The default sampling rate was set at 500Hz (hence the smoothness of the data I presume) so I changed it to 1000Hz. However each time I ran the run.py file, the sampling rate setting in the iohub_config file keeps getting over written and it changes back to 500Hz when I reopen it at the end of each run. What is causing this over write? Or am I doing something wrong right here?

Snippet of the original lines that calls for the .yaml file:-

base_config_file=os.path.normcase(os.path.join(configurationDirectory,
‘iohub_config.yaml.part’))

eyetrack_config_file=os.path.normcase(os.path.join(configurationDirectory,
eye_tracker_config_files[dlg_info.values()[0]]))

combined_config_file_name=os.path.normcase(os.path.join(configurationDirectory,
‘iohub_config.yaml’))

ExperimentRuntime.mergeConfigurationFiles(base_config_file,
eyetrack_config_file,combined_config_file_name)

runtime=ExperimentRuntime(configurationDirectory, “experiment_config.yaml”)
runtime.start((dlg_info.values()[0],))

Which demo are you talking about specifically? For gc_cursor, it says sampling_rate: 60 in the archive you provided…?

Oh sorry! I have no idea where I got the version that I got (I happened to download multiple versions on separate occasions, can’t remember where I got the other version from). The one I was talking came from a more comprehensive folder (coder->iohub->eyetracking->selectTracker->run.py). I managed to get this fixed somehow by searching for every eye tracking config file and changed all sampling rate to 1000hz. That fixed the overwriting issue, although I don’t know why the iohub_config.yaml file in the same directory should even be overwritten in the first place.

I have re-ran at 1000Hz and plotted out the right eye data using sample_trace_plot.py and this is the output:-

Visualising the same data set using HDFview produces this plot:-

It feels as if the first plot is smoothed out. Is iohub doing something to smooth the data?

Heh, glad to see you got this fixed anyway :slight_smile: Should this question then be marked as resolved?

Oops, I posted my response a little too early and did not fill in the second part of my question in my initial response! Issue is just a step from being resolved. :grin:

I suspect that any “smoothing” was just due to the sampling rate being lower than desired. As noted, you could check this via HDFView and inspecting the time stamps between successive samples.