Resamples a trajectory to a new length.
(x, length=200)
| 24 | |
| 25 | |
| 26 | def time_warping(x, length=200): |
| 27 | """ |
| 28 | Resamples a trajectory to a new length. |
| 29 | """ |
| 30 | len_x = len(x) |
| 31 | time_steps = np.arange(length) * (len_x - 1) / (length - 1) |
| 32 | x = x.T |
| 33 | warped_trajectory = np.zeros((2, length)) |
| 34 | for i in range(2): |
| 35 | warped_trajectory[i] = np.interp(time_steps, np.arange(len_x), x[i]) |
| 36 | return warped_trajectory.T |
| 37 | |
| 38 | |
| 39 | def gather(consts: torch.Tensor, t: torch.Tensor): |
nothing calls this directly
no outgoing calls
no test coverage detected