Tue 27 Jan 00:26:46 CET 2026
This commit is contained in:
parent
12b3a70be0
commit
90fb493f32
|
|
@ -8,6 +8,7 @@ from scipy.misc import imsave
|
||||||
from scipy.io import savemat
|
from scipy.io import savemat
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
import yaml
|
||||||
|
|
||||||
class SnapShots:
|
class SnapShots:
|
||||||
def __init__(self, Enable=False, Extension='.png', Step=200, Filename=None, File_path = None, dB=60, Color=0,
|
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,
|
enableCsv=False,
|
||||||
enableVolume=False,
|
enableVolume=False,
|
||||||
enableView=False,
|
enableView=False,
|
||||||
|
enableSummary=False,
|
||||||
sensorShape = [],
|
sensorShape = [],
|
||||||
sensorPlacement = [],
|
sensorPlacement = [],
|
||||||
sensorSize = 0):
|
sensorSize = 0):
|
||||||
|
|
@ -46,6 +48,7 @@ class SnapShots:
|
||||||
self.enableCsv = enableCsv
|
self.enableCsv = enableCsv
|
||||||
self.enableVolume = enableVolume
|
self.enableVolume = enableVolume
|
||||||
self.enableView = enableView
|
self.enableView = enableView
|
||||||
|
self.enableSummary = enableSummary
|
||||||
self.sensorShape = sensorShape
|
self.sensorShape = sensorShape
|
||||||
self.sensorPlacement = sensorPlacement
|
self.sensorPlacement = sensorPlacement
|
||||||
self.sensorSize = sensorSize
|
self.sensorSize = sensorSize
|
||||||
|
|
@ -179,6 +182,20 @@ class SnapShots:
|
||||||
FILE = self.Filename + ("-signal-"+Label+"-%05d" % (int(n / self.Step))) + ".mat"
|
FILE = self.Filename + ("-signal-"+Label+"-%05d" % (int(n / self.Step))) + ".mat"
|
||||||
savemat(FILE, S)
|
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):
|
def save_power(self, Vx, Vy, n):
|
||||||
|
|
||||||
S = np.sqrt(Vx ** 2 + Vy ** 2)
|
S = np.sqrt(Vx ** 2 + Vy ** 2)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user