Simple API#

A simple, blocking API that wraps the Asynchonous API.

class pupil_labs.realtime_api.simple.Device(address, port, full_name=None, dns_name=None, start_streaming_by_default=False, suppress_decoding_warnings=True)[source]#

Bases: DeviceBase

Hint

Use pupil_labs.realtime_api.simple.discover_devices() instead of initializing the class manually. See the Find one or more devices example.

property battery_level_percent: int#
Return type:

int

property battery_state: Literal['OK', 'LOW', 'CRITICAL']#
Return type:

Literal['OK', 'LOW', 'CRITICAL']

close()[source]#
Return type:

None

estimate_time_offset(number_of_measurements=100, sleep_between_measurements_seconds=None)[source]#

Estimate the time offset between the host device and the client.

See pupil_labs.realtime_api.time_echo for details.

Return type:

Optional[TimeEchoEstimates]

gaze_sensor()[source]#
Return type:

Optional[Sensor]

get_calibration()[source]#
property is_currently_streaming: bool#
Return type:

bool

property memory_num_free_bytes: int#
Return type:

int

property memory_state: Literal['OK', 'LOW', 'CRITICAL']#
Return type:

Literal['OK', 'LOW', 'CRITICAL']

property module_serial: str | None | Literal['default']#

Returns None or "default" if no glasses are connected

Return type:

Union[str, None, Literal['default']]

property phone_id: str#
Return type:

str

property phone_ip: str#
Return type:

str

property phone_name: str#
Return type:

str

receive_eyes_video_frame(timeout_seconds=None)[source]#
Return type:

Optional[SimpleVideoFrame]

receive_gaze_datum(timeout_seconds=None)[source]#
Return type:

Optional[GazeData]

receive_imu_datum(timeout_seconds=None)[source]#
Return type:

Optional[ImuPacket]

receive_matched_scene_and_eyes_video_frames_and_gaze(timeout_seconds=None)[source]#
Return type:

Optional[MatchedGazeEyesSceneItem]

receive_matched_scene_video_frame_and_gaze(timeout_seconds=None)[source]#
Return type:

Optional[MatchedItem]

receive_scene_video_frame(timeout_seconds=None)[source]#
Return type:

Optional[SimpleVideoFrame]

recording_cancel()[source]#

Wraps pupil_labs.realtime_api.device.Device.recording_cancel()

Raises:

pupil_labs.realtime_api.device.DeviceError – if the recording could not be started Possible reasons include - Recording not running

recording_start()[source]#

Wraps pupil_labs.realtime_api.device.Device.recording_start()

Raises:

pupil_labs.realtime_api.device.DeviceError – if the recording could not be started. Possible reasons include - Recording already running - Template has required fields - Low battery - Low storage - No wearer selected - No workspace selected - Setup bottom sheets not completed

Return type:

str

recording_stop_and_save()[source]#

Wraps pupil_labs.realtime_api.device.Device.recording_stop_and_save()

Raises:

pupil_labs.realtime_api.device.DeviceError – if the recording could not be started Possible reasons include - Recording not running - template has required fields

send_event(event_name, event_timestamp_unix_ns=None)[source]#
Raises:

pupil_labs.realtime_api.device.DeviceError – if sending the event fails

Return type:

Event

property serial_number_glasses: str | None | Literal['default']#

Returns None or "default" if no glasses are connected

Return type:

Union[str, None, Literal['default']]

property serial_number_scene_cam: str | None#

Returns None if no scene camera is connected

Return type:

Optional[str]

streaming_start()[source]#
streaming_stop()[source]#
property version_glasses: str#
Return type:

str

world_sensor()[source]#
Return type:

Optional[Sensor]

namedtuple pupil_labs.realtime_api.simple.MatchedGazeEyesSceneItem(scene, eyes, gaze)[source]#

Bases: NamedTuple

MatchedGazeEyesSceneItem(scene, eyes, gaze)

Fields:
  1.  scene (SimpleVideoFrame) – Alias for field number 0

  2.  eyes (SimpleVideoFrame) – Alias for field number 1

  3.  gaze (GazeData) – Alias for field number 2

namedtuple pupil_labs.realtime_api.simple.MatchedItem(frame, gaze)[source]#

Bases: NamedTuple

MatchedItem(frame, gaze)

Fields:
  1.  frame (SimpleVideoFrame) – Alias for field number 0

  2.  gaze (GazeData) – Alias for field number 1

namedtuple pupil_labs.realtime_api.simple.SimpleVideoFrame(bgr_pixels, timestamp_unix_seconds)[source]#

Bases: NamedTuple

SimpleVideoFrame(bgr_pixels, timestamp_unix_seconds)

Fields:
  1.  bgr_pixels (ndarray[Any, dtype[uint8]]) – Alias for field number 0

  2.  timestamp_unix_seconds (float) – Alias for field number 1

property datetime#
classmethod from_video_frame(vf)[source]#
Return type:

SimpleVideoFrame

property timestamp_unix_ns#
pupil_labs.realtime_api.simple.discover_devices(search_duration_seconds)[source]#

Return all devices that could be found in the given search duration.

See also

The asynchronous equivalent pupil_labs.realtime_api.discovery.discover_devices()

Return type:

List[Device]

pupil_labs.realtime_api.simple.discover_one_device(max_search_duration_seconds=10.0)[source]#

Return the first device that could be found in the given search duration.

Return type:

Optional[Device]