Skip to content

Commit

Permalink
normalise signal strengths
Browse files Browse the repository at this point in the history
  • Loading branch information
g-rppl committed May 22, 2024
1 parent a6356af commit d5acbd2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions R/locate.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ locate <- function(
d$ts <- round_date(d$ts, unit = paste(dtime, "min"))

d <- d |>
mutate(sig = sig - min(sig)) |>
group_by(ID, ts) |>
mutate(
lon = weighted.mean(.data$lon, sig),
Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/test-locate.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ test_that("locate result", {
expect_equal(ncol(loc), 7)
expect_true(is.POSIXct(loc$ts))

expected <- c(1224.244547, 8657.852526, 9.210950, 6.063194, 149.358945)
expected <- c(
1224.17860790, 8657.90549885, 9.18330504, 6.07470543, 149.358945
)
expect_equal(colSums(loc[-c(1:2)]), expected, ignore_attr = TRUE)
})

0 comments on commit d5acbd2

Please sign in to comment.