flyrun: Track speed calculator

Description Usage Arguments Details Value


Calculates the speed (scalar) in px/frame by comparing centroid location across framelag.


flyrun(trx, framelag = 6)



a track data frame (only requires CTrax output variables)


the number of frames to derive speed across; defaults to 6


For each timepoint t the velocity vector is calculated between t-framelag/2 and t+framelag+2. Currently this leaves framelag/2 NAs at the beginning and end of each track. This causes all sorts of problems and may be best addressed somehow in the future.

Frames with speed>50 are also currently NA'd since that is exclusively artifacts (CTrax already limits jumps to 40 px/frame) however this again causes holes in the data which become problematic later. Ideally the imputation would be done at the x and y level.


A numeric vector matching the structure of trx containing the speed value for each object and timepoint, or NAs when it can't be calculated.

PaolaCognigni/CTraxHelper documentation built on May 7, 2019, 11:57 p.m.