MovingPandas.TrajectorySmoother¶
movingpandas: Implementation of Trajectory classes and functions built on top of GeoPandas
- class movingpandas.KalmanSmootherCV(traj)¶
Smooths using a Kalman Filter with a Constant Velocity model.
The Constant Velocity model assumes that the speed between consecutive locations is nearly constant. For trajectories where
traj.is_latlon = True
the smoother converts to EPSG:3395 (World Mercator) internally to perform filtering and smoothingNote
This class makes use of Stone Soup, which is an optional dependency and not installed by default. To use this class, you need to install Stone Soup directly (see here).
- smooth(process_noise_std=0.5, measurement_noise_std=1)¶
Smooth the input Trajectory/TrajectoryCollection
- Parameters:
process_noise_std (float or sequence of floats of length 2, default is 0.5.) –
The process (acceleration) noise standard deviation.
If a sequence (e.g. list, tuple, etc.) is provided, the first index is used for the x coordinate, while the second is used for the y coordinate. If
traj.is_latlon=True
the values are applied to the easting and northing coordinate (in EPSG:3395) respectively.Alternatively, a single float can be provided, which is assumed to be the same for both coordinates.
This governs the uncertainty associated with the adherence of the new (smooth) trajectories to the CV model assumption; higher values relax the assumption, therefore leading to less-smooth trajectories, and vice-versa.
measurement_noise_std (float or sequence of floats of length 2, default is 1.) –
The measurement noise standard deviation.
If a sequence (e.g. list, tuple, etc.) is provided, the first index is used for the x coordinate, while the second is used for the y coordinate. If
traj.is_latlon=True
the values are applied to the easting and northing coordinate (in EPSG:3395) respectively.Alternatively, a single float can be provided, which is assumed to be the same for both coordinates.
This controls the assumed error in the original trajectories; higher values dictate that the original trajectories are expected to be noisier (and therefore, less reliable), thus leading to smoother trajectories, and vice-versa.