View source: R/detection_distance.R
detection_distance | R Documentation |
detection_distance
detection distance of sounds.
detection_distance(
X,
cores = getOption("mc.cores", 1),
pb = getOption("pb", TRUE),
hop.size = getOption("hop.size", 11.6),
wl = getOption("wl", NULL),
path = getOption("sound.files.path", "."),
spl = NULL,
spl.cutoff = NULL,
temp = 20,
rh = 60,
pa = 101325,
hab.att.coef = 0.02,
max.distance = 1000,
resolution = 0.1,
subtract.bgn = TRUE,
envelope = c("abs", "hil"),
mar = NULL
)
X |
The output of |
cores |
Numeric vector of length 1. Controls whether parallel computing is applied by specifying the number of cores to be used. Default is 1 (i.e. no parallel computing). Can be set globally for the current R session via the "mc.cores" option (see |
pb |
Logical argument to control if progress bar is shown. Default is |
hop.size |
A numeric vector of length 1 specifying the time window duration (in ms). Default is 11.6 ms, which is equivalent to 512 wl for a 44.1 kHz sampling rate. Ignored if 'wl' is supplied. Can be set globally for the current R session via the "hop.size" option (see |
wl |
a vector with a single even integer number specifying the window length of the spectrogram, default is |
path |
Character string containing the directory path where the sound files are found. Only needed when 'X' is not an extended selection table. If not supplied the current working directory is used. Can be set globally for the current R session via the "sound.files.path" option (see |
spl |
A numeric vector of length 1 specifying the sound pressure level of sounds. If not supplied then it will be measured from the sounds themselves. |
spl.cutoff |
A numeric vector of length 1 specifying the sound pressure level cutoff to define if the sound is no longer detected. Ideally it should be estimated based on the sound detection threshold of the species. |
temp |
Numeric vector of length 1 with frequency (in Celsius). Default is 20. |
rh |
Numeric vector of length 1 with relative humidity (in percentage). Default is 60. |
pa |
Numeric vector of length 1 with ambient pressure in Pa (standard: 101325, default). Used for Atmospheric attenuation. |
hab.att.coef |
Attenuation coefficient of the habitat (in dB/kHz/m). |
max.distance |
Numeric vector of length 1 with the maximum distance (in m) at which detection would be evaluated. Note that the function calculates the expected sound pressure level values along a vector of distances to find the distance at which the expected sound pressure level equates 'spl.cutoff'. Default is 1000 m. |
resolution |
Numeric vector of length 1 with the distance resolution (in m) for estimated detection distance. Higher resolutions take longer to estimate. Default is 0.1 m. |
subtract.bgn |
Logical argument to control if SPL from background noise is excluded from the measured signal SPL. Default is |
envelope |
Character string vector with the method to calculate amplitude envelopes (in which SPL is measured, used required if 'spl' is not supplied), as in |
mar |
numeric vector of length 1. Specifies the margins adjacent to the start and end points of selection over which to measure background noise. This is required to subtract background noise sound pressure level (so only needed when 'subtract.bgn = TRUE'). |
The function computes the maximum distance at which a sound would be detected, which is calculated as the distance in which the sound pressure level (SPL) goes below the specified SPL cutoff ('spl.cutoff')). This is returned as an additional column 'detection.distance' (in m). The function uses internally attenuation
to estimate SPL at increasing values until it reaches the defined cutoff. The peak frequency (calculated on the power spectrum of the reference sound) of the reference sound for each sound ID is used as the carrier frequency for distance estimation. The sound recorded at the lowest distance is used as reference. This function assumes that all recordings have been made at the same recording volume.
Object 'X' with an additional column, 'detection.distance', containing the computed detection distances (in m).
Marcelo Araya-Salas (marcelo.araya@ucr.ac.cr)
Araya-Salas M., E. Grabarczyk, M. Quiroz-Oliva, A. Garcia-Rodriguez, A. Rico-Guevara. (2023), baRulho: an R package to quantify degradation in animal acoustic signals .bioRxiv 2023.11.22.568305.
Clark, C.W., Marler, P. & Beeman K. (1987). Quantitative analysis of animal vocal phonology: an application to Swamp Sparrow song. Ethology. 76:101-115.
attenuation
Other quantify degradation:
blur_ratio()
,
envelope_correlation()
,
plot_blur_ratio()
,
plot_degradation()
,
set_reference_sounds()
,
signal_to_noise_ratio()
,
spcc()
,
spectrum_blur_ratio()
,
spectrum_correlation()
,
tail_to_signal_ratio()
## Not run:
# load example data
data("test_sounds_est")
# add reference to X
X <- set_reference_sounds(X = test_sounds_est)
detection_distance(X = X[X$distance %in% c(1, 10), ], spl.cutoff = 5, mar = 0.05)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.