-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact_mrsasweep.py
67 lines (56 loc) · 2.14 KB
/
contact_mrsasweep.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
###############################################################
# MRSA Transmission Model #
# Universal Contact Precaution Induced Change in Contact Rate #
###############################################################
# Module Imports
import os
import stochpy
import numpy as numpy
import random
workingdir = os.getcwd()
# General simulation parameters
random.seed(23408)
start_time = 0.0
end_time = 8760
n_runs = 5000
# Model output storage arrays
acquisitions = numpy.empty([n_runs,4])
# Reduced Contact
# Here we assume that the 18.3% reduction in worker visits is simply a flat reduction
def Reduced(iteration):
model = stochpy.SSA()
model.Model(model_file='MRSA_Colonization.psc', dir=workingdir)
percentchange = random.uniform(0.50,1)
model.ChangeParameter('rho',(4.154*percentchange))
model.Endtime(end_time)
model.DoStochSim()
model.GetRegularGrid(n_samples=end_time)
outcomes = model.data_stochsim_grid.species
Incident = outcomes[4][0][-1]
acquisitions[iteration,0] = (1-percentchange)*100
acquisitions[iteration,1] = Incident
# Efficient Contact
# Here we assume the same *number* of patient care tasks, but done more efficiently
# This reduces the opportunities to wash hands on exit (more tasks/visit)
# Need to change iota
def Efficient(iteration):
model = stochpy.SSA()
model.Model(model_file='MRSA_Colonization.psc', dir=workingdir)
percentchange = random.uniform(0.50,1)
model.ChangeParameter('tau',(2.389*percentchange))
model.Endtime(end_time)
model.DoStochSim()
model.GetRegularGrid(n_samples=end_time)
outcomes = model.data_stochsim_grid.species
Incident = outcomes[4][0][-1]
acquisitions[iteration,2] = (1-percentchange)*100
acquisitions[iteration,3] = Incident
for i in range(0,n_runs):
print("*** Iteration %i of %i ***" % (i+1,n_runs))
Reduced(i)
Efficient(i)
numpy.savetxt('ContactChangeOutcomes_MRSA_Sweep.csv',acquisitions,delimiter=','
,header="ReducedPer,ReducedCases,EfficientPer,EfficientCases",comments='')
print("*************************")
print("***** Runs Complete *****")
print("*************************")