pymovements.gaze.transforms_numpy.pos2acc#
- pymovements.gaze.transforms_numpy.pos2acc(arr: list[float] | list[list[float]] | np.ndarray, sampling_rate: float, window_length: int = 7, degree: int = 2, mode: str = 'interp', cval: float = 0.0) np.ndarray #
Compute velocity time series from 2-dimensional position time series.
- Parameters:
arr (list[float] | list[list[float]] | np.ndarray) – Continuous 2D position time series
sampling_rate (float) – Sampling rate of input time series.
window_length (int) – The window size to use. (default: 7)
degree (int) – The degree of the polynomial to use. (default: 2)
mode (str) – The padding mode to use. (default: ‘interp’)
cval (float) – A constant value for padding. (default: 0.0)
- Returns:
Velocity time series in input_unit / sec
- Return type:
np.ndarray
Examples
>>> arr = [(0., 0.), (1., 1.), (4., 4.), (9., 9.), (16., 16.), (25., 25.)] >>> pos2acc( ... arr=arr, ... sampling_rate=1000, ... window_length=5, ... ) array([[2000., 2000.], [2000., 2000.], [2000., 2000.], [2000., 2000.], [2000., 2000.], [2000., 2000.]])