From 3d6909c06eae0eb60aa575372dfea94a861d3d11 Mon Sep 17 00:00:00 2001 From: RJSheppard Date: Thu, 11 Jul 2024 09:28:45 +0100 Subject: [PATCH] Adjusted spacing formatting in recovery rates function and make ifelse statement explicit for vivax in rendering. --- R/disease_progression.R | 16 +++++++++++----- R/render.R | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/R/disease_progression.R b/R/disease_progression.R index 82326776..d922e502 100644 --- a/R/disease_progression.R +++ b/R/disease_progression.R @@ -14,11 +14,17 @@ create_recovery_rates_process <- function( recovery_rates <- variables$recovery_rates$get_values() if (parameters$parasite == "vivax"){ # p.v subpatent recovery is immunity-dependent - recovery_rates[variables$state$get_index_of("U")$to_vector()] <- - 1/anti_parasite_immunity( - parameters$dpcr_min, parameters$dpcr_max, parameters$apcr50, parameters$kpcr, - variables$iaa$get_values(index = variables$state$get_index_of("U")), - variables$iam$get_values(index = variables$state$get_index_of("U")) + + U_index <- variables$state$get_index_of("U") + + recovery_rates[U_index$to_vector()] <- + 1 / anti_parasite_immunity( + min = parameters$dpcr_min, + max = parameters$dpcr_max, + a50 = parameters$apcr50, + k = parameters$kpcr, + iaa = variables$iaa$get_values(index = U_index), + iam =variables$iam$get_values(index = U_index) ) } recovery_outcome$set_rates(recovery_rates) diff --git a/R/render.R b/R/render.R index 68d551ad..b219cdb9 100644 --- a/R/render.R +++ b/R/render.R @@ -35,7 +35,7 @@ create_prevelance_renderer <- function( parameters ) asymptomatic_detected <- bitset_at(asymptomatic, bernoulli_multi_p(prob)) - } else { + } else if (parameters$parasite == "vivax") { asymptomatic_detected <- asymptomatic }