Fixations#

class pypillometry.sim.Fixations(mean='300 ms', sd='100 ms', screen=None)[source]#

Bases: SimStep

Gaze as a sequence of fixations at random places on the screen (the same for all eyes).

Parameters:
  • mean (str) – mean and standard deviation of the duration of the fixations (plain numbers are ms; at least 50 ms); default 300 and 100 ms

  • sd (str) – mean and standard deviation of the duration of the fixations (plain numbers are ms; at least 50 ms); default 300 and 100 ms

  • screen (tuple | None) – width and height of the screen in pixels; default: the screen of the experimental setup of the simulation, or (1920, 1080)

Examples

The gaze position during three seconds:

>>> import pypillometry as pp
>>> import matplotlib.pyplot as plt
>>> d = pp.sim.Simulation("3 s", fs=200, seed=1).pupil().gaze().run()
>>> fig, ax = plt.subplots(figsize=(8, 3), layout="constrained")
>>> _ = ax.plot(d.tx / 1000, d["left_x"], label="x")
>>> _ = ax.plot(d.tx / 1000, d["left_y"], label="y")
>>> _ = ax.set(xlabel="time (sec)", ylabel="gaze (px)")
>>> _ = ax.legend()
../../_images/pypillometry-sim-Fixations-1.png

Methods

apply

change the arrays of the running simulation run

eyes_in

the eyes of the simulation the step applies to

from_dict

the step from to_dict()

generate

the events and the duration (ms), for steps of stage "events"

to_dict

name and parameters of the step (numbers, strings, lists, dicts)

Details

static from_dict(d)#

the step from to_dict()

Return type:

SimStep

apply(run, rng)[source]#

change the arrays of the running simulation run

Return type:

None

eyes_in(run)#

the eyes of the simulation the step applies to

Return type:

tuple[str, ...]

generate(rng)#

the events and the duration (ms), for steps of stage "events"

Return type:

tuple[dict[str, ndarray], float]

to_dict()#

name and parameters of the step (numbers, strings, lists, dicts)

Return type:

dict[str, Any]