Skip to content

Commit 22f1906

Browse files
committed
fmk, claude - updates to run_residual_demand.py: fix script hanging on windows due to a process hanging, forcing non-interactive mode and closing plots
1 parent c465729 commit 22f1906

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

modules/systemPerformance/ResidualDemand/run_residual_demand.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050

5151
import contextily as cx
5252
import geopandas as gpd
53+
54+
# doing these next two lines so matplotlib is forces non-interactive background to stop hanging on windows due to thred not dying
55+
import matplotlib
56+
matplotlib.use('Agg')
5357
import matplotlib.pyplot as plt
5458
import numpy as np
5559
import pandas as pd
@@ -166,6 +170,7 @@ def create_congestion_animation(edge_vol_dir, output_file_name):
166170
interval=10,
167171
)
168172
animation.save(output_file_name, writer='imagemagick', fps=2)
173+
plt.close('all')
169174

170175

171176
def get_highest_congestion(edge_vol_dir, edges_csv):

0 commit comments

Comments
 (0)