flyspin: Fly body turn calculator

Description Usage Arguments Details Value

Description

Calculates the change in body angle between consecutive frames.

Usage

1
flyspin(trx, framelag = 1)

Arguments

trx

a track data frame (only requires CTrax output variables)

framelag

the number of frames to compare angles across; defaults to 1 (consecutive frames)

Details

Uses the major axis angle of the ellipse fit by CTrax (theta) as this turns out to be much more reliable than the angular speed approach based on centroid location, especially when there is little movement.

Assumes that flies don't turn more than 90 degrees, so 'flips' the fly if that results in a lower angle. Note that this assumption is probably true on a frame-by-frame basis; therefore if framelag is set to a value >1, it is calculated as the sum of consecutive (small) spins.

It is currently run across the whole dataset without splitting it by id, as the amount of artefacts should be small, but ideally it would be best to run it with an ave-based design.

Value

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