blink_occlusion#
- pypillometry.sim.blink_occlusion(t, tc, tau_c, to, tau_o, a=1.0, w=0.0, tau_s=1.0)[source]#
Occluded fraction of the pupil during a blink (0: open, 1: covered).
\(g(t) = a\,\sigma((t - t_c)/\tau_c)\,[(1 - w)\,\sigma((t_o - t)/\tau_o) + w\,e^{-\max(t - t_o, 0)/\tau_s}]\): the lid closes (logistic around \(t_c\)), and reopens in two speeds: a fast logistic around \(t_o\) and a slow exponential tail with weight w.
- Parameters:
t (array) – times (ms)
tc (float) – midpoint and time scale of the closing (ms)
tau_c (float) – midpoint and time scale of the closing (ms)
to (float) – midpoint and time scale of the reopening (ms)
tau_o (float) – midpoint and time scale of the reopening (ms)
a (float) – amplitude (1: full blink, < 1: partial)
w (float) – weight and time constant (ms) of the slow tail of the reopening
tau_s (float) – weight and time constant (ms) of the slow tail of the reopening
- Return type:
Examples
A full blink, one with a slow tail of the reopening and a partial blink:
>>> import numpy as np >>> import pypillometry as pp >>> import matplotlib.pyplot as plt >>> t = np.linspace(-50, 600, 1000) >>> fig, ax = plt.subplots(figsize=(8, 3), layout="constrained") >>> _ = ax.plot(t, pp.sim.blink_occlusion(t, 0, 3, 220, 22), label="full blink") >>> _ = ax.plot(t, pp.sim.blink_occlusion(t, 0, 3, 220, 22, w=0.15, tau_s=130), ... label="slow tail (w=0.15)") >>> _ = ax.plot(t, pp.sim.blink_occlusion(t, 0, 3, 150, 22, a=0.3), label="partial (a=0.3)") >>> _ = ax.set(xlabel="time (ms)", ylabel="covered fraction") >>> _ = ax.legend()