Skip to content

Commit

Permalink
basic plotting moved to exDE
Browse files Browse the repository at this point in the history
  • Loading branch information
smitdave committed Dec 14, 2023
1 parent 1a1103f commit 86fce99
Show file tree
Hide file tree
Showing 40 changed files with 37 additions and 1,187 deletions.
28 changes: 0 additions & 28 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,17 @@ S3method(F_fqZ,RMG)
S3method(MBionomics,RMG)
S3method(dMYZdt,RMG)
S3method(get_inits_MYZ,RMG)
S3method(lines_M,RM)
S3method(lines_M,RMG)
S3method(lines_X,SIS)
S3method(lines_YZ,RM)
S3method(lines_YZ,RMG)
S3method(lines_YZ_fracs,RM)
S3method(lines_YZ_fracs,RMG)
S3method(make_indices_MYZ,RMG)
S3method(parse_deout_MYZ,RMG)
S3method(plot_M,RM)
S3method(plot_M,RMG)
S3method(plot_X,SIS)
S3method(plot_YZ,RM)
S3method(plot_YZ,RMG)
S3method(plot_YZ_fracs,RM)
S3method(plot_YZ_fracs,RMG)
S3method(setup_MYZ,RMG)
S3method(split_stratum_by_biting,SIS)
S3method(update_inits_MYZ,RMG)
export(lines_EIR)
export(lines_M)
export(lines_PR)
export(lines_X)
export(lines_YZ)
export(lines_YZ_fracs)
export(lines_aEIR)
export(lines_eirVpr)
export(lines_eirpr)
export(make_MYZinits_RMG)
export(make_MYZpar_RMG)
export(make_inits_MYZ_RMG)
export(make_parameters_MYZ_RMG)
export(plot_EIR)
export(plot_M)
export(plot_PR)
export(plot_X)
export(plot_YZ)
export(plot_YZ_fracs)
export(plot_aEIR)
export(plot_eirVpr)
export(plot_eirpr)
export(pr2Lambda)
Expand Down
122 changes: 0 additions & 122 deletions R/MYZmod-RM.R

This file was deleted.

121 changes: 0 additions & 121 deletions R/MYZmod-RMG.R
Original file line number Diff line number Diff line change
Expand Up @@ -278,124 +278,3 @@ get_inits_MYZ.RMG <- function(pars) {with(pars$MYZinits,{
c(U0, Gu0, Y0, Gy0, Z0, Gz0)
})}

#' Basic plotting: plot mosquito population density for the "RMG" model
#'
#' @inheritParams plot_M
#'
#' @export
plot_M.RMG = function(model, clrs = "darkblue", stable=FALSE, add=FALSE){
vars = if(stable==TRUE){
model$outputs$stable_orbits
}else{
model$outputs$orbits
}

if(add == FALSE) with(vars$MYZ,
plot(time, 0*time, type = "n", ylim = range(0,max(M)),
ylab = "Mosquito Density", xlab = "Time"))

lines_M(vars$MYZ, model, clrs)
}

#' Add the orbits for the SIS model to a plot for models of human infection and immunity
#'
#' @inheritParams lines_M
#'
#' @export
lines_M.RMG = function(MYZ, model, clrs="darkblue"){
with(MYZ,{
if(model$nPatches==1) lines(time, M, col=clrs)
if(model$nPatches>1){
if (length(clrs)==1) clrs=rep(clrs, model$nPatches)
for(i in 1:model$nPatches){
lines(time, M[,i], col=clrs[i])
}
}
})}

#' Basic plotting: plot mosquito population density for the "RMG" model
#'
#' @inheritParams plot_YZ
#'
#' @export
plot_YZ.RMG = function(model, Yclrs = "purple", Zclrs="darkred", stable=FALSE, add=FALSE){
vars = if(stable==TRUE){
model$outputs$stable_orbits
}else{
model$outputs$orbits
}

if(add == FALSE) with(vars$MYZ,
plot(time, 0*time, type = "n", ylim = range(0,max(Y)),
ylab = "Mosquito Density", xlab = "Time"))

lines_YZ(vars$MYZ, model, Yclrs, Zclrs)
}

#' Add the orbits for the SIS model to a plot for models of human infection and immunity
#'
#' @inheritParams lines_YZ
#'
#' @export
lines_YZ.RMG = function(MYZ, model, Yclrs="purple", Zclrs = "darkred"){
with(MYZ,{
if(model$nPatches==1){
lines(time, Y, col=Yclrs)
lines(time, Z, col=Zclrs)
}
if(model$nPatches>1){
if (length(Yclrs)==1)
Yclrs=rep(Yclrs, model$nPatches)
if (length(Zclrs)==1)
Zclrs=rep(Zclrs, model$nPatches)

for(i in 1:model$nPatches){
lines(time, Y[,i], col=Yclrs[i])
lines(time, Z[,i], col=Zclrs[i])
}
}
})}


#' Basic plotting: plot the fraction infected and infective for the "RMG" model
#'
#' @inheritParams plot_YZ_fracs
#'
#' @export
plot_YZ_fracs.RMG = function(model, Yclrs = "purple", Zclrs = "darkred", stable=FALSE, add=FALSE){
vars = if(stable==TRUE){
model$outputs$stable_orbits
}else{
model$outputs$orbits
}

if(add == FALSE) with(vars$MYZ,
plot(time, 0*time, type = "n", ylim = range(0,1),
ylab = "Fraction Infected", xlab = "Time"))

lines_YZ_fracs(vars$MYZ, model, Yclrs, Zclrs)
}

#' Add lines for the fraction infected and infective for the "RMG" model
#'
#' @inheritParams lines_YZ_fracs
#'
#' @export
lines_YZ_fracs.RMG = function(MYZ, model, Yclrs="purple", Zclrs="darkred"){
with(MYZ,{
if(model$nPatches==1) {
lines(time, y, col=Yclrs)
lines(time, z, col=Zclrs)
}
if(model$nPatches>1){
if (length(Yclrs)==1)
Yclrs=rep(Yclrs, model$nPatches)
if (length(Zclrs)==1)
Zclrs=rep(Zclrs, model$nPatches)

for(i in 1:model$nPatches){
lines(time, y[,i], col=Yclrs[i])
lines(time, z[,i], col=Zclrs[i])
}
}
})}
34 changes: 0 additions & 34 deletions R/Xmod-SIS.R
Original file line number Diff line number Diff line change
@@ -1,37 +1,3 @@
#' Basic plotting: plot the density of infected humans for an SIS model
#'
#' @inheritParams plot_X
#' @export
plot_X.SIS = function(model, clrs="black", stable=FALSE, add=FALSE){
vars = if(stable==TRUE){
model$outputs$stable_orbits
}else{
model$outputs$orbits
}

if(add==FALSE) with(vars$XH,
plot(time, 0*time, type = "n", ylim = c(0, max(H)),
ylab = "# Infected", xlab = "Time"))

lines_X(vars$XH, model, clrs)
}

#' Add the orbits for the SIS model to a plot for models of human infection and immunity
#'
#' @inheritParams lines_X
#'
#' @export
lines_X.SIS = function(XH, model, clrs="black"){
with(XH,{
if(model$nStrata==1) lines(time, X, col=clrs)
if(model$nStrata>1){
if (length(clrs)==1) clrs=rep(clrs, model$nStrata)
for(i in 1:model$nStrata){
lines(time, X[,i], col=clrs[i])
}
}
})}

#' Split a stratum into two strata, assigning a fraction `p` a new biting weight that is multiplied by a factor `fac` compared with the old one. The biting weight for the remaining `1-p` gets a new factor `1/fac`
#'
#' @inheritParams split_stratum_by_biting
Expand Down
Loading

0 comments on commit 86fce99

Please sign in to comment.