pymovements.events.fill#

pymovements.events.fill(events: EventDataFrame, positions: list[list[float]] | list[tuple[float, float]] | np.ndarray, velocities: list[list[float]] | list[tuple[float, float]] | np.ndarray, timesteps: list[int] | np.ndarray | None = None, minimum_duration: int = 1, name: str = 'unclassified') EventDataFrame[source]#

Classify all previously unclassified timesteps as events.

Parameters:
  • events – The already detected events.

  • positions (array-like, shape (N, 2)) – Continuous 2D position time series.

  • velocities (array-like, shape (N, 2)) – Corresponding continuous 2D velocity time series.

  • timesteps (array-like, shape (N, )) – Corresponding continuous 1D timestep time series. If None, sample based timesteps are assumed.

  • minimum_duration (int) –

    Minimum fixation duration. The duration is specified in the units used in timesteps.

    If timesteps is None, then minimum_duration is specified in numbers of samples.

  • name – Name for detected events in EventDataFrame.

Returns:

A dataframe with detected fixations as rows.

Return type:

pl.DataFrame

Raises:

ValueError – If positions or velocities are None If positions or velocities do not have shape (N, 2) If positions and velocities have different shapes If velocity threshold is None. If velocity threshold is not greater than 0.