Foreshortening#

class pypillometry.sim.Foreshortening(eye_offset=0.0)[source]#

Bases: SimStep

Pupil foreshortening: the camera sees the pupil at the angle \(\alpha\) between the directions from the eye to the camera and to the gaze position, so that the measured size is \(A_0 \cos\alpha\). Needs the gaze (e.g., Fixations) and an experimental setup with screen, eye distance and camera position.

Parameters:

eye_offset (float) – horizontal offset of the eye from the screen centre (mm)

Notes

Ground truth per eye: cosalpha.

Examples

The measured pupil is smaller than the true size, and jumps with the gaze:

>>> import pypillometry as pp
>>> import matplotlib.pyplot as plt
>>> setup = pp.ExperimentalSetup(screen_resolution=(1920, 1080),
...                              physical_screen_size=("52 cm", "29 cm"),
...                              eye_to_screen_center="60 cm",
...                              camera_spherical=("20 deg", "-90 deg", "70 cm"))
>>> d = (pp.sim.Simulation("10 s", fs=100, seed=1, setup=setup, name="Foreshortening")
...      .pupil().gaze().foreshortening().units(800).run())
>>> fig, ax = plt.subplots(figsize=(8, 3), layout="constrained")
>>> ax = d.plot.plot_truth(ax=ax)
../../_images/pypillometry-sim-Foreshortening-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]