Skip to content

Commit

Permalink
Merge pull request #125 from dd-harp/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
smitdave authored Aug 10, 2024
2 parents 2b68f66 + 136a849 commit 5723383
Show file tree
Hide file tree
Showing 257 changed files with 16,820 additions and 1,783 deletions.
100 changes: 63 additions & 37 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ S3method(F_fqZ,si)
S3method(F_fqZ,trace)
S3method(F_g,static)
S3method(F_mu,static)
S3method(F_ni,SEIS)
S3method(F_ni,SEISd)
S3method(F_ni,SIP)
S3method(F_ni,SIS)
S3method(F_ni,hMoI)
S3method(F_nu,static)
S3method(F_nu,type2)
S3method(F_pr,SEIS)
Expand Down Expand Up @@ -176,11 +181,6 @@ S3method(ar2eir,nb)
S3method(ar2eir,pois)
S3method(compute_Omega,dts)
S3method(compute_Omega,xde)
S3method(compute_terms,cohort)
S3method(compute_terms,dts)
S3method(compute_terms,human)
S3method(compute_terms,na)
S3method(compute_terms,xde)
S3method(dHdt,zero)
S3method(dLdt,basicL)
S3method(dLdt,trace)
Expand Down Expand Up @@ -218,8 +218,29 @@ S3method(get_Xinits,SIP)
S3method(get_Xinits,SIS)
S3method(get_Xinits,hMoI)
S3method(get_Xinits,trace)
S3method(get_f,RM)
S3method(get_f,basicM)
S3method(get_f,sei)
S3method(get_f,si)
S3method(get_f,trace)
S3method(get_g,RM)
S3method(get_g,basicM)
S3method(get_g,sei)
S3method(get_g,si)
S3method(get_g,trace)
S3method(get_q,RM)
S3method(get_q,basicM)
S3method(get_q,sei)
S3method(get_q,si)
S3method(get_q,trace)
S3method(get_sigma,RM)
S3method(get_sigma,basicM)
S3method(get_sigma,sei)
S3method(get_sigma,si)
S3method(get_sigma,trace)
S3method(list_Lvars,basicL)
S3method(list_Lvars,trace)
S3method(list_MYZvars,RM)
S3method(list_MYZvars,RM_dts)
S3method(list_MYZvars,basicM)
S3method(list_MYZvars,sei)
Expand Down Expand Up @@ -279,20 +300,20 @@ S3method(make_indices_MYZ,si)
S3method(make_indices_MYZ,trace)
S3method(make_runtime,dts)
S3method(make_runtime,xde)
S3method(parse_outputs_L,basicL)
S3method(parse_outputs_L,trace)
S3method(parse_outputs_MYZ,RM)
S3method(parse_outputs_MYZ,RM_dts)
S3method(parse_outputs_MYZ,basicM)
S3method(parse_outputs_MYZ,sei)
S3method(parse_outputs_MYZ,si)
S3method(parse_outputs_MYZ,trace)
S3method(parse_outputs_X,SEIS)
S3method(parse_outputs_X,SEISd)
S3method(parse_outputs_X,SIP)
S3method(parse_outputs_X,SIS)
S3method(parse_outputs_X,hMoI)
S3method(parse_outputs_X,trace)
S3method(parse_Lorbits,basicL)
S3method(parse_Lorbits,trace)
S3method(parse_MYZorbits,RM)
S3method(parse_MYZorbits,RM_dts)
S3method(parse_MYZorbits,basicM)
S3method(parse_MYZorbits,sei)
S3method(parse_MYZorbits,si)
S3method(parse_MYZorbits,trace)
S3method(parse_Xorbits,SEIS)
S3method(parse_Xorbits,SEISd)
S3method(parse_Xorbits,SIP)
S3method(parse_Xorbits,SIS)
S3method(parse_Xorbits,hMoI)
S3method(parse_Xorbits,trace)
S3method(put_Lvars,trace)
S3method(put_MYZvars,RM_dts)
S3method(put_MYZvars,sei)
Expand All @@ -307,13 +328,13 @@ S3method(setup_exposure_nb,dts)
S3method(setup_exposure_nb,xde)
S3method(setup_exposure_pois,dts)
S3method(setup_exposure_pois,xde)
S3method(setup_setup,dynamic)
S3method(setup_setup,setup)
S3method(setup_setup,static)
S3method(setup_travel_static,dts)
S3method(setup_travel_static,xde)
S3method(travel_malaria,dts)
S3method(travel_malaria,xde)
S3method(trigger_setup,dynamic)
S3method(trigger_setup,setup)
S3method(trigger_setup,static)
S3method(update_Linits,basicL)
S3method(update_Linits,trace)
S3method(update_MYZinits,RM)
Expand Down Expand Up @@ -390,6 +411,7 @@ export(F_fqM)
export(F_fqZ)
export(F_g)
export(F_mu)
export(F_ni)
export(F_nu)
export(F_p)
export(F_pr)
Expand Down Expand Up @@ -449,8 +471,6 @@ export(change_habitat_weights)
export(checkIt)
export(compute_B)
export(compute_EIR)
export(compute_NI)
export(compute_NI_ix)
export(compute_Omega)
export(compute_Omega_dts)
export(compute_Omega_xde)
Expand All @@ -464,13 +484,6 @@ export(compute_calU)
export(compute_eggs_laid)
export(compute_kappa)
export(compute_local_frac)
export(compute_terms)
export(compute_terms_steady)
export(compute_vars_aqua)
export(compute_vars_cohort)
export(compute_vars_full)
export(compute_vars_human)
export(compute_vars_mosy)
export(create_Linits_basicL)
export(create_Lpar_basicL)
export(create_Lpar_trace)
Expand Down Expand Up @@ -524,7 +537,17 @@ export(get_MYZinits)
export(get_Omega)
export(get_Upsilon)
export(get_Xinits)
export(get_bionomics)
export(get_bionomics_s)
export(get_f)
export(get_ft)
export(get_g)
export(get_inits)
export(get_last)
export(get_q)
export(get_qt)
export(get_sigma)
export(get_terms)
export(last_to_inits)
export(list_Lvars)
export(list_MYZvars)
Expand Down Expand Up @@ -561,14 +584,16 @@ export(metric_calD)
export(metric_calR)
export(metric_calV)
export(metric_calZ)
export(parse_outputs)
export(parse_outputs_L)
export(parse_outputs_MYZ)
export(parse_outputs_X)
export(parse_outputs_vec)
export(parse_Lorbits)
export(parse_MYZorbits)
export(parse_Xorbits)
export(parse_orbits)
export(parse_y)
export(put_Lvars)
export(put_MYZvars)
export(put_Xvars)
export(reset_state)
export(reset_state_i)
export(runt)
export(set_Dday)
export(setup_BLOOD_FEEDING)
Expand Down Expand Up @@ -604,7 +629,6 @@ export(setup_rainfall_no_forcing)
export(setup_relative_humidity_no_forcing)
export(setup_resources_forced)
export(setup_resources_static)
export(setup_setup)
export(setup_sugar_baits_null)
export(setup_sugar_static)
export(setup_temperature_no_forcing)
Expand All @@ -617,6 +641,7 @@ export(setup_weather_forced)
export(setup_weather_no_forcing)
export(shapeIt)
export(travel_malaria)
export(trigger_setup)
export(update_Linits)
export(update_MYZinits)
export(update_MYZpar_RM)
Expand All @@ -634,6 +659,7 @@ export(xde_steady_state_M)
export(xde_steady_state_MYZ)
export(xde_steady_state_X)
export(xde_steady_state_XH)
export(xds_flatten)
export(xds_lines_EIR)
export(xds_lines_M)
export(xds_lines_PR)
Expand Down
6 changes: 6 additions & 0 deletions R/adult-RM-bionomics.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,15 @@ create_MYZpar_RM_static = function(nPatches, MYZopts=list(), eip=12,
MYZpar$f <- checkIt(f, nPatches)
MYZpar$q <- checkIt(q, nPatches)
MYZpar$nu <- checkIt(nu, nPatches)

MYZpar$eggsPerBatch <- eggsPerBatch
MYZpar$calK <- diag(nPatches)

MYZpar$es_f <- rep(1, nPatches)
MYZpar$es_q <- rep(1, nPatches)
MYZpar$es_g <- rep(1, nPatches)
MYZpar$es_sigma <- rep(1, nPatches)

Omega <- diag(g, nPatches)
MYZpar$Omega <- Omega
MYZpar$Upsilon <- expm::expm(-Omega*eip)
Expand Down
19 changes: 9 additions & 10 deletions R/adult-RM-dts.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,21 +162,20 @@ put_MYZvars.RM_dts <- function(MYZvars, y, pars, s){


#' @title Parse the output of deSolve and return variables for the RM_dts model
#' @description Implements [parse_outputs_MYZ] for the RM_dts model
#' @inheritParams parse_outputs_MYZ
#' @description Implements [parse_MYZorbits] for the RM_dts model
#' @inheritParams parse_MYZorbits
#' @return a [list]
#' @export
parse_outputs_MYZ.RM_dts <- function(outputs, pars, s) {with(pars$ix$MYZ[[s]],{
time = outputs[,1]
M = outputs[,M_ix+1]
P = outputs[,P_ix+1]
U = outputs[,U_ix+1]
Y = rowSums(outputs[,Y_ix+1])
Z = outputs[,Z_ix+1]
parse_MYZorbits.RM_dts <- function(outputs, pars, s) {with(pars$ix$MYZ[[s]],{
M = outputs[,M_ix]
P = outputs[,P_ix]
U = outputs[,U_ix]
Y = rowSums(outputs[,Y_ix])
Z = outputs[,Z_ix]
y = Y/M
z = Z/M
parous = P/M
return(list(time=time, M=M, P=P, U=U, Y=Y, Z=Z, y=y, z=z, parous=parous))
return(list(M=M, P=P, U=U, Y=Y, Z=Z, y=y, z=z, parous=parous))
})}

#' @title Return initial values as a vector
Expand Down
34 changes: 24 additions & 10 deletions R/adult-RM.R
Original file line number Diff line number Diff line change
Expand Up @@ -218,24 +218,38 @@ update_MYZinits.RM <- function(pars, y0, s) {
return(pars)
})}


#' @title Return the variables as a list
#' @description This method dispatches on the type of `pars$MYZpar[[s]]`
#' @inheritParams list_MYZvars
#' @return a [list]
#' @export
list_MYZvars.RM <- function(y, pars, s){
with(pars$ix$MYZ[[s]],
return(list(
M = y[M_ix],
P = y[P_ix],
Y = y[Y_ix],
Z = y[Z_ix]
)))
}


#' @title Parse the output of deSolve and return variables for the RM model
#' @description Implements [parse_outputs_MYZ] for the RM model
#' @inheritParams parse_outputs_MYZ
#' @description Implements [parse_MYZorbits] for the RM model
#' @inheritParams parse_MYZorbits
#' @return a [list]
#' @export
parse_outputs_MYZ.RM <- function(outputs, pars, s) {with(pars$ix$MYZ[[s]],{
time = outputs[,1]
M = outputs[,M_ix+1]
P = outputs[,P_ix+1]
Y = outputs[,Y_ix+1]
Z = outputs[,Z_ix+1]
parse_MYZorbits.RM <- function(outputs, pars, s) {with(pars$ix$MYZ[[s]],{
M = outputs[,M_ix]
P = outputs[,P_ix]
Y = outputs[,Y_ix]
Z = outputs[,Z_ix]
f = get_ft(pars, s)
q = get_qt(pars, s)
y = Y/M
z = Z/M
parous = P/M
return(list(time=time, M=M, P=P, Y=Y, Z=Z, y=y, z=z, parous))
return(list(M=M, P=P, Y=Y, Z=Z, y=y, z=z, parous=parous, fqZ=f*q*Z, fqM=f*q*M))
})}

#' @title Compute the steady states as a function of the daily EIR
Expand Down
15 changes: 7 additions & 8 deletions R/adult-basicM.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,15 @@ make_indices_MYZ.basicM <- function(pars, s) {with(pars,{
return(pars)
})}

#' @title Parse the output of deSolve and return variables for the basicM model
#' @description Implements [parse_outputs_MYZ] for the basicM model.
#' @inheritParams parse_outputs_MYZ
#' @title Parse outputs for basicM
#' @description Implements [parse_MYZorbits] for the basicM model.
#' @inheritParams parse_MYZorbits
#' @return [list]
#' @export
parse_outputs_MYZ.basicM <- function(outputs, pars, s) {
time = outputs[,1]
parse_MYZorbits.basicM <- function(outputs, pars, s) {
with(pars$ix$MYZ[[s]],{
M = outputs[,M_ix+1]
P = outputs[,P_ix+1]
M = outputs[,M_ix]
P = outputs[,P_ix]
parous = P/M
return(list(time=time, M=M, P=P, parous=parous))
return(list(M=M, P=P, parous=parous))
})}
4 changes: 2 additions & 2 deletions R/adult-interface.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ make_indices_MYZ <- function(pars, s) {
#' @param s the species index
#' @return [list]
#' @export
parse_outputs_MYZ <- function(outputs, pars, s) {
UseMethod("parse_outputs_MYZ", pars$MYZpar[[s]])
parse_MYZorbits <- function(outputs, pars, s) {
UseMethod("parse_MYZorbits", pars$MYZpar[[s]])
}

#' @title Return initial values as a vector
Expand Down
17 changes: 9 additions & 8 deletions R/adult-sei.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,19 @@ make_indices_MYZ.sei <- function(pars, s) {with(pars,{


#' @title Parse the output of deSolve and return variables for the sei model
#' @description Implements [parse_outputs_MYZ] for the sei model
#' @inheritParams parse_outputs_MYZ
#' @description Implements [parse_MYZorbits] for the sei model
#' @inheritParams parse_MYZorbits
#' @return a [list]
#' @export
parse_outputs_MYZ.sei <- function(outputs, pars, s) {with(pars$ix$MYZ[[s]],{
time = outputs[,1]
M = outputs[,M_ix+1]
Y = outputs[,Y_ix+1]
Z = outputs[,Z_ix+1]
parse_MYZorbits.sei <- function(outputs, pars, s) {with(pars$ix$MYZ[[s]],{
M = outputs[,M_ix]
Y = outputs[,Y_ix]
Z = outputs[,Z_ix]
f = get_ft(pars,s)
q = get_ft(pars,s)
y = Y/M
z = Z/M
return(list(time=time, M=M, Z=Z, Y=Y, y=y, z=z))
return(list(M=M, Z=Z, Y=Y, y=y, z=z, fqZ=f*q*Z, fqM=f*q*M))
})}

#' @title Return initial values as a vector
Expand Down
15 changes: 8 additions & 7 deletions R/adult-si.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,19 @@ make_indices_MYZ.si <- function(pars, s) {with(pars,{


#' @title Parse the output of deSolve and return variables for the si model
#' @description Implements [parse_outputs_MYZ] for the si model
#' @inheritParams parse_outputs_MYZ
#' @description Implements [parse_MYZorbits] for the si model
#' @inheritParams parse_MYZorbits
#' @return a [list]
#' @export
parse_outputs_MYZ.si <- function(outputs, pars, s) {with(pars$ix$MYZ[[s]],{
time = outputs[,1]
M = outputs[,M_ix+1]
Y = outputs[,Z_ix+1]
parse_MYZorbits.si <- function(outputs, pars, s) {with(pars$ix$MYZ[[s]],{
M = outputs[,M_ix]
Y = outputs[,Z_ix]
Z = t(with(pars$MYZpar[[1]], Upsilon %*% t(Y)))
ff = get_ft(pars,s)
qq = get_qt(pars,s)
y = Y/M
z = Z/M
return(list(time=time, M=M, Z=Z, Y=Y, y=y, z=z))
return(list(M=M, Z=Z, Y=Y, y=y, z=z, fqZ=ff*qq*Z, fqM=ff*qq*M))
})}

#' @title Return initial values as a vector
Expand Down
Loading

0 comments on commit 5723383

Please sign in to comment.