Skip to content

Commit

Permalink
also return reconstructed velocities in reconstruct position function
Browse files Browse the repository at this point in the history
  • Loading branch information
maximvochten committed Aug 30, 2024
1 parent 77cd1da commit 826f195
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/calculate_invariants_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
invariants, progress, calc_trajectory, movingframes, progress_n = invariants_handler.calculate_invariants_translation(trajectory)

# (Optional) Reconstruction of the trajectory from the invariants
reconstructed_trajectory, recon_mf = invariants_handler.reconstruct_trajectory(invariants, position_init=calc_trajectory[0,:], movingframe_init=movingframes[0,:,:])
reconstructed_trajectory, recon_mf, recon_vel = invariants_handler.reconstruct_trajectory(invariants, position_init=calc_trajectory[0,:], movingframe_init=movingframes[0,:,:])

print(recon_mf[1,:,:])
print(movingframes[1,:,:])
Expand Down
6 changes: 5 additions & 1 deletion invariants_py/invariants_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def reconstruct_trajectory(invariants, position_init=np.zeros((3,1)), movingfram
stepsize = 1/N

positions = np.zeros((N,3))
velocities = np.zeros((N,3))
R_frames = np.zeros((N,3,3))

positions[0,:] = position_init
Expand All @@ -61,5 +62,8 @@ def reconstruct_trajectory(invariants, position_init=np.zeros((3,1)), movingfram

position_init = p_plus1
movingframe_init = R_plus1

for k in range(N):
velocities[k,:] = invariants[k, 0]*R_frames[k,:,0]

return positions, R_frames
return positions, R_frames, velocities

0 comments on commit 826f195

Please sign in to comment.