Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

final paper examples #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions examples/paper/seeds_final_examples.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
112312231
982525
12369433
9478123
2314675
123123957
71278
2394194
123412
98211034
84912937
1231
746184904
1231414
716488130
8165143
19577134
93483
2342315
914235813
47 changes: 7 additions & 40 deletions examples/paper/simulate_idealized_NYC_epidemic.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
set_num_threads(1)

# Set random seeds for reproducibility
seed = 942395
seed = 1231414#1285854#1237102#123746
seed_three_random_states(seed)

# contact network ##############################################################
Expand Down Expand Up @@ -119,7 +119,7 @@
statuses = random_epidemic(
network.get_node_count(),
network.get_nodes(),
fraction_infected=0.0025)
fraction_infected=0.0015)

epidemic_simulator.set_statuses(statuses)

Expand All @@ -129,7 +129,7 @@
# set the new contact rates on the network
# run the kinetic model [kinetic produces the current statuses used as data]
network = epidemic_simulator.run(
stop_time = epidemic_simulator.time + 18,
stop_time = epidemic_simulator.time + 19,
current_network = network)

kinetic_model = epidemic_simulator.kinetic_model
Expand All @@ -141,40 +141,7 @@
λ_min = 2 # minimum contact rate
λ_max = 8 # maximum contact rate

health_service = epidemic_simulator.health_service

statuses = epidemic_simulator.kinetic_model.current_statuses

epidemic_simulator = EpidemicSimulator(
network,
community_transmission_rate = community_transmission_rate['mean'],
hospital_transmission_reduction = hospital_transmission_reduction,
static_contact_interval = static_contact_interval,
mean_contact_lifetime = mean_contact_lifetime,
day_inception_rate = λ_max,
night_inception_rate = λ_min,
health_service = health_service,
start_time = epidemic_simulator.time)

epidemic_simulator.set_statuses(statuses)

# run the kinetic model
network = epidemic_simulator.run(
stop_time = epidemic_simulator.time + 83,
current_network = network)

for key in kinetic_model.statuses.keys():
kinetic_model.statuses[key].extend(epidemic_simulator.kinetic_model.statuses[key])


kinetic_model.times.extend(kinetic_model.times[-1]+epidemic_simulator.kinetic_model.times)

################################################################################
# loosening SD intervention ####################################################
################################################################################

λ_min = 2 # minimum contact rate
λ_max = 22 # maximum contact rate
network.set_lambdas(λ_min, λ_max)

health_service = epidemic_simulator.health_service

Expand All @@ -195,20 +162,20 @@

# run the kinetic model
network = epidemic_simulator.run(
stop_time = epidemic_simulator.time + 90,
stop_time = epidemic_simulator.time + 112,
current_network = network)

for key in kinetic_model.statuses.keys():
kinetic_model.statuses[key].extend(epidemic_simulator.kinetic_model.statuses[key])

kinetic_model.times.extend(kinetic_model.times[-1]+epidemic_simulator.kinetic_model.times)
kinetic_model.times.extend(epidemic_simulator.kinetic_model.times)

################################################################################
# save #########################################################################
################################################################################
if SAVE_FLAG:
np.savetxt(
os.path.join(SIMULATION_PATH, 'NYC_interventions_1e5.txt'),
os.path.join(SIMULATION_PATH, 'NYC_interventions_1e5_13.txt'),
np.c_[
kinetic_model.times,
kinetic_model.statuses['S'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
set_num_threads(1)

# Set random seeds for reproducibility
seed = 942395
seed = 914235813
seed_three_random_states(seed)

# contact network ##############################################################
Expand Down Expand Up @@ -119,7 +119,7 @@
statuses = random_epidemic(
network.get_node_count(),
network.get_nodes(),
fraction_infected=0.0025)
fraction_infected=0.0015)

epidemic_simulator.set_statuses(statuses)

Expand All @@ -129,7 +129,7 @@
# set the new contact rates on the network
# run the kinetic model [kinetic produces the current statuses used as data]
network = epidemic_simulator.run(
stop_time = epidemic_simulator.time + 185,
stop_time = epidemic_simulator.time + 132,
current_network = network)

kinetic_model = epidemic_simulator.kinetic_model
Expand All @@ -139,7 +139,7 @@
################################################################################
if SAVE_FLAG:
np.savetxt(
os.path.join(SIMULATION_PATH, 'NYC_nointerventions_1e5.txt'),
os.path.join(SIMULATION_PATH, 'NYC_nointerventions_1e5_19.txt'),
np.c_[
kinetic_model.times,
kinetic_model.statuses['S'],
Expand Down
Loading