Skip to content

Unit Conversion Helper function for eye-tracking data (pixels to radians) #12112

@scott-huberty

Description

@scott-huberty

Describe the new feature or enhancement

This Ticket is related to meta-issue #11879

I am at a point in one of my projects where I'd like to convert my eye-tracking position data from pixels-on-screen to a unit of angle. Since 1) this is a fairly common conversion in eye-tracking research; 2) it was highlighted as a TODO in #11879 ; and 3) this would help users convert their position data into an SI unit (radians), I think It would be good to build a helper function for this.

CC @britta-wstnr @larsoner

Describe your proposed implementation

Possible API (borrowing from @drammock):

mne.preprocessing.eyetracking.convert_units(calibration: Calibration, from: str = 'px', to: str = 'radian')

Where Calibration is an instance of mne.preprocessing.eyetracking.Calibration that contains necessary metadata: screen_size, distance, screen_resolution.

Or we could have a more specific function like:

mne.preprocessing.eyetracking.convert_pixels_to_radians(calibration: Calibration)

and a similar function for radian to pixel

Describe possible alternatives

We could also include screen_size, screen_resolution, distance as parameters of the function, so the user can either pass a Calibration instance with this info, or specify them directly via the function call (this was an idea brought up in the summer and documented in this comment)

Additional context

This was a feature that I proposed during my GSoC but didn't get to by the end of summer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions