Skip to content

Commit b7c5859

Browse files
committed
added partial mitigation for prep users to big model
1 parent 88881bd commit b7c5859

File tree

2 files changed

+25
-16
lines changed

2 files changed

+25
-16
lines changed

notebooks/Nobs_Nreal_derivatives_bigmodel.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
onlyplots = False # if True, only plots are generated, if False, first data is generated and then plots
2222
derivative = "dP" # dP: derivative with respect to PrEP adoption, dH: derivative with respect to risk awareness
2323

24-
which_c = 8
24+
which_c = 9
25+
which_xi = 0
2526

2627
sets_of_c = jnp.array([
2728
[31.0, 40.0, 60.0, 203.0],
@@ -32,7 +33,13 @@
3233
[2.0, 80.0, 53.3, 200.0],
3334
[2.0, 63.5, 100.0, 200.0], #6
3435
[75, 39, 18.5, 2], #7
35-
[10.0, 50.0, 120.0, 190.0] #8
36+
[10.0, 50.0, 120.0, 190.0], #8
37+
[50.0, 50.0, 50.0, 50.0] #9
38+
])
39+
sets_of_xi = jnp.array([
40+
[0.0, 0.0, 0.0, 0.0],
41+
[0.8, 0.6, 0.4, 0.2], #1
42+
[0.2, 0.4, 0.6, 0.8] #2
3643
])
3744

3845

@@ -71,6 +78,7 @@ def calc_Nreal(H, P, lambdaP, betaSTI):
7178
args_mod["lambda_P"] = lambdaP
7279
args_mod["beta_STI"] = betaSTI
7380
args_mod["c"] = sets_of_c[which_c]
81+
args_mod["xi"] = sets_of_xi[which_xi] # partial mitigation for people on PrEP
7482

7583
# run the model fro 80 years (long time to get to steady state)
7684
output = icomo.diffeqsolve(args = args_mod, ODE = bigmodel_STI.main_model, y0 = y0, ts_out = np.linspace(0, 365*80, 365*80+1), max_steps=365*80+1)
@@ -137,7 +145,7 @@ def calc_Nobs(H, P, lambdaP, betaSTI):
137145
# save stuff as npy files
138146

139147
with open(
140-
"../results/Nreal_Nobs_bigmodel_lambdap%g_betaSTI%g_dN%s_c%s.npy" %(lambdaP * 360, betaSTI, derivative, which_c),"wb",) as f:
148+
"../results/Nreal_Nobs_bigmodel_lambdap%g_betaSTI%g_dN%s_c%s_xi%s.npy" %(lambdaP * 360, betaSTI, derivative, which_c, which_xi),"wb",) as f:
141149
np.save(f, Ps)
142150
np.save(f, Hs)
143151
np.save(f, dNrealdP)
@@ -198,7 +206,7 @@ def discretize_cmaps(cmap, N):
198206
res = []
199207
for lambdaP in lambda_P_values:
200208
# load data
201-
with open("../results/Nreal_Nobs_bigmodel_lambdap%g_betaSTI%g_dN%s_c%s.npy" %(lambdaP * 360, betaSTI, derivative, which_c),"rb") as f:
209+
with open("../results/Nreal_Nobs_bigmodel_lambdap%g_betaSTI%g_dN%s_c%s_xi%s.npy" %(lambdaP * 360, betaSTI, derivative, which_c, which_xi),"rb") as f:
202210
Ps_plot = np.load(f)
203211
Hs_plot = np.load(f)
204212
dNrealdP_plot = np.load(f)
@@ -268,4 +276,4 @@ def discretize_cmaps(cmap, N):
268276
#plt.tight_layout()
269277
#plt.show()
270278

271-
fig.savefig("../figures/final_figure_withinflux_bigmodel_DERIVATIVES_dN%s_c%s.pdf" %(derivative, which_c), format="pdf", bbox_inches="tight")
279+
fig.savefig("../figures/final_figure_withinflux_bigmodel_DERIVATIVES_dN%s_c%s_xi%s.pdf" %(derivative, which_c, which_xi), format="pdf", bbox_inches="tight")

src/tapm/HIVandSTI/bigmodel_STI.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,16 @@ def duration2rate(x):
102102
[2.0, 80.0, 53.3, 200.0],
103103
[2.0, 63.5, 100.0, 200.0],
104104
[75, 39, 18.5, 2],
105+
[50,50,50,50] #8
105106
])
106-
c = sets_of_c[2] # 2, 5, 7
107-
sets_of_r = jnp.array([
108-
[1.0, 1.0, 1.0, 1.0 ],
109-
[1.5, 0.8, 0.3, 0.05 ],
110-
[1.2, 1.1, 0.5, 0.113 ],
111-
[0.5, 0.8, 2.0, 3.41 ]
107+
c = sets_of_c[8] # 2, 5, 7
108+
109+
sets_of_xi = jnp.array([
110+
[0.0, 0.0, 0.0, 0.0],
111+
[0.8, 0.6, 0.4, 0.2], #1
112+
[0.2, 0.4, 0.6, 0.8] #2
112113
])
113-
r = sets_of_r[2]
114+
xi = sets_of_xi[1] # risk assimilation (partial mitigation for people on PrEP)
114115

115116
#H = 5.0 # HIV hazard
116117
#P = 50.0 # PrEP fraction
@@ -121,7 +122,6 @@ def duration2rate(x):
121122
"mu": mu,
122123
"Omega": Omega,
123124
"c": c,
124-
"r": r,
125125
"c_hiv": c_hiv,
126126
"h": h,
127127
"epsilon": epsilon,
@@ -148,7 +148,7 @@ def duration2rate(x):
148148
"gamma_STI": gamma_STI,
149149
"gammaT_STI": gammaT_STI,
150150
"beta_HIV": beta_HIV,
151-
151+
"xi": xi,
152152
#"H": H,
153153
#"P": P
154154
}
@@ -220,7 +220,8 @@ def foi_STI(y, args):
220220
"""
221221

222222
I_eff = y["Ia_STI"] + y["Is_STI"]
223-
foi = args["beta_STI"] * (1 - m(args, y)*(1 - prep_fraction(y, args)) ) *contact_matrix(y, args) @ (I_eff/N_0)
223+
# foi = args["beta_STI"] * (1 - m(args, y)*(1 - prep_fraction(y, args)) ) *contact_matrix(y, args) @ (I_eff/N_0) # without xi
224+
foi = args["beta_STI"] * ((1 - m(args, y))*(1 - prep_fraction(y, args)) + (1-args["xi"]*m(args, y)) * prep_fraction(y, args)) *contact_matrix(y, args) @ (I_eff/N_0)
224225
return foi
225226

226227
def contact_matrix(y, args):
@@ -257,7 +258,7 @@ def prep_fraction(y, args):
257258
Returns:
258259
Value as float64.
259260
"""
260-
return args["P"]*args["r"]
261+
return args["P"]
261262

262263

263264
def lambda_a(y, args):

0 commit comments

Comments
 (0)