Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding in n_spray output #310

Merged
merged 13 commits into from
May 28, 2024
5 changes: 4 additions & 1 deletion R/mortality_processes.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ reset_target <- function(variables, events, target, state, parameters, timestep)
variables$pev_profile$queue_update(-1, target)
variables$tbv_vaccinated$queue_update(-1, target)

# spraying
variables$spray_time$queue_update(-1, target)

# onwards infectiousness
variables$infectivity$queue_update(0, target)

# treated compartment residence time:
if(!is.null(variables$dt)) {
variables$dt$queue_update(parameters$dt, target)
Expand Down
16 changes: 8 additions & 8 deletions R/processes.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ create_processes <- function(
correlations,
lagged_eir,
lagged_infectivity,
timesteps,
timesteps,
mixing = 1,
mixing_index = 1
) {
Expand Down Expand Up @@ -105,22 +105,22 @@ create_processes <- function(
0
)
)

# =======================
# Antimalarial Resistance
# =======================
# Add an a new process which governs the transition from Tr to S when
# antimalarial resistance is simulated. The rate of transition switches
# from a parameter to a variable when antimalarial resistance == TRUE.

# Assign the dt input to a separate object with the default single parameter value:
dt_input <- parameters$dt
# If antimalarial resistance is switched on, assign dt variable values to the

# If antimalarial resistance is switched on, assign dt variable values to the
if(parameters$antimalarial_resistance) {
dt_input <- variables$dt
}

# Create the progression process for Tr --> S specifying dt_input as the rate:
processes <- c(
processes,
Expand All @@ -143,7 +143,7 @@ create_processes <- function(
)

# =========
# RTS,S EPI
# PEV EPI
# =========
if (!is.null(parameters$pev_epi_coverage)) {
processes <- c(
Expand Down Expand Up @@ -250,7 +250,7 @@ create_processes <- function(
if (parameters$spraying) {
processes <- c(
processes,
indoor_spraying(variables$spray_time, parameters, correlations)
indoor_spraying(variables$spray_time, renderer, parameters, correlations)
)
}

Expand Down
4 changes: 3 additions & 1 deletion R/vector_control.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ prob_bitten <- function(
#' @param parameters the model parameters
htopazian marked this conversation as resolved.
Show resolved Hide resolved
#' @param correlations correlation parameters
#' @noRd
indoor_spraying <- function(spray_time, parameters, correlations) {
indoor_spraying <- function(spray_time, render, parameters, correlations) {
htopazian marked this conversation as resolved.
Show resolved Hide resolved
renderer$set_default('n_spray', 0)
function(timestep) {
matches <- timestep == parameters$spraying_timesteps
if (any(matches)) {
Expand All @@ -116,6 +117,7 @@ indoor_spraying <- function(spray_time, parameters, correlations) {
correlations
))
spray_time$queue_update(timestep, target)
renderer$render('n_spray', length(target), timestep)
}
}
}
Expand Down
Loading