marcus-nystrom / Titta

Python and PsychoPy interface to Tobii eye trackers using Tobii Pro SDK
Other
71 stars 27 forks source link

Callback function for gaze data #54

Closed rhardstone closed 9 months ago

rhardstone commented 9 months ago

Is it possible with titta to associate a callback function when recording similar to that from the tobii_research SDK?

e.g. with tobii_research: tracker.subscribe_to(tr.EYETRACKER_GAZE_DATA, callback=gaze_data_callback, as_dictionary=True)

dcnieho commented 9 months ago

You mean to use your own callback function instead of simply having samples arrive to our buffers?

  1. No
  2. You wouldn't want to do this, as its very hard to write correct python code that ensures that no data is lost using these callbacks. That, for instance, can happen is you do not sleep or yield often enough due to which the callback cannot run.
marcus-nystrom commented 9 months ago

You mean to use your own callback function instead of simply having samples arrive to our buffers?

  1. No
  2. You wouldn't want to do this, as its very hard to write correct python code that ensures that no data is lost using these callbacks. That, for instance, can happen is you do not sleep or yield often enough due to which the callback cannot run.

Just to clarify: occasional data loss when using callbacks in the tobii_research SDK (previously used in Titta) is the reason we abandoned the Tobii Python SDK altogether in favor of TittaPy.

rhardstone commented 9 months ago

Thanks for the quick response, that is very helpful and answers my question