Several cameras do not allow for the capture of motion detection and timelapse images.
As a result, if cameras are set for motion detection, we cannot capture a daily timelapse image for environmental data.
This daily timelapse image is also what is used to calculate trap days.
Without trap day values we cannot calculate relative activity indices.
Current solution (May 2024):
The following script will take a dataset with no records of timelapse trigger modes, and add a record for each day between the first and last images each camera takes. The assumption is being made that cameras were operational during this entire period.
This script should be added the function for calculating relative activity index for sample sessions (_sample_rai(tl_image_data)_)
##Create a dummy dataset of daily timelapse images that can be added to the dataset that has no timelapse images. This assumes the camera was active every day and so makes a timelapse record for each deployment label from the date of the first motion detection to the date of the final motion detection.
While the above solution works, once there are enough outstanding improvements to warrant a more concerted effort on the entire package this should be more formally addressed.
Issue background:
Current solution (May 2024):
##Create a dummy dataset of daily timelapse images that can be added to the dataset that has no timelapse images. This assumes the camera was active every day and so makes a timelapse record for each deployment label from the date of the first motion detection to the date of the final motion detection.
library(dplyr) library(tidyr)
mock_tl <- group_by(image_data, study_area_name, sample_station_label, deployment_label) |> summarise( min_date = min(as.Date(date_time), na.rm = TRUE), max_date = max(as.Date(date_time), na.rm = TRUE), .groups = "keep" ) |> expand( date = as.Date(min_date:max_date) ) |> mutate( date_time = as.POSIXct(paste(date, "12:00:00"), tz = "UTC"), trigger_mode = "Time Lapse", lens_obscured = FALSE ) |> select(-date)
##Join the mock Time Lapse dataset onto the original dataset (with no timelapse) images
tl_image_data <- bind_rows(image_data, mock_tl) |> arrange(date_time)
Long-term Solution: