Skip to content

Commit

Permalink
adding in n_spray output
Browse files Browse the repository at this point in the history
- adding spraying to mortality processes
- renaming process from RTS,S to PEV
  • Loading branch information
htopazian committed May 21, 2024
1 parent 25c0956 commit 6008a8a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
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
#' @param correlations correlation parameters
#' @noRd
indoor_spraying <- function(spray_time, parameters, correlations) {
indoor_spraying <- function(spray_time, render, parameters, correlations) {
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

1 comment on commit 6008a8a

@htopazian
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignoring whitespace

Please sign in to comment.