pulse2percept.vision.gaze

Gaze

Classes

Gaze(positions[, time])

A sparse sequence of fixations, each starting at a given time

class pulse2percept.vision.gaze.Gaze(positions, time=None)[source]

A sparse sequence of fixations, each starting at a given time

Gaze is piecewise constant: position i becomes active at time[i] and is held until time[i + 1]; the last fixation is held indefinitely. Nothing is interpolated, so a saccade takes no time. Resolution is right-continuous, so an event landing exactly on a frame time applies to that frame; times before the first event raise.

Accepted wherever Scene and predict_percept() take a gaze, given a clock to resolve against: a video scene’s frame times, or a timed percept’s for a still scene.

Added in version 0.11.0.

Parameters:
  • positions ((n, 2) or (n, 3) array_like) – Scene locations that fall on the fovea, in degrees of visual angle. Unitful values are accepted. Without time, each row is (x, y, time): x and y in dva, time in ms, unless unitful. Each entry converts on its own, so a bare 0 needs no unit.

  • time ((n,) array_like, optional) – When each fixation begins, in milliseconds unless given as a unitful time. Must be finite and strictly increasing. Required for (n, 2) positions; not allowed for (x, y, time) rows.

Examples

>>> from pulse2percept.units import dva, ms, s
>>> from pulse2percept.vision import Gaze
>>> gaze = Gaze([(0, 0), (6, 2)] * dva, time=[0, 400] * ms)
>>> gaze.positions
array([[0., 0.],
       [6., 2.]])
>>> gaze = Gaze([(0, 0, 0), (6 * dva, 2 * dva, 0.4 * s)])
>>> gaze.time
array([  0., 400.])
property positions

The (n, 2) fixations, in dva; read-only

property time

When each fixation begins, counted in time_unit; read-only

property time_unit

The unit time is counted in