pymovements.gaze.transforms.pos2vel#
- pymovements.gaze.transforms.pos2vel(*, sampling_rate: float, method: str, n_components: int, degree: int | None = None, window_length: int | None = None, padding: str | float | int | None = 'nearest', position_column: str = 'position', velocity_column: str = 'velocity') pl.Expr #
Compute velocitiy data from positional data.
- Parameters:
sampling_rate (float) – Sampling rate of input time series.
method (str) – The method to use for velocity calculation.
n_components (int) – Number of components in input column.
degree (int | None) – The degree of the polynomial to use. This has only an effect if using
savitzky_golay
as calculation method. (default: None)window_length (int | None) – The window size to use. This has only an effect if using
savitzky_golay
as calculation method. (default: None)padding (str | float | int | None) – The padding to use. This has only an effect if using
savitzky_golay
as calculation method. (default: ‘nearest’)position_column (str) – The input position column name. (default: ‘position’)
velocity_column (str) – The output velocity column name. (default: ‘velocity’)
- Returns:
The respective polars expression.
- Return type:
pl.Expr
Notes
There are three methods available for velocity calculation:
savitzky_golay
: velocity is calculated by a polynomial of fixed degree and window length. Seesavitzky_golay()
for further details.five_point
: velocity is calculated from the difference of the mean values of the subsequent two samples and the preceding two samplesneighbors
: velocity is calculated from difference of the subsequent sample and the preceding samplepreceding
: velocity is calculated from the difference of the current sample to the preceding sample