Skip to content

Commit

Permalink
resolved conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
kevroy314 committed Mar 28, 2019
1 parent c96fe9a commit 6e5e314
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
Binary file modified __pycache__/aggregate_visualization.cpython-36.pyc
Binary file not shown.
Binary file modified __pycache__/distemper.cpython-36.pyc
Binary file not shown.
Binary file modified __pycache__/main.cpython-36.pyc
Binary file not shown.
10 changes: 8 additions & 2 deletions aggregate_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pyqtgraph as pg # pylint: disable=E0401
from pyqtgraph.Qt import QtCore, QtGui # pylint: disable=E0401

import numpy as np

class AggregatePlot(object):
'''This class renders aggregate variables from a disease simulation.
Expand Down Expand Up @@ -97,8 +98,13 @@ def update(self):
self.data['imm'].append(survived_nodes)
self.data['die'].append(died_nodes)

self.data['ir'].append(self.disease.total_infected/self.disease.total_intake)
self.data['sr'].append(self.disease.total_discharged/self.disease.total_intake)
if self.disease.total_intake != 0:
self.data['ir'].append(self.disease.total_infected/self.disease.total_intake)
self.data['sr'].append(self.disease.total_discharged/self.disease.total_intake)
else:
self.data['ir'].append(np.nan)
self.data['sr'].append(np.nan)


for curve, data in zip(self.curves, [self.data['tpop'], self.data['pop'],
self.data['tinf'], self.data['inf'], self.data['ir'],
Expand Down
16 changes: 12 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def main(mode='visual'):
'''
np.random.seed(1234)

if os.path.exists('./sim_params.json'):
with open('./sim_params.json') as f:
if os.path.exists('./realistic_sim_params.json'):
with open('./realistic_sim_params.json') as f:
params = json.load(f)
print("Loaded ./sim_params.json"+"-"*30)
print("Loaded ./realistic_sim_params.json"+"-"*30)

else:
# Note: all probabilities are in units p(event) per hour
Expand Down Expand Up @@ -113,7 +113,11 @@ def main(mode='visual'):
sim = simulation.Simulation(params,
spatial_visualization=True,
aggregate_visualization=True,
<<<<<<< Updated upstream
return_on_equillibrium=True,)
=======
return_on_equillibrium=False,)
>>>>>>> Stashed changes
print(sim.run())
elif mode == 'stats':
runs = 30
Expand All @@ -136,7 +140,7 @@ def main(mode='visual'):
colors = [cm.jet(0), cm.jet(0.33), cm.jet(0.66)] #pylint: disable=E1101
alphas = [0.75, 0.5, 0.25]
labels = ['Room Lock Intervention', 'Snake Intervention', 'No Intervention']

print(params)
params['intervention'] = 'RoomLockIntervention()'

params1 = copy(params)
Expand Down Expand Up @@ -224,6 +228,10 @@ def _get_nice_display_results(_p):


if __name__ == '__main__':
<<<<<<< Updated upstream
assert args.mode in ['visual', 'batch', 'stats']
#main(mode=args.mode)
main(mode='stats')
=======
main(batch=False)#args.use_batch)
>>>>>>> Stashed changes
2 changes: 1 addition & 1 deletion sim_params.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"pSusceptibleIntake": 0.05, "pInfectIntake": 0.005, "pSymptomaticIntake": 0.0, "pInsusceptibleIntake": 0.029339218966702094, "pSurviveInfected": 0.0, "pSurviveSymptomatic": 0.0, "pDieAlternate": 0.0025, "pDischarge": 0.0, "pCleaning": 1.0, "refractoryPeriod": 168.0, "pSymptomatic": 0.0, "pDie": 0.0, "infection_kernel": [0.045234156049009, 0.01], "infection_kernel_function": "lambda node, k: k*(1-node['occupant']['immunity'])", "immunity_growth_factors": [0.0114, 0.0129, 0.0146, 0.0166, 0.0187, 0.0212, 0.024, 0.0271, 0.0306, 0.0346, 0.039, 0.044, 0.0496, 0.0559, 0.0629, 0.0707, 0.0794, 0.0891, 0.0998, 0.1117, 0.1248, 0.1392, 0.1549, 0.1721, 0.1908, 0.2109, 0.2326, 0.2558, 0.2804, 0.3065, 0.3338, 0.3623, 0.3918, 0.4221, 0.453, 0.4843, 0.5157, 0.547, 0.5779, 0.6082, 0.6377, 0.6662, 0.6935, 0.7196, 0.7442, 0.7674, 0.7891, 0.8092, 0.8279, 0.8451, 0.8608, 0.8752, 0.8883, 0.9002, 0.9109, 0.9206, 0.9293, 0.9371, 0.9441, 0.9504, 0.956, 0.961, 0.9654, 0.9694, 0.9729, 0.976, 0.9788, 0.9813, 0.9834, 0.9854, 0.9871, 0.9886], "immunity_lut": true, "max_time": 744, "max_intakes": null, "intervention": "RoomLockIntervention()"}
{"pSusceptibleIntake": 0.05, "pInfectIntake": 0.005, "pSymptomaticIntake": 0.0, "pInsusceptibleIntake": 0.029339218966702094, "pSurviveInfected": 0.0, "pSurviveSymptomatic": 0.0, "pDieAlternate": 0.0025, "pDischarge": 0.0, "pCleaning": 1.0, "refractoryPeriod": 168.0, "pSymptomatic": 0.0, "pDie": 0.0, "infection_kernel": [0.045234156049009, 0.01], "infection_kernel_function": "lambda node, k: k*(1-node['occupant']['immunity'])", "immunity_growth_factors": [0.0114, 0.0129, 0.0146, 0.0166, 0.0187, 0.0212, 0.024, 0.0271, 0.0306, 0.0346, 0.039, 0.044, 0.0496, 0.0559, 0.0629, 0.0707, 0.0794, 0.0891, 0.0998, 0.1117, 0.1248, 0.1392, 0.1549, 0.1721, 0.1908, 0.2109, 0.2326, 0.2558, 0.2804, 0.3065, 0.3338, 0.3623, 0.3918, 0.4221, 0.453, 0.4843, 0.5157, 0.547, 0.5779, 0.6082, 0.6377, 0.6662, 0.6935, 0.7196, 0.7442, 0.7674, 0.7891, 0.8092, 0.8279, 0.8451, 0.8608, 0.8752, 0.8883, 0.9002, 0.9109, 0.9206, 0.9293, 0.9371, 0.9441, 0.9504, 0.956, 0.961, 0.9654, 0.9694, 0.9729, 0.976, 0.9788, 0.9813, 0.9834, 0.9854, 0.9871, 0.9886], "immunity_lut": true, "max_time": 744, "max_intakes": null, "intervention": "RoomLockIntervention()"}

0 comments on commit 6e5e314

Please sign in to comment.