pymovements.Experiment.pos2vel#
- Experiment.pos2vel(arr: list[float] | list[list[float]] | ndarray, method: str = 'smooth', **kwargs: int | float | str) 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:
- Returns:
Velocity time series in input_unit / sec
- Return type:
np.ndarray
- Raises:
ValueError – If the selected method is invalid, the input array is too short for the selected method or the sampling rate is below zero
Examples
>>> experiment = Experiment( ... screen_width_px=1280, ... screen_height_px=1024, ... screen_width_cm=38, ... screen_height_cm=30, ... distance_cm=68, ... origin='upper left', ... sampling_rate=1000.0, ... ) >>> arr = [[0., 0.], [1., 1.], [2., 2.], [3., 3.], [4., 4.], [5., 5.]] >>> experiment.pos2vel( ... arr=arr, ... method="smooth", ... ) array([[ 500., 500.], [1000., 1000.], [1000., 1000.], [1000., 1000.], [1000., 1000.], [ 500., 500.]])