Skip to content

Commit

Permalink
name change
Browse files Browse the repository at this point in the history
make_X* changed to setup_X*
create_X* changed to make_X*
  • Loading branch information
smitdave committed Oct 4, 2024
1 parent 53307a4 commit 5963f89
Show file tree
Hide file tree
Showing 35 changed files with 179 additions and 179 deletions.
34 changes: 17 additions & 17 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,6 @@ S3method(make_Omega,xde)
S3method(make_TimeSpent,as_matrix)
S3method(make_TimeSpent,athome)
S3method(make_TimeSpent,xy)
S3method(make_X_indices,SIS)
S3method(make_X_indices,hMoI)
S3method(make_X_indices,trivial)
S3method(make_Xinits,SIS)
S3method(make_Xinits,hMoI)
S3method(make_Xinits,trivial)
S3method(make_Xpar,SIS)
S3method(make_Xpar,hMoI)
S3method(make_Xpar,trivial)
S3method(make_calK,as_matrix)
S3method(make_calK,herethere)
S3method(make_calK,xy)
Expand Down Expand Up @@ -299,6 +290,15 @@ S3method(setup_MYZpar,SI)
S3method(setup_MYZpar,basicM)
S3method(setup_MYZpar,macdonald)
S3method(setup_MYZpar,trivial)
S3method(setup_X_indices,SIS)
S3method(setup_X_indices,hMoI)
S3method(setup_X_indices,trivial)
S3method(setup_Xinits,SIS)
S3method(setup_Xinits,hMoI)
S3method(setup_Xinits,trivial)
S3method(setup_Xpar,SIS)
S3method(setup_Xpar,hMoI)
S3method(setup_Xpar,trivial)
S3method(setup_development,func)
S3method(setup_exposure_nb,dts)
S3method(setup_exposure_nb,xde)
Expand Down Expand Up @@ -448,11 +448,6 @@ export(compute_kappa)
export(compute_local_frac)
export(create_TimeSpent_athome)
export(create_TimeSpent_xy)
export(create_Xinits_SIS)
export(create_Xinits_hMoI)
export(create_Xpar_SIS)
export(create_Xpar_hMoI)
export(create_Xpar_trivial)
export(create_calK_herethere)
export(create_calK_xy)
export(create_habitat_matrix)
Expand Down Expand Up @@ -525,9 +520,11 @@ export(make_RBR)
export(make_TaR)
export(make_TimeSpent)
export(make_WB)
export(make_X_indices)
export(make_Xinits)
export(make_Xpar)
export(make_Xinits_SIS)
export(make_Xinits_hMoI)
export(make_Xpar_SIS)
export(make_Xpar_hMoI)
export(make_Xpar_trivial)
export(make_beta)
export(make_calK)
export(make_calU)
Expand Down Expand Up @@ -577,6 +574,9 @@ export(setup_Lpar)
export(setup_MYZinits)
export(setup_MYZpar)
export(setup_TRANSMISSION)
export(setup_X_indices)
export(setup_Xinits)
export(setup_Xpar)
export(setup_care_seeking_no_behavior)
export(setup_development)
export(setup_development_func)
Expand Down
2 changes: 1 addition & 1 deletion R/change.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
set_H = function(H, pars, i=1){
stopifnot(length(H) == pars$nStrata[i])
vars <- as.list(get_Xinits(pars,i))
pars <- make_Xinits(pars, H, i, vars)
pars <- setup_Xinits(pars, H, i, vars)
class(pars$BFpar) <- trigger_setup(pars$BFpar)
class(pars$beta) <- trigger_setup(pars$beta)
return(pars)
Expand Down
26 changes: 13 additions & 13 deletions R/human-SIS.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ dts_steady_state_X.SIS = function(ar, H, Xpar){with(Xpar,{
})}

#' @title Setup Xpar.SIS
#' @description Implements [make_Xpar] for the SIS model
#' @inheritParams make_Xpar
#' @description Implements [setup_Xpar] for the SIS model
#' @inheritParams setup_Xpar
#' @return a [list] vector
#' @export
make_Xpar.SIS = function(Xname, pars, i, Xopts=list()){
pars$Xpar[[i]] = create_Xpar_SIS(pars$nStrata[1], Xopts)
setup_Xpar.SIS = function(Xname, pars, i, Xopts=list()){
pars$Xpar[[i]] = make_Xpar_SIS(pars$nStrata[1], Xopts)
return(pars)
}

Expand All @@ -85,7 +85,7 @@ make_Xpar.SIS = function(Xname, pars, i, Xopts=list()){
#' @param r recovery rate
#' @return a [list]
#' @export
create_Xpar_SIS = function(nStrata, Xopts=list(),
make_Xpar_SIS = function(nStrata, Xopts=list(),
b=0.55, r=1/180, c=0.15){
with(Xopts,{
Xpar = list()
Expand Down Expand Up @@ -188,7 +188,7 @@ set_Xpars.SIS <- function(pars, i=1, Xopts=list()) {
#' @param I the initial values of the parameter I
#' @return a [list]
#' @export
create_Xinits_SIS = function(nStrata, H, Xopts = list(), I=1){with(Xopts,{
make_Xinits_SIS = function(nStrata, H, Xopts = list(), I=1){with(Xopts,{
S = unname(as.vector(checkIt(H-I, nStrata)))
I = unname(as.vector(checkIt(I, nStrata)))
return(list(S=S, I=I))
Expand All @@ -198,12 +198,12 @@ create_Xinits_SIS = function(nStrata, H, Xopts = list(), I=1){with(Xopts,{


#' @title Setup Xinits.SIS
#' @description Implements [make_Xinits] for the SIS model
#' @inheritParams make_Xinits
#' @description Implements [setup_Xinits] for the SIS model
#' @inheritParams setup_Xinits
#' @return a [list] vector
#' @export
make_Xinits.SIS = function(pars, H, i, Xopts=list()){
pars$Xinits[[i]] = with(pars, create_Xinits_SIS(pars$nStrata[i], H, Xopts))
setup_Xinits.SIS = function(pars, H, i, Xopts=list()){
pars$Xinits[[i]] = with(pars, make_Xinits_SIS(pars$nStrata[i], H, Xopts))
return(pars)
}

Expand All @@ -228,12 +228,12 @@ get_Xinits.SIS <- function(pars, i=1){pars$Xinits[[i]]}


#' @title Add indices for human population to parameter list
#' @description Implements [make_X_indices] for the SIS model.
#' @inheritParams make_X_indices
#' @description Implements [setup_X_indices] for the SIS model.
#' @inheritParams setup_X_indices
#' @return none
#' @importFrom utils tail
#' @export
make_X_indices.SIS <- function(pars, i) {with(pars,{
setup_X_indices.SIS <- function(pars, i) {with(pars,{

S_ix <- seq(from = max_ix+1, length.out=nStrata[i])
max_ix <- tail(S_ix, 1)
Expand Down
30 changes: 15 additions & 15 deletions R/human-hMoI.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ xde_steady_state_X.hMoI = function(foi, H, Xpar){with(Xpar,{
#' @param r2 recovery rate from patent infections
#' @return none
#' @export
create_Xpar_hMoI = function(nStrata, Xopts=list(),
make_Xpar_hMoI = function(nStrata, Xopts=list(),
b=0.55, r1=1/180, r2 = 1/70,
c1=0.015, c2=0.15){
with(Xopts,{
Expand All @@ -65,7 +65,7 @@ create_Xpar_hMoI = function(nStrata, Xopts=list(),
#' values as a list.
#' @inheritParams get_Xpars
#' @return a [list]
#' @seealso [create_Xpar_hMoI]
#' @seealso [make_Xpar_hMoI]
#' @export
get_Xpars.hMoI<- function(pars, i=1) {
with(pars$Xpar[[i]],list(b=b, c1=c1, c2=c2, r1=r1, r2=r2))
Expand All @@ -89,12 +89,12 @@ set_Xpars.hMoI <- function(pars, i=1, Xopts=list()) {
}))}

#' @title Setup Xpar.hMoI
#' @description Implements [make_Xpar] for the hMoI model
#' @inheritParams make_Xpar
#' @description Implements [setup_Xpar] for the hMoI model
#' @inheritParams setup_Xpar
#' @return a [list] vector
#' @export
make_Xpar.hMoI = function(Xname, pars, i, Xopts=list()){
pars$Xpar[[i]] = create_Xpar_hMoI(pars$nStrata[i], Xopts)
setup_Xpar.hMoI = function(Xname, pars, i, Xopts=list()){
pars$Xpar[[i]] = make_Xpar_hMoI(pars$nStrata[i], Xopts)
return(pars)
}

Expand Down Expand Up @@ -142,13 +142,13 @@ F_b.hMoI <- function(y, pars,i) {


#' @title Setup Xinits.hMoI
#' @description Implements [make_Xinits] for the hMoI model
#' @inheritParams make_Xinits
#' @description Implements [setup_Xinits] for the hMoI model
#' @inheritParams setup_Xinits
#' @return a [list] vector
#' @export
make_Xinits.hMoI = function(pars, H, i, Xopts=list()){
setup_Xinits.hMoI = function(pars, H, i, Xopts=list()){
pars$Xpar[[i]]$H = H
pars$Xinits[[i]] = create_Xinits_hMoI(pars$nStrata[i], Xopts)
pars$Xinits[[i]] = make_Xinits_hMoI(pars$nStrata[i], Xopts)
return(pars)
}

Expand All @@ -172,7 +172,7 @@ set_Xinits.hMoI <- function(pars, i=1, Xopts=list()) {
#' @param m2 mean MoI among patent human infections
#' @return none
#' @export
create_Xinits_hMoI = function(nStrata, Xopts = list(), m1=2, m2=1){with(Xopts,{
make_Xinits_hMoI = function(nStrata, Xopts = list(), m1=2, m2=1){with(Xopts,{
m1 = checkIt(m1, nStrata)
m2 = checkIt(m2, nStrata)
return(list(m1=m1, m2=m2))
Expand All @@ -191,12 +191,12 @@ HTC.hMoI <- function(pars, i) {
}

#' @title Add indices for human population to parameter list
#' @description Implements [make_X_indices] for the hybrid MoI model.
#' @inheritParams make_X_indices
#' @description Implements [setup_X_indices] for the hybrid MoI model.
#' @inheritParams setup_X_indices
#' @return none
#' @importFrom utils tail
#' @export
make_X_indices.hMoI <- function(pars, i) {with(pars,{
setup_X_indices.hMoI <- function(pars, i) {with(pars,{
m1_ix <- seq(from = max_ix+1, length.out=nStrata[i])
max_ix <- tail(m1_ix, 1)

Expand All @@ -218,7 +218,7 @@ update_Xinits.hMoI <- function(pars, y0, i) {
with(pars$ix$X[[i]],{
m1 = y0[m1_ix]
m2 = y0[m2_ix]
pars$Xinits[[i]] = create_Xinits_hMoI(pars$nStrata[i], m1=m1, m2=m2)
pars$Xinits[[i]] = make_Xinits_hMoI(pars$nStrata[i], m1=m1, m2=m2)
return(pars)
})}

Expand Down
12 changes: 6 additions & 6 deletions R/human-interface.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ dXdt <- function(t, y, pars, i) {
#' @param Xopts a [list]
#' @return an **`xds`** object
#' @export
make_Xpar = function(Xname, pars, i, Xopts=list()){
setup_Xpar = function(Xname, pars, i, Xopts=list()){
class(Xname) <- Xname
UseMethod("make_Xpar", Xname)
UseMethod("setup_Xpar", Xname)
}

#' @title Update X states for a discrete time system
Expand Down Expand Up @@ -98,8 +98,8 @@ F_b <- function(y, pars, i) {
#' @param Xopts a [list]
#' @return an **`xds`** object
#' @export
make_Xinits = function(pars, H, i, Xopts=list()){
UseMethod("make_Xinits", pars$Xpar[[i]])
setup_Xinits = function(pars, H, i, Xopts=list()){
UseMethod("setup_Xinits", pars$Xpar[[i]])
}

#' @title Add indices for human population to parameter list
Expand All @@ -108,8 +108,8 @@ make_Xinits = function(pars, H, i, Xopts=list()){
#' @param i the host species index
#' @return an **`xds`** object
#' @export
make_X_indices <- function(pars, i) {
UseMethod("make_X_indices", pars$Xpar[[i]])
setup_X_indices <- function(pars, i) {
UseMethod("setup_X_indices", pars$Xpar[[i]])
}

#' @title Return the variables as a list
Expand Down
22 changes: 11 additions & 11 deletions R/human-trivial.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ F_H.trivial <- function(t, y, pars, i) {
#' @param F_trend a function returning a trend
#' @return a [list]
#' @export
create_Xpar_trivial <- function(nPatches, Xopts, kappa=.1, HPop=1,
make_Xpar_trivial <- function(nPatches, Xopts, kappa=.1, HPop=1,
F_season=F_flat, F_trend=F_flat){
with(Xopts,{
Xpar <- list()
Expand Down Expand Up @@ -119,33 +119,33 @@ F_b.trivial <- function(y, pars, i) {


#' @title xde_setup Xpar.trivial
#' @description Implements [make_Xpar] for the trivial model
#' @inheritParams make_Xpar
#' @description Implements [setup_Xpar] for the trivial model
#' @inheritParams setup_Xpar
#' @return a [list] vectord
#' @export
make_Xpar.trivial = function(Xname, pars, i, Xopts=list()){
pars$Xpar[[i]] = create_Xpar_trivial(pars$nPatches, Xopts)
setup_Xpar.trivial = function(Xname, pars, i, Xopts=list()){
pars$Xpar[[i]] = make_Xpar_trivial(pars$nPatches, Xopts)
return(pars)
}


#' @title Setup Xinits.trivial
#' @description Implements [make_Xinits] for the trivial model
#' @inheritParams make_Xinits
#' @description Implements [setup_Xinits] for the trivial model
#' @inheritParams setup_Xinits
#' @return a [list] vector
#' @export
make_Xinits.trivial = function(pars, H, i, Xopts=list()){
setup_Xinits.trivial = function(pars, H, i, Xopts=list()){
pars$Xpar[[i]]$H = H
return(pars)
}

#' @title Add indices for human population to parameter list
#' @description Implements [make_X_indices] for the trivial model.
#' @inheritParams make_X_indices
#' @description Implements [setup_X_indices] for the trivial model.
#' @inheritParams setup_X_indices
#' @return none
#' @importFrom utils tail
#' @export
make_X_indices.trivial <- function(pars, i) {
setup_X_indices.trivial <- function(pars, i) {
return(pars)
}

Expand Down
Empty file removed R/human.R
Empty file.
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ make_indices <- function(pars) {
i = length(pars$Xinits)
if(i>0)
for(ix in 1:i)
pars = make_X_indices(pars, ix)
pars = setup_X_indices(pars, ix)

return(pars)
}
Expand Down
16 changes: 8 additions & 8 deletions R/xds_setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ xds_setup = function(xds = 'ode',

# Human Dynamics
pars$Xname <- Xname
pars <- make_Xpar(Xname, pars, 1, Xopts)
pars <- make_Xinits(pars, HPop, 1, Xopts)
pars <- setup_Xpar(Xname, pars, 1, Xopts)
pars <- setup_Xinits(pars, HPop, 1, Xopts)
pars <- setup_Hpar_static(pars, 1)

pars = make_indices(pars)
Expand Down Expand Up @@ -210,7 +210,7 @@ xds_setup_mosy = function(xds = 'ode',
pars <- setup_Linits(pars, 1, Lopts)

Xo <- list(kappa=kappa, HPop=HPop)
pars <- make_Xpar("trivial", pars, 1, Xo)
pars <- setup_Xpar("trivial", pars, 1, Xo)

pars = make_indices(pars)

Expand Down Expand Up @@ -277,7 +277,7 @@ xds_setup_aquatic = function(xds = 'ode',

# Human Dynamics
pars$Xname <- "trivial"
pars <- make_Xpar("trivial", pars, 1, list())
pars <- setup_Xpar("trivial", pars, 1, list())

pars = make_indices(pars)
pars$model_name <- model_name
Expand Down Expand Up @@ -353,8 +353,8 @@ xds_setup_human = function(Xname = "SIS",

# Human Dynamics
pars$Xname <- Xname
pars <- make_Xpar(Xname, pars, 1, Xopts)
pars <- make_Xinits(pars, HPop, 1, Xopts)
pars <- setup_Xpar(Xname, pars, 1, Xopts)
pars <- setup_Xinits(pars, HPop, 1, Xopts)
pars <- setup_Hpar_static(pars, 1)

pars = make_indices(pars)
Expand Down Expand Up @@ -448,8 +448,8 @@ xds_setup_cohort = function(eir=1,

# Human Dynamics
pars$Xname <- Xname
pars <- make_Xpar(Xname, pars, 1, Xopts)
pars <- make_Xinits(pars, HPop, 1, Xopts)
pars <- setup_Xpar(Xname, pars, 1, Xopts)
pars <- setup_Xinits(pars, HPop, 1, Xopts)
pars <- setup_Hpar_static(pars, 1)

pars = make_indices(pars)
Expand Down
Loading

0 comments on commit 5963f89

Please sign in to comment.