flyturn: Track angular speed calculator

Description Usage Arguments Details Value


Calculates the angular speed in rad/frame by comparing the angle of velocity vectors calculated across framelag.


flyturn(trx, framelag = 6)



a track data frame (only requires CTrax output variables)


the number of frames to derive across; defaults to 6


For each timepoint t the speed vector is calculated between t-framelag and t, and then between t and t+framelag. The angles are extracted from these two vectors and subtracted to yield the change in angle over timeframe. This creates a lot of problems when the angles are close to the discontinuity of 2pi and needs sorting out. Currently this leaves framelag NAs at the beginning and end of each track. This causes all sorts of problems and may be best addressed somehow in the future.

Realistic data observation suggests that any angles over pi/2 are either artefacts or discontinuity errors, but at the moment they are not NA'd.


A numeric vector matching the structure of trx containing the angular 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.