Skip to content
Merged
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
3 changes: 3 additions & 0 deletions Utilities/Python/FDS_validation_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import subprocess
import fdsplotlib
import matplotlib.pyplot as plt
import importlib
import runpy
importlib.reload(fdsplotlib) # use for development (while making changes to fdsplotlib.py)
Expand All @@ -12,6 +13,8 @@
def safe_run(script_path):
try:
runpy.run_path(script_path, run_name="__main__")
plt.clf() # Clear the current figure (if any)
plt.close('all') # Close all open figure windows
except Exception as exc:
print(f"Error in {script_path}: {exc}")

Expand Down
3 changes: 3 additions & 0 deletions Utilities/Python/FDS_verification_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import subprocess
import fdsplotlib
import matplotlib.pyplot as plt
import runpy
import importlib
importlib.reload(fdsplotlib) # use for development (while making changes to fdsplotlib.py)
Expand All @@ -14,6 +15,8 @@
def safe_run(script_path):
try:
runpy.run_path(script_path, run_name="__main__")
plt.clf() # Clear the current figure (if any)
plt.close('all') # Close all open figure windows
except Exception as exc:
print(f"Error in {script_path}: {exc}")

Expand Down
12 changes: 6 additions & 6 deletions Utilities/Python/fdsplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2022,22 +2022,22 @@ def scatplot(saved_data, drange, **kwargs):

for _, row in Q.iterrows():
plt.close('all')
plt.figure().clear()
plt.clf()

Scatter_Plot_Title = row["Scatter_Plot_Title"]
Plot_Filename = row["Plot_Filename"]
Plot_Min = float(row["Plot_Min"])
Plot_Max = float(row["Plot_Max"])
Plot_Type = str(row["Plot_Type"]).strip().lower()

# --- MATLAB parity: Sigma_E only required for Validation ---
# --- Sigma_E only required for Validation ---
if Stats_Output.lower() == "validation":
Sigma_E_input = float(row["Sigma_E"]) if "Sigma_E" in row and not pd.isna(row["Sigma_E"]) else 0.0
else:
Sigma_E_input = 0.0

#if verbose:
# print(f"[scatplot] Processing {Scatter_Plot_Title}")
if verbose:
print(f"[scatplot] Processing {Scatter_Plot_Title}")

# Match dataplot entries
match_idx = [i for i, q in enumerate(Save_Quantity)
Expand Down Expand Up @@ -2276,7 +2276,7 @@ def _label_at(k, labels):
os.makedirs(os.path.dirname(pdf_path), exist_ok=True)
fig.savefig(pdf_path)
plt.close(fig)
plt.figure().clear()
plt.clf()

# --- Collect statistics for CSV/TeX ---
group_labels = []
Expand Down Expand Up @@ -2608,7 +2608,7 @@ def statistics_histogram(Measured_Values, Predicted_Values,
plt.tight_layout()
fig.savefig(outpath)
plt.close(fig)
plt.figure().clear()
plt.clf()

return f"{os.path.basename(Plot_Filename)}_Histogram"

Expand Down