pymovements.events.location#

pymovements.events.location(method: str = 'mean', *, position_column: str = 'position', n_components: int = 2) Expr#

Location of an event.

For method mean the location is calculated as:

\[\text{Location} = \frac{1}{n} \sum_{i=1}^n \text{position}_i\]

For method median the location is calculated as:

\[\text{Location} = \text{median} \left(\text{position}_1, \ldots, \text{position}_n \right)\]
Parameters:
  • method (str) – The centroid method to be used for calculation. Supported methods are mean, median. (default: ‘mean’)

  • position_column (str) – The column name of the position tuples. (default: ‘position’)

  • n_components (int) – Number of positional components. Usually these are the two components yaw and pitch. (default: 2)

Returns:

The location of the event.

Return type:

pl.Expr

Raises:

ValueError – If method is not one of the supported methods.