Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
^README\.Rmd$
^GeoTwilightR\.Rproj$
^codemeta\.json$
^LICENSE$
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ message: 'To cite package "GeoPathSampleR" in publications use:'
type: software
license: GPL-3.0-or-later
title: 'GeoPathSampleR: Posterior Sampling of Geolocator Paths'
version: 0.1.0.9000
version: 0.2.0
doi: 10.5281/zenodo.21944194
abstract: Reconstructs bird migration trajectories from stationary-period likelihood
maps built with GeoPressureR. A Gibbs sampler combines residence-dependent departure,
Expand Down Expand Up @@ -89,8 +89,8 @@ references:
given-names: Mathieu
email: mathieu@mgravey.com
orcid: https://orcid.org/0000-0002-0871-1507
year: '2026'
version: '>= 3.6.0'
year: '2026'
- type: software
title: ggplot2
abstract: 'ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics'
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: GeoPathSampleR
Title: Posterior Sampling of Geolocator Paths
Version: 0.1.0.9000
Version: 0.2.0
Authors@R:
person("Raphaël", "Nussbaumer", , "rafnuss@gmail.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-8185-1020"))
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@

## Main

- [Add boundary sweeps to resample movement timing while retaining residence-segment locations](https://github.com/GeoPressure/GeoPathSampleR/commit/f15e91e), enabled every iteration by default with `boundary_interval = 1`. Use `0` or `Inf` to disable them.

- [Update the default ground-speed and residence-dependent departure parameters](https://github.com/GeoPressure/GeoPathSampleR/commit/d40999d) from the pooled multi-sensor calibration. Results sampled with the previous defaults should be recomputed before comparison.
- [Replace the route-detour model with a Gamma prior on route excess](https://github.com/GeoPressure/GeoPathSampleR/commit/7d4fb3f) whose scale depends on interval duration and direct endpoint distance ([3798978](https://github.com/GeoPressure/GeoPathSampleR/commit/3798978)). The prior applies to intervals with at least two movement days and endpoints at least 300 km apart, with predictors limited to the empirical calibration support.
- Export `sampling_path_default_movement()` and document the movement model, `route_detour` and the modular cut of `long_period_light_only` in `sampling_path()`.

## Minor

- Exclude the redundant repository GPL text from the R source package to resolve its package-check note.

- [Fix known locations on water cells, stabilise the prior for direct routes, and reject excluded stationary periods](https://github.com/GeoPressure/GeoPathSampleR/commit/49e7735).
- [Speed up route-prior evaluation, path summaries and diagnostics](https://github.com/GeoPressure/GeoPathSampleR/commit/6da2d15), and [avoid replicating scalar movement endpoints](https://github.com/GeoPressure/GeoPathSampleR/commit/0b989d1).
- Document boundary sweeps, the complete sampler update schedule, route-prior support and computational controls in the function reference and getting-started vignette.

- [Fix the diagnostic report rendering and browser opening](https://github.com/GeoPressure/GeoPathSampleR/commit/fb0d61f), and [declare its optional report dependencies](https://github.com/GeoPressure/GeoPathSampleR/commit/3ff7a89).
- [Align the README and vignette with the movement model and sampler controls](https://github.com/GeoPressure/GeoPathSampleR/commit/ae3f0de), and add a provisional citation for the submitted methods manuscript alongside the software citation.
- [Format the elapsed time compactly in the sampling message](https://github.com/GeoPressure/GeoPathSampleR/commit/38fe161).
Expand Down
2 changes: 1 addition & 1 deletion R/path_collapse.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @param stap A stationary-period data frame containing `stap_id`, `start`,
#' and `end`. If `NULL`, these columns are taken from `paths`.
#' @param label_stap_id logical; if `TRUE`, replace `stap_id` in the output
#' with a character label of the form `"{stap_id_start}->{stap_id_end}`.
#' with a character label of the form `"{stap_id_start}->{stap_id_end}"`.
#' The numeric `stap_id_start` and `stap_id_end` columns are always kept.
#'
#' @return A data frame with one row per collapsed stay and columns
Expand Down
45 changes: 29 additions & 16 deletions R/path_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,31 @@ path_summary <- function(
}

if (by == "stap") {
row_by_stap <- split(
seq_len(nrow(paths)),
factor(paths$stap_id, levels = stap_id)
)
out <- do.call(
rbind,
lapply(stap_id, function(id) {
df <- paths[paths$stap_id == id, , drop = FALSE]
pos <- position_summary(df)
data.frame(
stap_id = id,
stap_id_start = id,
stap_id_end = id,
ind = as.integer(pos[["ind"]]),
lat = pos[["lat"]],
lon = pos[["lon"]],
start = stap$start[match(id, stap$stap_id)],
end = stap$end[match(id, stap$stap_id)],
n_path = length(unique(path_id[paths$stap_id == id]))
)
})
Map(
function(id, row_i) {
df <- paths[row_i, , drop = FALSE]
pos <- position_summary(df)
data.frame(
stap_id = id,
stap_id_start = id,
stap_id_end = id,
ind = as.integer(pos[["ind"]]),
lat = pos[["lat"]],
lon = pos[["lon"]],
start = stap$start[match(id, stap$stap_id)],
end = stap$end[match(id, stap$stap_id)],
n_path = length(unique(path_id[row_i]))
)
},
stap_id,
row_by_stap
)
)
row.names(out) <- NULL
return(out)
Expand All @@ -114,11 +122,16 @@ path_summary <- function(
group_start <- match(seq_len(max(group)), group)
group_end <- c(group_start[-1L] - 1L, n_stap)

row_by_group <- split(
seq_len(nrow(paths)),
group[match(paths$stap_id, stap_id)]
)

out <- do.call(
rbind,
lapply(seq_along(group_start), function(i) {
ids <- stap_id[group_start[i]:group_end[i]]
df <- paths[paths$stap_id %in% ids, , drop = FALSE]
df <- paths[row_by_group[[i]], , drop = FALSE]
pos <- position_summary(df)
data.frame(
stap_id = ids[1L],
Expand Down
Loading
Loading