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

Angle calculation for only one row of data #15

Closed
Freihaut opened this issue Oct 25, 2021 · 1 comment
Closed

Angle calculation for only one row of data #15

Freihaut opened this issue Oct 25, 2021 · 1 comment

Comments

@Freihaut
Copy link

I tried to use the mt_derivates() and mt_angles() function on an example dataset that only contained one trial (trajectories matrix shape was 1x100x3). The mt_derivates function worked as intended, but the mt_angles function failed with the error message:

Error in getAnglesP(trajectories[, , dimensions[1]], trajectories[, , (MouseTrap_Feature_Validation.R#42): Not a matrix.

When adding more trials to the dataset (e.g. trajectory matrix shape 4x100x3), the mt_angles() function worked as intended. I tried to fix the bug by myself and create a pull request, but unfortunately im an R beginner.

@PascalKieslich
Copy link
Owner

Thanks for bringing this up. Yes, the edge case of a trajectory array that contains only a single trajectory (which I believe is in practice very rare) can cause issues in some of the mousetrap functions as R by default drops dimensions of arrays which have only one level. We try to capture this edge case in many of the functions - however, this was not the case for mt_angles so far. I fixed it now. It will be included in the next CRAN release. However, this might still be some time away, so feel free to use the development version from GitHub in the meantime.

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

No branches or pull requests

2 participants