From fb3a8cc61cb67b36af4e3e374bf60527a8b921a6 Mon Sep 17 00:00:00 2001 From: Matthew Fidler Date: Thu, 17 Oct 2024 15:13:14 -0500 Subject: [PATCH] Return the poped.db (and update for shrinkage) --- R/poped.R | 8 +++++--- tests/testthat/test-poped.R | 4 ---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/R/poped.R b/R/poped.R index fd06dc0a..dcc8f317 100644 --- a/R/poped.R +++ b/R/poped.R @@ -336,15 +336,15 @@ rxUiGet.popedFfFun <- function(x, ...) { # be in the right order if (.lu <= .(.poped$maxn)) { # only check for time reset if it is specified in the model + poped.db <- .popedRxRunSetup(poped.db) .p <- babelmixr2::popedMultipleEndpointParam(p, .u, model_switch, .(.poped$maxn), poped.db$babelmixr2$optTime) - .popedRxRunSetup(poped.db) .ret <- .popedSolveIdME(.p, .u, .xt, model_switch, .(length(.predDf$cond)), .id-1, .totn) } else if (.lu > .(.poped$maxn)) { .p <- p[-1] - .popedRxRunFullSetupMe(poped.db, .xt, model_switch) + poped.db <- .popedRxRunFullSetupMe(poped.db, .xt, model_switch) .ret <- .popedSolveIdME2(.p, .u, .xt, model_switch, .(length(.predDf$cond)), .id-1, .totn) } @@ -423,7 +423,7 @@ attr(rxUiGet.popedFfFun, "desc") <- "PopED parameter model (ff_fun)" .poped$setup <- 1L .poped$fullXt <- NULL } - invisible() + invisible(popedDb) } #' Setup a full solve for a multiple-endpoint model #' @@ -493,6 +493,7 @@ attr(rxUiGet.popedFfFun, "desc") <- "PopED parameter model (ff_fun)" .poped$curNumber <- popedDb$babelmixr2$modelNumber .poped$setup <- 2L } + popedDb } #' Setup for a full solve with a single endpoint model #' @@ -559,6 +560,7 @@ attr(rxUiGet.popedFfFun, "desc") <- "PopED parameter model (ff_fun)" .poped$curNumber <- popedDb$babelmixr2$modelNumber .poped$setup <- 2L } + popedDb } #' This gets the epsi associated with the nlmixr2/rxode2 model specification diff --git a/tests/testthat/test-poped.R b/tests/testthat/test-poped.R index c8f4bc62..c4f1596b 100644 --- a/tests/testthat/test-poped.R +++ b/tests/testthat/test-poped.R @@ -324,14 +324,11 @@ if (requireNamespace("PopED", quietly=TRUE)) { tKa <- 0.25 tCl <- 3.75 tF <- fix(0.9) - eta.v ~ 0.09 eta.ka ~ 0.09 eta.cl ~0.25^2 - prop.sd <- fix(sqrt(0.04)) add.sd <- fix(sqrt(5e-6)) - }) model({ V<-tV*exp(eta.v) @@ -343,7 +340,6 @@ if (requireNamespace("PopED", quietly=TRUE)) { (exp(-CL/V * (time - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - exp(-CL/V * TAU)) - exp(-KA * (time - (N - 1) * TAU)) * (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU))) - y ~ prop(prop.sd) + add(add.sd) }) }