Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rethink definition of displacement vector #136

Open
sfmig opened this issue Mar 12, 2024 · 2 comments
Open

Rethink definition of displacement vector #136

sfmig opened this issue Mar 12, 2024 · 2 comments
Labels
enhancement New optional feature

Comments

@sfmig
Copy link
Contributor

sfmig commented Mar 12, 2024

Right now the displacement vector at t is defined as the vector from t-1 to t. For the first frame, it is defined as the zero vector.

Although this naturally derives from the diff operator, it does feel a bit awkward for example when you want to visually check the displacement vector. Right now, you would typically use a quiver plot, in which at each position t of the trajectory you plot the negative of the displacement vector at t. In this way, the resulting vector at t points to the previous position at t-1, and you can visually check the data behaves as you expect.

Plotting the _negative_displacement vector seems slightly cumbersome and adds to the mental load of things to remember about the data. It may show that a more useful definition of the displacement vector would be "the vector at t that goes from the position at t to the position at t+1". This would make for an easy visual check with quiver plot, and seems like an easier mental model to have of the data. For the last frame, we would define it as the zero vector.

@sfmig sfmig added the enhancement New optional feature label Mar 12, 2024
@sfmig sfmig mentioned this issue Mar 18, 2024
7 tasks
@lochhh
Copy link
Collaborator

lochhh commented Mar 19, 2024

There's no need to plot the negative displacement. pivot would get us what we want:

# plot displacement vectors: at t, vector from t-1 to t
ax.quiver(
    pose_tracks.sel(individuals=mouse_name, space="x"),
    pose_tracks.sel(individuals=mouse_name, space="y"),
    displacement.sel(individuals=mouse_name, space="x"),
    displacement.sel(individuals=mouse_name, space="y"),
    angles="xy",
    scale=1,
    scale_units="xy",
    headwidth=7,
    headlength=9,
    headaxislength=9,
    pivot="tip",
)

@sfmig
Copy link
Contributor Author

sfmig commented Mar 21, 2024

yes, I was aware of this option too 😁 My point is that it is a bit more intuitive to think displacement as t to t+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New optional feature
Projects
Status: 🤔 Triage
Development

No branches or pull requests

2 participants