pupil_recording_interface.GazeMapper

class pupil_recording_interface.GazeMapper(left='eye1', right='eye0', min_confidence=0.8, calibration=None, folder=None, record=False, display=True, **kwargs)

Bases: pupil_recording_interface.process.BaseProcess

Gaze mapper.

This process maps gaze data based on the locations of detected pupils in the eye camera stream(s). Attach this process to the world camera stream.

__init__(left='eye1', right='eye0', min_confidence=0.8, calibration=None, folder=None, record=False, display=True, **kwargs)

Constructor.

Parameters
  • left (str) – Name of the left eye camera stream.

  • right (str) – Name of the right eye camera stream.

  • min_confidence (float) – Minimal confidence of detected pupils. Pupil data with confidence below this threshold will not be used for mapping.

  • calibration (Optional[dict]) – Calibration to use for mapping. If not specified, a default calibration will be used that will most likely produce poor results.

  • folder (Optional[os.PathLike]) – Folder for recording mapped gaze.

  • record (bool) – If True, record mapped gaze to a gaze.pldata file in the recording folder.

  • display (bool) – If True, add this instance’s display_hook method to the packet returned by process_packet. A VideoDisplay later in the pipeline will pick this up to draw the current gaze point over the camera image.

Methods

Config(*args, **kwargs)

Configuration for this class.

__init__([left, right, min_confidence, …])

Constructor.

batch_run(pupils[, return_type, info])

Map pupils to gaze data.

display_hook(packet)

Add gaze overlay onto frame.

from_config(config, stream_config, device, …)

Create a process from a ProcessConfig.

get_mapped_gaze()

Call the pupil gaze mapper.

process(packet, notifications)

Process new data.

process_notifications(notifications)

Process new notifications.

process_packet(packet)

Process a new packet.

record_data(packet)

Record gaze to disk.

start()

Start the process.

stop()

Stop the process.

Attributes

process_type

classmethod Config(*args, **kwargs)

Configuration for this class.

batch_run(pupils, return_type='list', info=None)

Map pupils to gaze data.

Parameters
  • pupils (list of dict) – List of previously detected pupils.

  • return_type (str or None, default "list") – The data type that this method should return. “list” returns o list of dicts with gaze data. “dataset” returns an xarray Dataset. Can also be None, in that case gaze data is not loaded into memory and this method returns nothing, which is useful when recording mapped gaze to disk.

  • info (dict, optional) – dict containing recording info. Required for return_type=”dataset”.

Returns

  • pupil_list (list of dict) – List of mapped gaze if return_type=”list”.

  • ds (xarray.Dataset) – Dataset with gaze data if return_type=”dataset”.

display_hook(packet)

Add gaze overlay onto frame.

classmethod from_config(config, stream_config, device, **kwargs)

Create a process from a ProcessConfig.

get_mapped_gaze()

Call the pupil gaze mapper.

process(packet, notifications)

Process new data.

process_notifications(notifications)

Process new notifications.

process_packet(packet)

Process a new packet.

record_data(packet)

Record gaze to disk.

start()

Start the process.

stop()

Stop the process.