Skip to content

Commit

Permalink
Removed unnecessary code from ls prophylaxis calculation, with corres…
Browse files Browse the repository at this point in the history
…ponding aspect of vivax drug test.
  • Loading branch information
RJSheppard committed Nov 12, 2024
1 parent 9ad598f commit 8930897
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
1 change: 0 additions & 1 deletion R/human_infection.R
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,6 @@ ls_treatment_prophylaxis_efficacy <- function(

ls_drug <- variables$ls_drug$get_values(bite_infections)
ls_medicated <- ls_drug > 0
ls_medicated[ls_medicated] <- !is.na(parameters$drug_hypnozoite_efficacy[ls_drug])

if (any(ls_medicated)) {
ls_drug <- ls_drug[ls_medicated]
Expand Down
17 changes: 8 additions & 9 deletions tests/testthat/test-vivax.R
Original file line number Diff line number Diff line change
Expand Up @@ -345,18 +345,17 @@ test_that('Drug functions provide warnings if applied incorrectly', {

test_that('Liver stage prophylaxis functions correctly', {

bite_infections <- individual::Bitset$new(4)$insert(1:4)
bite_infections <- individual::Bitset$new(3)$insert(1:3)

variables <- list(
ls_drug = individual::DoubleVariable$new(c(0,1,2,3)),
ls_drug_time = individual::DoubleVariable$new(c(-1,1,1,1))
ls_drug = individual::DoubleVariable$new(c(0,1,2)),
ls_drug_time = individual::DoubleVariable$new(c(-1,1,1))
)

parms <- get_parameters(parasite = "vivax") |>
set_drugs(drugs = list(CQ_params_vivax, CQ_PQ_params_vivax, CQ_TQ_params_vivax)) |>
set_drugs(drugs = list(CQ_PQ_params_vivax, CQ_TQ_params_vivax)) |>
set_clinical_treatment(drug = 1, timesteps = 0, coverages = 0.3) |>
set_clinical_treatment(drug = 2, timesteps = 0, coverages = 0.3) |>
set_clinical_treatment(drug = 3, timesteps = 0, coverages = 0.3)
set_clinical_treatment(drug = 2, timesteps = 0, coverages = 0.3)

timestep <- 6

Expand All @@ -369,11 +368,11 @@ test_that('Liver stage prophylaxis functions correctly', {

expect_identical(
ls_prophylaxis,
c(0, 0,
c(0,
weibull_survival(
c(5,5),
parms$drug_hypnozoite_prophylaxis_shape[c(2, 3)],
parms$drug_hypnozoite_prophylaxis_scale[c(2, 3)]
parms$drug_hypnozoite_prophylaxis_shape[c(1, 2)],
parms$drug_hypnozoite_prophylaxis_scale[c(1, 2)]
)
)
)
Expand Down

0 comments on commit 8930897

Please # to comment.