mne.preprocessing.eyetracking.convert_units#

mne.preprocessing.eyetracking.convert_units(inst, calibration, to='radians')[source]#

Convert Eyegaze data from pixels to radians of visual angle or vice versa.

Warning

Currently, depending on the units (pixels or radians), eyegaze channels may not be reported correctly in visualization functions like mne.io.Raw.plot(). They will be shown correctly in mne.viz.eyetracking.plot_gaze(). See #11879 for more information.

Important

There are important considerations to keep in mind when using this function, see the Notes section below.

Parameters:
instinstance of Raw, Epochs, or Evoked

The Raw, Epochs, or Evoked instance with eyegaze channels.

calibrationCalibration

Instance of Calibration, containing information about the screen size (in meters), viewing distance (in meters), and the screen resolution (in pixels).

tostr

Must be either "radians" or "pixels", indicating the desired unit.

Returns:
instinstance of Raw | Epochs | Evoked

The Raw, Epochs, or Evoked instance, modified in place.

Notes

There are at least two important considerations to keep in mind when using this function:

  1. Converting between on-screen pixels and visual angle is not a linear transformation. If the visual angle subtends less than approximately .44 radians (25 degrees), the conversion could be considered to be approximately linear. However, as the visual angle increases, the conversion becomes increasingly non-linear. This may lead to unexpected results after converting between pixels and visual angle.

  • This function assumes that the head is fixed in place and aligned with the center of the screen, such that gaze to the center of the screen results in a visual angle of 0 radians.

New in v1.7.

Examples using mne.preprocessing.eyetracking.convert_units#

Plotting eye-tracking heatmaps in MNE-Python

Plotting eye-tracking heatmaps in MNE-Python