Skip to content

Commit

Permalink
Minor documentation and performance fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
RJSheppard committed Sep 10, 2024
1 parent 8c28654 commit 7053b8f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions R/human_infection.R
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ calculate_treated <- function(
#' @param drugs drug index
#' @param timestep the current timestep
#' @param renderer simulation renderer
#' @param int_name the intervention name to use for rendering, use "" for frontline treatment
#' @noRd
calculate_successful_treatments <- function(
parameters,
Expand Down
8 changes: 5 additions & 3 deletions R/mda_processes.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ create_mda_listeners <- function(
target <- in_age[sample_intervention(in_age, int_name, coverage, correlations)]

renderer$render(paste0('n_', int_name, '_treated'), length(target), timestep)
treated <- bitset_at(individual::Bitset$new(parameters$human_population)$not(), target)
treated <- individual::Bitset$new(parameters$human_population)$insert(target)

to_move <- calculate_successful_treatments(
parameters,
Expand All @@ -73,7 +73,7 @@ create_mda_listeners <- function(

#' @title Update individuals during MDA/PMC
#' @description Updates individuals disease states, infectivity, dt and drug variables
#' @param target bitset for individuals who have been successfully treated
#' @param target a list containing the successfully treated, the drug used and resistance parameters
#' @param variables the variables available in the model
#' @param parameters the model parameters
#' @param timestep the current timestep
Expand Down Expand Up @@ -101,7 +101,9 @@ update_mass_drug_admin <- function(
to_treated <- clinical$or(asymptomatic$and(detectable))$and(target$successfully_treated)

if(parameters$antimalarial_resistance) {
dt_update_vector <- target$dt_spc_combined[target$successfully_treated$to_vector() %in% to_treated$to_vector()]
dt_update_vector <- target$dt_spc_combined[
target$successfully_treated$copy()$and(to_treated)$to_vector()
]
} else {
dt_update_vector <- parameters$dt
}
Expand Down
2 changes: 1 addition & 1 deletion R/pmc.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ create_pmc_process <- function(
target <- in_age[sample_intervention(in_age, 'pmc', coverage, correlations)]

renderer$render('n_pmc_treated', length(target), timestep)
treated <- bitset_at(individual::Bitset$new(parameters$human_population)$not(), target)
treated <- individual::Bitset$new(parameters$human_population)$insert(target)

to_move <- calculate_successful_treatments(
parameters,
Expand Down

0 comments on commit 7053b8f

Please sign in to comment.