Skip to content

Commit

Permalink
v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marchtaylor committed Oct 15, 2019
1 parent e7370c8 commit 75bbdcc
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 18 deletions.
37 changes: 20 additions & 17 deletions R/war.FLIBM.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#' set.seed(1111)
#' res <- war.FLIBM(obj = stkMed, qs = c(0.1, 0.9),
#' FM = 0.2, years = ac(1980:1985),
#' monitor = FALSE, plot = TRUE)
#' monitor = TRUE, plot = TRUE)
#'
#' ## estimated values
#' res$war # width at recruitment
Expand Down Expand Up @@ -71,7 +71,7 @@ war.FLIBM <- function(
obj$stock.l@catch.n[] <- NaN
obj$stock.l@harvest[] <- NaN

obj$inds[[1]][[1]][[1]] <- data.table::data.table()
obj$inds <- data.table::data.table()
obj$rec$covar[] <- 0
obj$rec$covar[,FLCore::ac(years[1])] <- 1
recr.season <- seq(DIM[4])*NaN
Expand All @@ -80,9 +80,9 @@ war.FLIBM <- function(

for (year in years) {
for (season in DIMNAMES$season) {
unit <- DIMNAMES$unit[1]
area <- DIMNAMES$area[1]
iter <- DIMNAMES$iter[1]
# unit <- DIMNAMES$unit[1]
# area <- DIMNAMES$area[1]
# iter <- DIMNAMES$iter[1]

if (year == years[1]) {
yeardec <- as.numeric(year) + (as.numeric(season) -
Expand All @@ -97,9 +97,10 @@ war.FLIBM <- function(
}
tincr <- yeardec2 - yeardec
ARGS.x <- list(yeardec = yeardec, yeardec2 = yeardec2,
date = date, tincr = tincr, year = year,
unit = unit, season = season, area = area,
iter = iter, ssbfec = ssbfec)
date = date, tincr = tincr,
year = year, season = season,
# unit = unit, area = area, iter = iter,
ssbfec = ssbfec)
ARGS.x <- c(ARGS.x, obj$rec$params)
args.incl <- which(names(ARGS.x) %in% names(formals(obj$rec$model)))
ARGS.x <- ARGS.x[args.incl]
Expand All @@ -109,18 +110,20 @@ war.FLIBM <- function(
if (n.recruits > 0) {
newinds <- obj$make.inds(n = n.recruits,
obj = obj)
obj$inds[[1]][[1]][[1]] <- data.table::rbindlist(list(obj$inds[[1]][[1]][[1]],
obj$inds <- data.table::rbindlist(list(obj$inds,
newinds))
}
}
if (nrow(obj$inds[[1]][[1]][[1]]) > 0) {
obj <- FLIBM::adv.FLIBM(obj = obj, year = year,
season = season, unit = unit, area = area,
iter = iter, monitor = monitor)

qres <- quantile(obj$inds[[1]][[1]][[1]]$length, prob = qs, na.rm=TRUE)
qlower[, year, unit, season, area, iter] <- qres[1]
qupper[, year, unit, season, area, iter] <- qres[2]
if (nrow(obj$inds) > 0) {
obj <- FLIBM::adv.FLIBM(obj = obj,
year = year,
season = season,
# unit = unit, area = area, iter = iter,
monitor = monitor)

qres <- quantile(obj$inds$length, prob = qs, na.rm=TRUE)
qlower[, year, 1, season, 1, 1] <- qres[1]
qupper[, year, 1, season, 1, 1] <- qres[2]
}
}
}
Expand Down
Binary file modified data/stk1.rda
Binary file not shown.
Binary file modified data/stkMed.rda
Binary file not shown.
18 changes: 18 additions & 0 deletions inst/doc/news.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
### FLIBM 0.3.0

---

##### New features
- Major change: FLIBM object now holds inds within a single level list
(`obj$inds`) with `obj$inds$unit` and `obj$inds$area` as individual
variables. `iter` dimension is no longer used as multiple iterations
drastically slow down the simulation. It is now recommended that nultiple
iterations be done in individual objects (and multiple R instances),
whose FLQuant objects can be combined later. The new fomulation will
more easily allow for the definition of unit and area specific funcitons
(e.g. sex-specific growth, mortality etc.)


<br><br>


### FLIBM 0.2.0

---
Expand Down
2 changes: 1 addition & 1 deletion man/war.FLIBM.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 75bbdcc

Please sign in to comment.