pymovements.transforms.pos2vel
- pymovements.transforms.pos2vel(arr: list[float] | list[list[float]] | np.ndarray, sampling_rate: float = 1000, method: str = 'smooth', **kwargs) np.ndarray[source]
Compute velocity time series from 2-dimensional position time series.
- Methods ‘smooth’, ‘neighbors’ and ‘preceding’ are adapted from
Engbert et al.: Microsaccade Toolbox 0.9.
- Parameters
arr (array_like) – Continuous 2D position time series
sampling_rate (int) – Sampling rate of input time series
method (str) – Following methods are available: * smooth: velocity is calculated from the difference of the mean values of the subsequent two samples and the preceding two samples * neighbors: velocity is calculated from difference of the subsequent sample and the preceding sample * preceding: velocity is calculated from the difference of the current sample to the preceding sample
kwargs (dict) – Additional keyword arguments used for savitzky golay method.
- Returns
Velocity time series in input_unit / sec
- Return type
np.ndarray
- Raises
ValueError – If selected method is invalid, input array is too short for the selected method or the sampling rate is below zero