SNBvsVid_v2: Pipeline function to compare video and SNB data

View source: R/A_VideoVsEvents.r

SNBvsVid_v2R Documentation

Pipeline function to compare video and SNB data

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

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:

  • videoEvaluation_v2 which loads all SNB and Video data, unifies the times, merges the datasets and prepares the first 6 list items of the output.

  • videoTimeCheck_v2 which calculates from individual "INs" and "OUTs" at which times a birds was at the nestbox

  • checkIn_v2 which returns the 7th list item of the output

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

##not run
#create connection
require(dbo)
con = dbcon() #or other connection to database

#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 Sept. 17, 2024, 4:27 p.m.