Skip to content

Instantly share code, notes, and snippets.

@N-M-T
Created December 29, 2020 16:30
Show Gist options
  • Save N-M-T/15d9e336c581477880ade03def7a18be to your computer and use it in GitHub Desktop.
Save N-M-T/15d9e336c581477880ade03def7a18be to your computer and use it in GitHub Desktop.
Use get_event method to access pupil data
from plugin import Plugin
class access_pupil_data(Plugin):
uniqueness = "not_unique"
icon_chr = chr(0xE061)
icon_font = "pupil_icons"
def __init__(
self, g_pool
):
super().__init__(g_pool)
self.order = 0.9
# initialize empty menu
self.menu = None
def recent_events(self, events):
fixation_pts = [
pt["norm_pos"]
for pt in events.get("fixations", [])
]
gaze_pts = [
pt["norm_pos"]
for pt in events.get("gaze", [])
]
if len(fixation_pts) > 0:
print(fixation_pts)
if len(gaze_pts) > 0:
print(gaze_pts)
def init_ui(self):
self.add_menu()
self.menu.label = "example"
def deinit_ui(self):
self.remove_menu()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment