pymovements.events.location#

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

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 – The centroid method to be used for calculation. Supported methods are mean, median. Defaults to ‘mean’.

  • position_column – The column name of the position tuples.

  • n_components – Number of positional components. Usually these are the two components yaw and pitch.

Raises:

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