You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In PR #833 we added a compute_turning_angle function (see API docs).
That function accepts an optional min_step_length=0.0 argument:
The minimum step length to consider for computing the turning angle. Any turning angle involving an incoming or outgoing step shorter than or equal to this value is set to NaN. The default 0.0 only masks steps with exactly zero length, which means steps with near-zero lengths may still produce spurious angles. See Note 2 below.
The aforementioned Note 2:
Positional jitter and small steps: Tracking data often contains positional jitter, meaning a stationary animal may appear to make microscopic movements. With default parameters (min_step_length=0.0), these tiny, noisy movements will produce spurious, meaningless turning angles. It is highly recommended to set min_step_length to an appropriate threshold based on the tracking resolution and the animal's size in the scene. The value should be in the same units as the input position data (e.g. pixels, mm, etc.). Pre-smoothing the trajectory can also help reduce positional jitter.
I've kept the default as 0.0, even though it's not a good choice in most cases (as documented in the docstring). The problem is that any small positive value would be entirely arbitrary: we ultimately can't know what step length is small enough to render a computed heading meaningless, since that's domain-specific — it depends on video resolution, data units (pixels, mm, etc.), animal size in the scene, tracking quality, use of smoothing, and so on.
I merged #833 despite these reservations, since the implementation is sound, well-documented, and tested. This issue is a place to discuss alternatives to the current approach.
Some alternatives:
Make min_step_length a required argument. This forces users to make a conscious choice, but may deter newcomers and makes the function harder to use out of the box. There's also a design question: trajectory complexity metric functions are planned to call compute_turning_angle internally—should the requirement propagate up to those functions too?
Keep min_step_length optional, but change the default to 'auto', which would trigger heuristic-based threshold estimation—for example, something derived from the distribution of step lengths. The open question is whether a reliable heuristic exists that generalises well across use cases.
Note
Other ideas welcome. This is a discussion issue, not a call for PRs; at least not until we've converged on a workable approach.
In PR #833 we added a
compute_turning_anglefunction (see API docs).That function accepts an optional
min_step_length=0.0argument:The aforementioned Note 2:
I've kept the default as
0.0, even though it's not a good choice in most cases (as documented in the docstring). The problem is that any small positive value would be entirely arbitrary: we ultimately can't know what step length is small enough to render a computed heading meaningless, since that's domain-specific — it depends on video resolution, data units (pixels, mm, etc.), animal size in the scene, tracking quality, use of smoothing, and so on.I merged #833 despite these reservations, since the implementation is sound, well-documented, and tested. This issue is a place to discuss alternatives to the current approach.
Some alternatives:
min_step_lengtha required argument. This forces users to make a conscious choice, but may deter newcomers and makes the function harder to use out of the box. There's also a design question: trajectory complexity metric functions are planned to callcompute_turning_angleinternally—should the requirement propagate up to those functions too?min_step_lengthoptional, but change the default to'auto', which would trigger heuristic-based threshold estimation—for example, something derived from the distribution of step lengths. The open question is whether a reliable heuristic exists that generalises well across use cases.Note
Other ideas welcome. This is a discussion issue, not a call for PRs; at least not until we've converged on a workable approach.