Skip to contents

Keeps only rows falling inside a window of duration seconds, repeating every interval.

Usage

subsampleSimInTime(
  cht,
  minDate = NULL,
  maxDate = NULL,
  interval = "41 hour",
  duration = 3600,
  timeCol = "t0"
)

Arguments

cht

A capture history table (from simsTocaptureHistoryTable) or a simulation data.frame (from simulateDetector).

minDate

POSIXct start of the first subsample window. Defaults to the earliest time in cht.

maxDate

POSIXct beyond which no further windows start. Defaults to the latest time in cht.

interval

difftime interval between window starts, e.g. '41 hour'.

duration

Length of each window in seconds. Default 3600.

timeCol

Name of the time column. Default 't0', falling back to 'datetime' when absent. A numeric column is treated as a MATLAB datenum and converted with mat2Rdate; a POSIXct column is used as-is.

Value

cht, with only the rows falling inside a window.

Details

The default timeCol is 't0', matching matchbox's own convention and the output of simsTocaptureHistoryTable. Subsampling belongs on the merged capture history table, which is the object cde consumes. Subsampling each detector separately and merging afterwards works, but does more work for the same result and gives every detector its own set of fabricated false positives to be merged around. When 't0' is absent the function falls back to 'datetime', so a raw simulateDetector table still works unchanged.