Skip to content

fix: replace .roll() with .shift() in compute_backward_displacement#866

Open
hemantyaduvanshi585-cmd wants to merge 1 commit intoneuroinformatics-unit:mainfrom
hemantyaduvanshi585-cmd:main
Open

fix: replace .roll() with .shift() in compute_backward_displacement#866
hemantyaduvanshi585-cmd wants to merge 1 commit intoneuroinformatics-unit:mainfrom
hemantyaduvanshi585-cmd:main

Conversation

@hemantyaduvanshi585-cmd
Copy link

@hemantyaduvanshi585-cmd hemantyaduvanshi585-cmd commented Mar 4, 2026

Currently, compute_backward_displacement uses .roll(time=1). This causes the last frame's position to "wrap around" and affect the first frame's displacement calculation. In a real trajectory, the first frame shouldn't have a backward displacement from the last frame—it should be 0.

Using .roll(time=1) caused the last frame's displacement to wrap around to the first frame, which is physically incorrect. I've replaced it with .shift(time=1, fill_value=0) to ensure the first frame is correctly initialized to 0 and to prevent data leakage from the end of the sequence.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 4, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant