periodic_trajectory_wrap

periodic_trajectory_wrap(trajectory, period=6.283185307179586)[source]

Unwrap a trajectory so consecutive rows are within half a period.

Iterates forward through the rows, wrapping each row relative to its predecessor. The result is a continuous trajectory suitable for PCA.

Parameters:
  • trajectory (TypeAliasType) – Parameter vectors of shape (n_steps, n_params).

  • period (float) – Periodicity of each parameter. Defaults to \(2\pi\).

Return type:

ndarray[tuple[Any, ...], dtype[double]]

Returns:

Unwrapped copy of trajectory with the same shape.

Raises:

ValueError – If trajectory is not 2-D or has fewer than two rows.