Skip to content

Commit

Permalink
Moved mortality to the end of processes to resolve order of competing…
Browse files Browse the repository at this point in the history
… hazards.
  • Loading branch information
RJSheppard committed Apr 15, 2024
1 parent 5a81b0b commit 5077d4b
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions R/processes.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ create_processes <- function(
create_exponential_decay_process(variables$iva, parameters$rva),
create_exponential_decay_process(variables$id, parameters$rid)
)

if (parameters$individual_mosquitoes) {
processes <- c(
processes,
Expand All @@ -59,7 +59,7 @@ create_processes <- function(
)
)
}

# ==============================
# Biting and mortality processes
# ==============================
Expand All @@ -80,7 +80,6 @@ create_processes <- function(
mixing,
mixing_index
),
create_mortality_process(variables, events, renderer, parameters),
create_asymptomatic_progression_process(
variables$state,
parameters$dd,
Expand Down Expand Up @@ -112,15 +111,15 @@ create_processes <- function(
0
)
)

# ===============
# ODE integration
# ===============
processes <- c(
processes,
create_solver_stepping_process(solvers, parameters)
)

# =========
# RTS,S EPI
# =========
Expand All @@ -137,7 +136,7 @@ create_processes <- function(
)
)
}

# =========
# PMC
# =========
Expand All @@ -156,7 +155,7 @@ create_processes <- function(
)
)
}

# =========
# Rendering
# =========
Expand Down Expand Up @@ -186,7 +185,7 @@ create_processes <- function(
),
create_compartmental_rendering_process(renderer, solvers, parameters)
)

if (parameters$individual_mosquitoes) {
processes <- c(
processes,
Expand All @@ -208,11 +207,11 @@ create_processes <- function(
)
)
}

# ======================
# Intervention processes
# ======================

if (parameters$bednets) {
processes <- c(
processes,
Expand All @@ -225,14 +224,14 @@ create_processes <- function(
net_usage_renderer(variables$net_time, renderer)
)
}

if (parameters$spraying) {
processes <- c(
processes,
indoor_spraying(variables$spray_time, parameters, correlations)
)
}

# ======================
# Progress bar process
# ======================
Expand All @@ -242,7 +241,12 @@ create_processes <- function(
create_progress_process(timesteps)
)
}


# Mortality step
processes <- c(
processes,
create_mortality_process(variables, events, renderer, parameters))

processes
}

Expand All @@ -266,7 +270,7 @@ create_exponential_decay_process <- function(variable, rate) {
#' @title Create and initialise lagged_infectivity object
#'
#' @param variables model variables for initialisation
#' @param parameters model parameters
#' @param parameters model parameters
#' @noRd
create_lagged_infectivity <- function(variables, parameters) {
age <- get_age(variables$birth$get_values(), 0)
Expand All @@ -283,7 +287,7 @@ create_lagged_infectivity <- function(variables, parameters) {
#'
#' @param variables model variables for initialisation
#' @param solvers model differential equation solvers
#' @param parameters model parameters
#' @param parameters model parameters
#' @noRd
create_lagged_eir <- function(variables, solvers, parameters) {
lapply(
Expand Down

0 comments on commit 5077d4b

Please sign in to comment.