TrackerLoss#
- class pypillometry.sim.TrackerLoss(rate='0.5/min', duration='lognormal(150 ms, 200 ms)', binocular=False, eyes=None)[source]#
Bases:
SimStepLosses of the pupil by the tracker: stretches of missing samples at random times, without a transient.
- Parameters:
Notes
Ground truth: one true event
"loss"per loss and eye ind.truth_events(with the metadataeyeandduration).Examples
Ten seconds with losses (shaded):
>>> import pypillometry as pp >>> import matplotlib.pyplot as plt >>> d = (pp.sim.Simulation("10 s", fs=500, seed=1) ... .pupil().units(800).loss(rate="20/min", duration="300 ms").noise(0.1).run()) >>> t = d.tx / 1000 >>> fig, ax = plt.subplots(figsize=(8, 3), layout="constrained") >>> _ = ax.plot(t, d.truth["left", "pupil"], color="0.7", label="true") >>> _ = ax.plot(t, d["left_pupil"], label="data") >>> for onset, dur in zip(d.truth_events.onsets, d.truth_events.meta["duration"]): ... _ = ax.axvspan(onset / 1000, (onset + dur) / 1000, alpha=0.2) >>> _ = ax.set(xlabel="time (sec)", ylabel="pupil") >>> _ = ax.legend()
Methods
change the arrays of the running simulation run
the eyes of the simulation the step applies to
the step from
to_dict()the events and the duration (ms), for steps of stage
"events"name and parameters of the step (numbers, strings, lists, dicts)
Details
- generate(rng)#
the events and the duration (ms), for steps of stage
"events"