WhiteNoise#

class pypillometry.sim.WhiteNoise(sd=0.2, scale='log%', eyes=None)[source]#

Bases: SimStep

White measurement noise on the pupil.

Parameters:
  • sd (float) – standard deviation of the noise

  • scale (str) – "log%" (default): sd in log-% (multiplicative noise, like the noise of the timescale model); "data": sd in the units of the data (additive)

  • eyes (tuple | None) – eyes the step applies to (default: all eyes of the simulation)

Examples

Two seconds with noise of 0.5 log-%:

>>> import pypillometry as pp
>>> import matplotlib.pyplot as plt
>>> d = pp.sim.Simulation("2 s", fs=500, seed=1, name="WhiteNoise").pupil().units(800).noise(0.5).run()
>>> fig, ax = plt.subplots(figsize=(8, 3), layout="constrained")
>>> ax = d.plot.plot_truth(ax=ax)
../../_images/pypillometry-sim-WhiteNoise-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]