flyclass: Track event classifier

Description Usage Arguments Details Value

Description

Uses speed and location information to classify entries into stand, run or edge events.

Usage

1
flyclass(trx, sep = exp(-1), edge = 12, morph = 7, runlag = 6)

Arguments

trx

a track data frame

sep

the discriminant speed value between runs and stands. Set at e^-1 on the basis of eyeballed data.

edge

the number of pixels from the rim of the arena to be categorised as edge.

morph

the window for morphological operations

runlag

the framelag passed to flyrun in case the speed column is missing

Details

The classification is based on the columns speed (output of flymoves or safemoves) and radius (output of trxgarnish). If these are not already included, they will be calculated ad hoc. Rows with NAs (with the exception of turn, which is tolerated as it is not used for calculations but has more NAs than anything else) are removed, then each point is categorised as either edge or not (by a threshold pixel distance edge) and either run or not (by a threshold pixel/frame speed sep). Short running/standing bouts are eliminated by morphological opening and closing over a window of morph frames. Then, each entry is categorised as either edge, run or stand in the classifier variable whatis - note that there is currently no distinction between runs and stands in the edge region.

Note: currently the opening/closing is not run by id, so there is a bit of spillage between consecutive tracks, but it should only affect ~4 frames on each side. It would still be best to run the function via ave.

Value

a track data frame that includes the boolean columns isedge and isrun and the factor column whatis


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