pymovements.events.engbert.microsaccades
- pymovements.events.engbert.microsaccades(velocities: np.ndarray, threshold: np.ndarray | tuple[float] | str = 'engbert2015', threshold_factor: float = 6, min_duration: int = 6, min_threshold: float = 1e-10) list[Saccade][source]
Detect micro-saccades from velocity gaze sequence.
This algorithm has a noise-adaptive velocity threshold parameter, which can also be set explicitly.
The implemetation is based on the description from Engbert & Kliegl [Engbert and Kliegl, 2003] and is adopted from the Microsaccade Toolbox 0.9 originally implemented in R [Engbert et al., 2015].
- Parameters
velocities (np.ndarray, shape (N, 2)) – x and y velocities of N samples in chronological order
threshold (np.ndarray, tuple[float, float] or str) – If tuple of floats then use this as explicit elliptic threshold. If str, then use a data-driven velocity threshold method. See
compute_threshold()for a reference of valid methods. Default: engbert2015threshold_factor (float) – factor for relative velocity threshold computation. Default: 6
min_duration (int) – minimal saccade duration in samples. Default: 6
min_threshold (float) – minimal threshold value. Raises ValueError if calculated threshold is too low. Default: 1e-10
- Returns
List of Saccades
- Return type
list[Saccade]
- Raises
ValueError – If threshold value is below min_threshold value. If passed threshold is either not two-dimensional or not a supported method.