Skip to content

KLEyeTracking Internal Cleanup & API Cleanup - #48

Merged
a-hurst merged 21 commits into
testingfrom
tracker_cleanup
Oct 20, 2026
Merged

a-hurst merged 21 commits into
testingfrom
tracker_cleanup

Conversation

@a-hurst

@a-hurst a-hurst commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

PR Description

This PR makes a wide array of changes and tweaks to how the KLEyeTracking module works internally, as well as introduces some new features and improvements. A number of unused method arguments have been removed from the API for the sake of simplicity.

Note that these changes have yet to be tested on real EyeLink hardware! Bugs are expected, but will be ironed out with proper testing once all planned changes are integrated.

Major improvements

  • All code for generating simulated eye events from gaze samples has been improved as well as refactored into a separate class (GazeEventGenerator), making it cleaner and easier to adapt for use with any future trackers but also importantly making it possible to write unit tests for eye event generation as well as the EyeTracker class in general.
  • Support has been added for generating blink events with TryLink when the mouse button is clicked and P.dm_click_to_blink is enabled (off by default). The code for generating blink events can likewise be extended to other trackers in the future.
  • The EyeLink class has been rewritten to hold the underlying pylink.EyeLink object internally instead of subclassing it directly (which required weird hacks in the first place and also broke documentation if pylink wasn't installed). To access pylink-specific methods, you can access the self.el.eyelink attribute, which will be None if not using the EyeLink backend, making it possible to wrap tracker-specific code in if blocks and also making it explicit in the code that the developer is accessing EyeLink-specific functionality.
  • For the sake of documentation and clarity, the EyeTracker class no longer subclasses BoundarySet directly, instead using a BoundarySet internal and providing methods (add_boundary, add_boundaries, clear_boundaries) in the EyeTracker class itself to wrap the existing behaviour in a way that's clearly documented and doesn't require the developer to read the documentation for a separate class in a separate module to understand core functionality.
  • Renamed all the major user-facing eye tracking constants, dropping the EL_ prefix from them all to reduce character counts and also emphasize independence from the underlying tracker hardware.
  • The report and inspect parameters have been removed from all boundary-testing methods in the EyeTracker class, greatly simplifying the API and documentation. These parameters have never been used since being introduced, and the edge-case flexibility they offer will ultimately be replaced by the ability to parse eye event objects directly (in a future PR).

Other Changes

  • The events.py submodule has been reorganized and renamed in anticipation of adding eye event wrappers.
  • The actual EyeLink model name is now properly inferred from the version string for EyeLink 1000 and later models.
  • Removed support for mid-trial eye tracker calibration with Ctrl-C/Cmd-C through ui_request. This was a bad idea for several reasons, but primarily that it didn't stop the trial and would resume right where it left off!

Merge Checklist

  • the PR has been reviewed and all comments are resolved
  • all CI checks pass
  • (if applicable): the PR description includes the phrase closes #<issue-number> to automatically close an issue
  • (if applicable): bug fixes, new features, or API changes are documented in CHANGELOG.rst

@a-hurst
a-hurst merged commit 442d119 into testing Oct 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant