Closed fidadoma closed 3 years ago
Thanks for suggestions. The current version already allows for different (yet constant) speeds per object. The function make_random_trajectory
checks the starting position tibble parameter (start
) for speed column (where you can specify them). If there is none, it takes the values from settings$speed
, which is usually a single constant, but a vector with the same number of objects would work fine (another way how to specify them).
It might be fine to have variable speeds, however, I think this should be more nuanced. Usually you would like to limit the acceleration/deceleration to some reasonable ranges. Sampling consecutive speeds independently from normal distribution could lead to pronounced jumps/stops.
However, this could be likely solved with a custom step function - you can pass extra columns in the moment
/moment_next
tibbles and thus retain information between frames (like ttt
in step_zigzag
function).
yes, adding it as parametr to moment could work, but you would need to add some "queue" parameter to slice speeds for individual frames and it would be limited to only new functions. The usage of speed needs to be finetuned, the rnorm example was just a quick dirty way how to show the specification. For example I played with the cosine function (rescaled to 0-5), which should work fine.
I am open to general solution, however I don't think hard-wiring a cosine (or any single function) is sustainable.
Solved in https://github.com/jirilukavsky/motrack/commit/a37821687d3a8e744cb29138b5b2bf325d6f90ff Example also in README.md
In current version of motrack package, the speed is constant for all objects. This disallows changes in velocity during tracking. I was thinking about it and there could be two additional settings parameters:
Both seettings could be combined, e.g.:
speed <- 5
speed <- rep(n_objects, 5)
speed <- rnorm(max_time, mean = 5, sd = 1)
speed <- c(rnorm(max_time, mean = 5, sd = 1),rnorm(max_time, mean = 4, sd = 1), ...
in function
make_random_trajectory
, we would set the correct speed settings. This would extend the possibility of the package and keep the existing code working (as the default would be constant speed)What do you think? I could do it over the weekend