Skip to content

Commit a712c27

Browse files
hotfix for paulvangentcom#3 until refactor is done
1 parent f7881e2 commit a712c27

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

path_planning_demo.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import sys
23

34
import numpy as np
@@ -336,7 +337,7 @@ def update(frame, population, destinations, pop_size, infection_range=0.01,
336337

337338
#ax2.legend(loc = 1, fontsize = 6)
338339

339-
plt.savefig('render/%i.png' %frame)
340+
#plt.savefig('render/%i.png' %frame)
340341

341342
return population
342343

@@ -403,9 +404,9 @@ def update(frame, population, destinations, pop_size, infection_range=0.01,
403404
#initialize destination matrix
404405
destinations = initialize_destination_matrix(pop_size, 1)
405406

406-
407-
408-
#place hospital on map
407+
#create render folder if doesn't exist
408+
if not os.path.exists('render/'):
409+
os.makedirs('render/')
409410

410411
#define figure
411412
fig = plt.figure(figsize=(5,7))

simple_simulation.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import sys
23

34
import numpy as np
@@ -347,7 +348,7 @@ def update(frame, population, infection_range=0.01, infection_chance=0.03,
347348
ax2.set_ylim(0, pop_size + 100)
348349
ax2.plot(infected_plot, color='gray')
349350

350-
plt.savefig('render/%s.png' %frame)
351+
#plt.savefig('render/%s.png' %frame)
351352

352353

353354

@@ -375,7 +376,10 @@ def update(frame, population, infection_range=0.01, infection_chance=0.03,
375376
ax2.set_xlim(0, simulation_steps)
376377
ax2.set_ylim(0, pop_size + 100)
377378

378-
379+
#create render folder if doesn't exist
380+
if not os.path.exists('render/'):
381+
os.makedirs('render/')
382+
379383

380384
#start animation loop through matplotlib visualisation
381385
animation = FuncAnimation(fig, update, fargs = (population,), frames = simulation_steps, interval = 33)

simulation.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import sys
23

34
import numpy as np
@@ -240,6 +241,10 @@ def update(frame, population, destinations, pop_size, infection_range=0.01,
240241
##### END OF SETTABLE PARAMETERS #####
241242
######################################
242243

244+
#create render folder if doesn't exist
245+
if not os.path.exists('render/'):
246+
os.makedirs('render/')
247+
243248
#initialise population
244249
population = initialize_population(pop_size, mean_age, max_age, xbounds, ybounds)
245250

0 commit comments

Comments
 (0)