Skip to content

Commit

Permalink
Merge pull request #54 from dd-harp/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
slwu89 authored Nov 17, 2022
2 parents 5fdda5f + b9e4800 commit f194e91
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 26 deletions.
2 changes: 1 addition & 1 deletion R/diffeqn.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ xDE_diffeqn <- function(t, y, pars, EIR_delta = NULL, kappa_delta = NULL) {
# bloodmeal

# EIR: entomological inoculation rate
EIR <- F_EIR(t, y, pars)
EIR <- F_EIR(t, y, pars, MosyBehavior)
if (!is.null(EIR_delta)) {
EIR <- EIR + EIR_delta
}
Expand Down
10 changes: 4 additions & 6 deletions R/human-SIP.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

#' @title Entomological inoculation rate on human strata
#' @description Implements [F_EIR] for the SIP model.
#' @param t current simulation time
#' @param y state vector
#' @param pars an [environment]
#' @inheritParams F_EIR
#' @return a [numeric] vector of length `nStrata`
#' @export
F_EIR.SIP <- function(t, y, pars) {
F_EIR.SIP <- function(t, y, pars, MosyBehavior) {
Z <- F_Z(t, y, pars)
f <- pars$MYZpar$f # may want to use wrapper compute_f/q
q <- pars$MYZpar$q
f <- MosyBehavior$f[1]
q <- MosyBehavior$q[1]
beta <- F_beta(t, y, pars)
as.vector(beta %*% diag(f*q, nrow = pars$nPatches) %*% Z)
}
Expand Down
10 changes: 4 additions & 6 deletions R/human-SIS.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

#' @title Entomological inoculation rate on human strata
#' @description Implements [F_EIR] for the SIS model.
#' @param t current simulation time
#' @param y state vector
#' @param pars an [environment]
#' @inheritParams F_EIR
#' @return a [numeric] vector of length `nStrata`
#' @export
F_EIR.SIS <- function(t, y, pars) {
F_EIR.SIS <- function(t, y, pars, MosyBehavior) {
Z <- F_Z(t, y, pars)
f <- pars$MYZpar$f # may want to use wrapper compute_f/q
q <- pars$MYZpar$q
f <- MosyBehavior$f[1]
q <- MosyBehavior$q[1]
beta <- F_beta(t, y, pars)
as.vector(beta %*% diag(f*q, nrow = pars$nPatches) %*% Z)
}
Expand Down
10 changes: 4 additions & 6 deletions R/human-hMoI.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

#' @title Entomological inoculation rate on human strata
#' @description Implements [F_EIR] for the hybrid MoI model.
#' @param t current simulation time
#' @param y state vector
#' @param pars an [environment]
#' @inheritParams F_EIR
#' @return a [numeric] vector of length `nStrata`
#' @export
F_EIR.hMoI <- function(t, y, pars) {
F_EIR.hMoI <- function(t, y, pars, MosyBehavior) {
Z <- F_Z(t, y, pars)
f <- pars$MYZpar$f # may want to use wrapper compute_f/q
q <- pars$MYZpar$q
f <- MosyBehavior$f[1]
q <- MosyBehavior$q[1]
beta <- F_beta(t, y, pars)
as.vector(beta %*% diag(f*q, nrow = pars$nPatches) %*% Z)
}
Expand Down
3 changes: 2 additions & 1 deletion R/human-interface.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#' @param t current simulation time
#' @param y state vector
#' @param pars an [environment]
#' @param MosyBehavior values returned by [exDE::MosquitoBehavior], potentially modified by control [exDE::VectorControl]
#' @return a [numeric] vector of length `nStrata`
#' @export
F_EIR <- function(t, y, pars) {
F_EIR <- function(t, y, pars, MosyBehavior) {
UseMethod("F_EIR", pars$Xpar)
}

Expand Down
4 changes: 3 additions & 1 deletion man/F_EIR.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/F_EIR.SIP.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/F_EIR.SIS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/F_EIR.hMoI.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vignettes/vc_lemenach.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ theta <- (eta - psi*L - phi*L)/(L^2)

## Setup

Now that all state variables have been solved at equilibrium, we can set up the parameters and components of the system. We also need to set up a time-varying function to compute the coverage of ITNs at any time point. We use a sine curve with a period of 365 days which goes from 0 to 1 over that period. This must be a function that takes a single argument `t` (time) and returns a scalar value.
Now that all state variables have been solved at equilibrium, we can set up the parameters and components of the system. We also need to set up a time-varying function to compute the coverage of ITNs at any time point. We use a sine curve with a period of 365 days which goes from 0 to 1 over that period, with the phase shifted so that at 0 it returns 0. The function also returns 0 for any $t<0$. This must be a function that takes a single argument `t` (time) and returns a scalar value.

```{r}
pars$calU <- calU
pars$calN <- calN
# ITN coverage
ITN_cov <- function(t) {(sin(2*pi*t / 365) + 1) / 2}
ITN_cov <- function(t) {ifelse(t < 0, 0, (sin(2*pi*(t-365/4) / 365) + 1) / 2)}
# set parameters
make_parameters_exogenous_null(pars)
Expand Down

0 comments on commit f194e91

Please sign in to comment.