pymovements.Gaze.measure_samples#

Gaze.measure_samples(method: str | Callable[..., pl.Expr], **kwargs: Any) pl.DataFrame[source]#

Calculate eye movement measure on samples.

If :py:class:Gaze has :py:attr:trial_columns, measures will be grouped by trials.

Parameters:
  • method (str | Callable[..., pl.Expr]) – Measure to be calculated.

  • **kwargs (Any) – Keyword arguments to be passed to the respective measure function.

Returns:

Measure results.

Return type:

pl.DataFrame

Examples

Let’s initialize an example Gaze first: >>> gaze = pm.gaze.from_numpy( … pixel=np.concatenate( … [np.zeros((2, 40)), np.full((2, 10), np.nan), np.ones((2, 50))], … axis=1, … ), … )

You can calculate measures, for example the null ratio like this: >>> gaze.measure_samples(‘null_ratio’, column=’pixel’) shape: (1, 1) ┌────────────┐ │ null_ratio │ │ — │ │ f64 │ ╞════════════╡ │ 0.1 │ └────────────┘