From 90fb493f32c2f3f1028a56fbeb4cbd9407f6efd2 Mon Sep 17 00:00:00 2001 From: sbosse Date: Tue, 27 Jan 2026 00:29:25 +0100 Subject: [PATCH] Tue 27 Jan 00:26:46 CET 2026 --- src/SimNDT/run_setup/snapshots.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/SimNDT/run_setup/snapshots.py b/src/SimNDT/run_setup/snapshots.py index 7564de8..9537d26 100644 --- a/src/SimNDT/run_setup/snapshots.py +++ b/src/SimNDT/run_setup/snapshots.py @@ -8,6 +8,7 @@ from scipy.misc import imsave from scipy.io import savemat import math +import yaml class SnapShots: def __init__(self, Enable=False, Extension='.png', Step=200, Filename=None, File_path = None, dB=60, Color=0, @@ -21,6 +22,7 @@ class SnapShots: enableCsv=False, enableVolume=False, enableView=False, + enableSummary=False, sensorShape = [], sensorPlacement = [], sensorSize = 0): @@ -46,6 +48,7 @@ class SnapShots: self.enableCsv = enableCsv self.enableVolume = enableVolume self.enableView = enableView + self.enableSummary = enableSummary self.sensorShape = sensorShape self.sensorPlacement = sensorPlacement self.sensorSize = sensorSize @@ -179,6 +182,20 @@ class SnapShots: FILE = self.Filename + ("-signal-"+Label+"-%05d" % (int(n / self.Step))) + ".mat" savemat(FILE, S) + + def save_summary (self,dt,dx): + if self.enableSummary == True: + FILE = self.Filename + ("-simulation.yml") + FILE_PATH = os.path.join(self.File_path, FILE) + # save in yaml format + data = dict ( + dt=dt, + dx=dx + ) + print("Saving simulation summary in "+FILE_PATH) + with open(FILE_PATH, 'w') as outfile: + yaml.dump(data, outfile, default_flow_style=False) + def save_power(self, Vx, Vy, n): S = np.sqrt(Vx ** 2 + Vy ** 2)