Blinks#
- class pypillometry.sim.Blinks(rate='15/min', min_interval='500 ms', closed='lognormal(220 ms, 80 ms)', tau_c='lognormal(3 ms, 1 ms)', tau_o='lognormal(22 ms, 8 ms)', w=0.15, rho=6.0, p_partial=0.02, partial='uniform(0.1, 0.4)', visibility=0.5, jitter='normal(0 ms, 2 ms)', eyes=None)[source]#
Bases:
SimStepBlinks: the lid covers the pupil, which the tracker loses while the covered fraction is above visibility.
The covered fraction \(g(t)\) of each blink follows
blink_occlusion(): a fast closing, a closed phase and a reopening with a fast part and a slow tail. The measured pupil is \((1 - g)\) times the pupil; the samples with \(g >\) visibility are missing (with the gaze). The parameters are drawn for each blink; the defaults come from fits of the model to blinks of EyeLink recordings (grey screen). With several eyes, the blinks are the same in all eyes up to a small jitter.- Parameters:
rate (
str) – mean rate ("15/min"; plain numbers per minute)min_interval (
str) – minimal time between two blinks (default 500 ms); the intervals are this plus an exponential timeclosed (
str) – time from the closing to the reopening (\(t_o - t_c\))tau_c (
str) – time scales of the closing and of the fast reopeningtau_o (
str) – time scales of the closing and of the fast reopeningw (
float) – weight of the slow tail of the reopeningrho (
float) – time constant of the tail relative to \(\tau_o\)p_partial (
float) – share of partial blinkspartial (
str) – amplitude of partial blinks (covered fraction at most); partial blinks with an amplitude below visibility have no missing samplesvisibility (
float) – the tracker loses the pupil when more than this fraction is coveredjitter (
str) – shift of each blink in each eye (several eyes)eyes (
tuple|None) – eyes (default: all eyes of the simulation)
Notes
Ground truth:
occlusionper eye (the covered fraction \(g\)), and one true event"blink"per blink and eye ind.truth_events(onset \(t_c\), with the metadataeye,closed,tau_c,tau_o,a,w,tau_sandgap, the duration of the missing samples).Examples
Twenty seconds with blinks (shaded):
>>> import pypillometry as pp >>> import matplotlib.pyplot as plt >>> d = (pp.sim.Simulation("20 s", fs=500, seed=2, name="Blinks") ... .pupil().units(800).blinks(rate="12/min").noise(0.1).run()) >>> fig, ax = plt.subplots(figsize=(8, 3), layout="constrained") >>> ax = d.plot.plot_truth(ax=ax)
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"