SNBvsVid_v2: Pipeline function to compare video and SNB data

Description Usage Arguments Details Value Author(s) Examples

View source: R/A_VideoVsEvents.r

Description

Calls a set of sub-functions to extract data on the match of video data and SNB data of the corresponding dates and times. This function is meant as an easy wrapper for users to assess the advantages and disadvantages of specific parameter settings for the functions that extract SNB events (INs and OUTs).

Usage

1
SNBvsVid_v2(con, timescale, ...)

Arguments

con

A connection to the database

timescale

The timescale (in seconds) within which the fit with the video data is calculated (only relevant for the last output "Match of SNB and Video data by unit of time").

...

Any parameters that can be set for the function events_v2()

Details

The function calls the following functions:

Value

List of length 7 with the following slots:

Time difference summary

Summary of the time differences between Video and SNB data. Note that the time of the videos is here only scored to the minute.

Quality of transponder assignment

Vector of length 3:

  1. Total number of video events without a fitting transponder

  2. Number of video events with a fitting SNB event but without a fitting transponder

  3. Same as before, but excluding SNB direction = "FRONT"

Best fit SNB to video

Dataset where each video event is matched with the SNB event that fits best in time.

Best fit video to SNB

Dataset where each SNB event is matched with the video event that fits best in time.

SNB data

SNB events as calculated by the events_v2() function

Video data

Video events as scored in the videos. The script that fetches and processes the raw video data can be found in the inst folder of this package.

Match of SNB and Video data by unit of time

A data.table where each row represents a unit of time as specified by the argument "timescale", and with the following columns:

  • time_ The time in seconds.

  • videoIn 1 if there was any video activity during the specific unit of time, else 0

  • snbIn 1 if there was any snb activity during the specific unit of time, else 0

  • snbParentsIn 1 if there was any snb activity of a parental transponder during the specific unit of time, else 0

  • box Box number

  • date_ date_

  • time_2as.POSIXct(time_)

  • timescaleThe timescale as specified in the arguments.

  • COLColour specification for plot method

Author(s)

LS

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
##not run
#create connection
con = dbcon('YOUR_USER_NAME')

#Set the variables you want to check
check = SNBvsVid_v2(con, timescale = 2, max_distance = 30)

check[[1]]
#--> the max. difference between SNB and video data is less than 1 minute.

check[[2]]/nrow(check[[6]])
#--> proportion of transponders missed based on definition (see section "Value")

#Plot method by unit of time
plot(check[[7]], ParentsOnly = FALSE) #All SNB data
plot(check[[7]], ParentsOnly = TRUE)  #Only SNB data with the parental transponder
#Note that for each box and date the upper row of points represents SNB activity without corresponding video activity, the bottom row of points represents Video activity without corresponding SNB activity and the middle row represents data that match. Activity within 1 unit of time  to activity scored via the other method is still marked green.

#table of consistency of SNB vs. video data per unit of time
table(check[[7]][, list(videoIn, snbIn)])

#table of consistency of SNB vs. video data, if a mismatch by 1 unit of time is "ok"
table(check[[7]][,COL]) #"green" = ok, "blue" = event in video, but not SNB data, "red" = event in SNB not video data

#table which (detailed) SNB directions are merged with which directions in the video data
table(check[[4]][,list(snb_action_detail, vid_action)])

#table how detailed SNB directions are translated into non-detailed directions
table(check[[4]][,list(snb_action_detail, snb_action)])

mpio-be/SNB2 documentation built on March 27, 2020, 8:33 p.m.