Learn R Programming

callsync (version 0.2.3)

call.assign: call.assign

Description

Assigns calls from a detection table. Or rather removes calls that are not the loudest and returns the cleaned detection table. Uses fine alignment and energy content.

Usage

call.assign(
  all_files = NULL,
  detections = NULL,
  save_files = TRUE,
  path_calls = NULL,
  ffilter_from = 1100,
  wing = 5,
  step_size = 0.01,
  assign_fraq = 0.05,
  save_wing = 0.1,
  quiet = FALSE
)

Value

Returns a data frame with file = file name, start = start time in samples and end = end time in samples for each detection.

Arguments

all_files

character vector, should contain all the paths to the raw recordings that should be considered. If `NULL` files are loaded from `path_chunks`.

detections

data frame with start = start time in samples and end = end time in samples for each detection.

save_files

logical, if `TRUE` the files are stored in the `path_chunks` location. Results are also returned.

path_calls

character, path to where to store the results.

ffilter_from

numeric, frequency in Hz for the high-pass filter.

wing

numeric, the duration in seconds to load before and after each detection to improve alignment. This is not saved with the aligned call.

step_size

numeric, duration in seconds of the bins for signal compression before cross correlation. Default is `0.01`.

assign_fraq

numeric between 0 and 1, how much louder does the focal needs to be than the second loudest track to be accepted. Default is `0.05` and accepts if the focal is just 0.05 louder.

save_wing

numeric, how much extra to export before and after a detection to make sure the whole call is included in seconds. Default is `0.1`.

quiet

logical, if `TRUE` no messages are printed.

Examples

Run this code
if (FALSE) {
require(callsync)
require(seewave)
require(tuneR)
path_git = 'https://raw.githubusercontent.com'
path_repo = '/simeonqs/callsync/master/tests/testthat/files'
file_1 = '/chunk@1@1@1@1.wav'
file_2 = '/chunk@2@1@1@1.wav'
url_1 = paste0(path_git, path_repo, file_1)
url_2 = paste0(path_git, path_repo, file_2)
local_file_1 = paste(tempdir(), file_1, sep = '/')
local_file_2 = paste(tempdir(), file_2, sep = '/')
if(!file.exists(local_file_1))
  download.file(url_1, destfile = local_file_1, mode = 'wb',)
if(!file.exists(local_file_2))
  download.file(url_2, destfile = local_file_2, mode = 'wb')
all_files = c(local_file_1, local_file_2)
detections = lapply(all_files, function(file){
  wave = load.wave(file, ffilter_from = 1100)
  detections = call.detect.multiple(wave, plot_it = FALSE)
  return(detections)
})
names(detections) = basename(all_files)
ca = call.assign(all_files = all_files,
                 detections = detections,
                 quiet = TRUE,
                 save_files = FALSE)
}

Run the code above in your browser using DataLab