DTUAqua/spict

Simulation function does not retain all provided info

Opened this issue · 0 comments

´sim.spict´ drops most of the provided input, sometimes leading to wrong inp objects. Other quantities like management options are also silently dropped.

This is true for ´use_tmb=FALSE´ which is the default now, maybe using the new TMB simulation functionality does not have those issues.

ReprEx

set.seed(123)
nt <- 50
inp <- list(nseasons=4, splineorder=3)
s1 <- seq(0, nt/2-1, by=1)
s2 <- seq(nt/2, nt-1/inp$nseasons, by=1/inp$nseasons)
inp$timeC <- c(s1,s2)
inp$dtc <- c(rep(1, length(s1)),
             rep(0.25, length(s2)))
inp$timeI <- seq(0.1, nt-1/inp$nseasons, by=0.5)
inp$ini <- list(logK=log(1000), logm=log(123), logq=log(1), logn=log(2),
                logbkfrac=log(0.6), logsdf=log(0.2), logF0=log(0.4),
                logphi=log(c(0.3, 0.5, 1.8)))
inp$dteuler <- 1/8 ## Does not converge with 1/4
inpsim <- sim.spict(inp, verbose = TRUE)

inpsim$dtc
## NULL

inpsim <- check.inp(inpsim)
##   [1] 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25
##  [38] 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25
##  [75] 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25
## [112] 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25

## Wrong dtc!