pupil_recording_interface.Calibration

class pupil_recording_interface.Calibration(resolution, mode='2d', min_confidence=0.8, left='eye1', right='eye0', world='world', name=None, folder=None, save=False, **kwargs)

Bases: pupil_recording_interface.process.BaseProcess

Calibration.

This process calculates a calibration for gaze mapping based on the locations of detected pupils in the eye camera stream(s) and calibration markers in the world camera stream. Attach this process to the world camera stream after the CircleDetector.

__init__(resolution, mode='2d', min_confidence=0.8, left='eye1', right='eye0', world='world', name=None, folder=None, save=False, **kwargs)

Constructor.

Parameters
  • resolution (tuple) – Resolution of world camera.

  • mode (str) – Calibration mode. So far, only “2d” is supported.

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

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

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

  • world (str) – Name of the world camera stream.

  • name (Optional[str]) – Name of this process

  • folder (Optional[os.PathLike]) – Folder for saving calibration result.

  • save (bool) – If True, save calibration result.

Methods

Config(*args, **kwargs)

Configuration for this class.

__init__(resolution[, mode, min_confidence, …])

Constructor.

batch_run(pupils, markers[, return_type])

Run calibration on detected pupils and reference markers.

calculate_calibration()

Calculate calibration from collected data.

from_config(config, stream_config, device, …)

Create a process from a ProcessConfig.

process(packet, notifications)

Process new data.

process_notifications(notifications)

Process new notifications.

process_packet(packet)

Process a new packet.

save_result()

Save result of calibration.

start()

Start the process

stop()

Stop the process.

Attributes

process_type

classmethod Config(*args, **kwargs)

Configuration for this class.

batch_run(pupils, markers, return_type='dict')

Run calibration on detected pupils and reference markers.

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

  • markers (list of dict) – List of detected reference markers.

  • return_type (str or None, default "dict") – The data type that this method should return. “dict” returns the calibration result as a dict. Can also be None, in that case this method returns nothing, which is useful when recording the calibration directly to disk.

Returns

result – Calibration results if return_type=”dict”.

Return type

dict

calculate_calibration()

Calculate calibration from collected data.

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

Create a process from a ProcessConfig.

process(packet, notifications)

Process new data.

process_notifications(notifications)

Process new notifications.

process_packet(packet)

Process a new packet.

save_result()

Save result of calibration.

start()

Start the process

stop()

Stop the process.