geolight_map | R Documentation |
This functions estimate a likelihood map for each stationary period based on twilight data. The functions performs the following steps:
Perform a calibration on the known stationary period. See below for details
Compute a likelihood map for each twilight using the calibration.
Combine the likelihood maps of all twilights belonging to the same stationary periods with a log-linear pooling. See GeoPressureManual | Probability aggregation for more information on probability aggregation using log-linear pooling.
geolight_map(
tag,
twl_calib_adjust = 1.4,
twl_llp = function(n) log(n)/n,
compute_known = FALSE,
quiet = FALSE
)
tag |
a GeoPressureR |
twl_calib_adjust |
smoothing parameter for the kernel density (see |
twl_llp |
log-linear pooling aggregation weight. |
compute_known |
logical defining if the map(s) for known stationary period should be
estimated based on twilight or hard defined by the known location |
quiet |
logical to hide messages about the progress |
a tag
with the likelihood of light as tag$map_light
Calibration requires to have a known position for a least one stationary periods. Use
tag_set_map()
to define the known position.
Instead of calibrating the twilight errors in terms of duration, we directly model the zenith
angle error. We use a kernel distribution to fit the zenith angle during the known stationary
period(s). The twl_calib_adjust
parameter allows to manually adjust how smooth you want the
fit of the zenith angle to be. Because the zenith angle error model is fitted with data from the
calibration site only, and we are using it for all locations of the bird’s journey, it is safer
to assume a broader/smoother distribution.
Other geolight:
twilight_create()
,
twilight_label_read()
,
twilight_label_write()
withr::with_dir(system.file("extdata", package = "GeoPressureR"), {
# Read geolocator data and build twilight
tag <- tag_create("18LX", quiet = TRUE) |>
tag_label(quiet = TRUE) |>
tag_set_map(
extent = c(-16, 23, 0, 50),
scale = 10,
known = data.frame(
stap_id = 1,
known_lon = 17.05,
known_lat = 48.9
)
)
# Compute the twilight
tag <- twilight_create(tag) |> twilight_label_read()
# Compute likelihood map
tag <- geolight_map(tag, quiet = TRUE)
})
plot(tag, type = "map_light")
# Calibration kernel fit can be retrieved from
twl_calib <- tag$param$geolight_map$twl_calib
library(ggplot2)
x_lim <- range(twl_calib$x[twl_calib$y > .001 * max(twl_calib$y)])
line_data <- data.frame(
x = twl_calib$x,
y = twl_calib$y / max(twl_calib$y) * max(twl_calib$hist_count)
)
line_data <- line_data[line_data$x >= x_lim[1] & line_data$x <= x_lim[2], ]
ggplot() +
geom_bar(aes(x = twl_calib$hist_mids, y = twl_calib$hist_count),
stat = "identity", fill = "lightblue", color = "blue",
width = diff(twl_calib$hist_mids)[1]
) +
geom_line(data = line_data, aes(x = x, y = y), color = "red", linewidth = 1) +
labs(x = "Solor zenith angle", y = "Count of twilights") +
theme_minimal() +
xlim(x_lim) +
theme(legend.position = "none")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.