Skip to content

Commit

Permalink
merge sim_fit fix from master
Browse files Browse the repository at this point in the history
Merge branch 'master' into staging

# Conflicts:
#	DESCRIPTION
  • Loading branch information
Ian Jonsen committed Apr 29, 2024
2 parents 851f9f8 + 691a06a commit 8bee1c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: aniMotum
Title: Fit Continuous-Time State-Space and Latent Variable Models for Quality Control of Argos Satellite (and Other) Telemetry Data and for Estimating Changes in Animal Movement
Version: 1.2-05.9001
Date: 2024-02-26
Date: 2024-04-29
Authors@R:
c(
person(given = "Ian",
Expand Down
11 changes: 5 additions & 6 deletions R/sim_fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ sim_fit <-
mu
}
}

## set up simulation extents
if(!is.null(grad)) {
ex <- ext(grad[[1]])
ex <- ext(grad)
} else {
## approx extents of world mercator in km
ex <- c(-20077.51,20082.49,-19622.54,18437.46)
Expand Down Expand Up @@ -206,8 +206,7 @@ sim_fit <-

mu1 <- reflect_y(mu1, ex[3:4])
if(!is.null(grad)) {
pv <- as.numeric(c(extract(grad[[1]], rbind(mu1))[1],
extract(grad[[2]], rbind(mu1))[1]))
pv <- as.numeric(extract(grad, rbind(mu1)))

if(all(is.na(pv))) pv <- c(0,0) # unsure why NA's can creep in here
mu[i,] <- mu1 + pv * beta
Expand Down Expand Up @@ -262,8 +261,8 @@ sim_fit <-
mu1 <- wrap_x(mu[i-1,] + dxy, ex[1:2])
mu1 <- reflect_y(mu1, ex[3:4])
if(!is.null(grad)) {
pv <- as.numeric(c(extract(grad[[1]], rbind(mu1))[1],
extract(grad[[2]], rbind(mu1))[1]))
pv <- as.numeric(extract(grad, rbind(mu1)))
if(all(is.na(pv))) pv <- c(0,0) # unsure why NA's can creep in here
mu[i,] <- mu1 + pv * beta
} else {
mu[i,] <- mu1
Expand Down

0 comments on commit 8bee1c9

Please sign in to comment.