floodlight.transforms.temporal

floodlight.transforms.temporal.resample(obj, target_framerate, interp_method=None, order=3, k=3)[source]

Resample a floodlight core object to a new framerate.

Rescales any framerate-bearing core object (XY, Code, TeamProperty, PlayerProperty, or DyadicProperty) to a target framerate.

Parameters:
  • obj (XY | Code | TeamProperty | PlayerProperty | DyadicProperty) – Framerate-bearing core object to resample.

  • target_framerate (int) – Target framerate in Hz. Must be a positive integer.

  • interp_method (str or None, optional) – Interpolation method for the upsample path. Must be one of "linear", "polynomial", "spline", "nearest" or None. Default None: new rows are left NaN, only target samples that coincide with source samples take source values. Ignored on the identity and downsample paths.

  • order (int, optional) – Polynomial order for interp_method="polynomial". Default 3.

  • k (int, optional) – Spline degree for interp_method="spline". Default 3.

Returns:

obj_resampled – New object with framerate rescaled to target_framerate.

Return type:

same type as obj

Notes

In case of target_framerate == obj.framerate resample() returns a deep copy of obj.

Pre-existing NaN gaps in the source pass through unchanged on both the upsample and downsample paths.

The downsample path uses an integer-math nearest-sample index formula; interp_method is ignored there. No anti-aliasing filter is applied.