Tue 27 Jan 10:39:43 CET 2026
This commit is contained in:
parent
be0edb5d56
commit
b948765864
|
|
@ -10,6 +10,17 @@ from scipy.io import savemat
|
||||||
import math
|
import math
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
def strip_python_tags(s):
|
||||||
|
result = []
|
||||||
|
|
||||||
|
for line in s.splitlines():
|
||||||
|
line = re.sub("!!python/[^ ]+","",line)
|
||||||
|
line = re.sub("!![^ ]","",line)
|
||||||
|
result.append(line)
|
||||||
|
return '\n'.join(result)
|
||||||
|
|
||||||
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,
|
||||||
Field = 0,
|
Field = 0,
|
||||||
|
|
@ -183,19 +194,17 @@ class SnapShots:
|
||||||
savemat(FILE, S)
|
savemat(FILE, S)
|
||||||
|
|
||||||
|
|
||||||
def save_summary (self,dt,dx):
|
def save_summary (self,data):
|
||||||
if self.enableSummary == True:
|
if self.enableSummary == True:
|
||||||
FILE = self.Filename + ("-simulation.yml")
|
FILE = self.Filename + ("-simulation.yml")
|
||||||
FILE_PATH = os.path.join(self.File_path, FILE)
|
FILE_PATH = os.path.join(self.File_path, FILE)
|
||||||
# save in yaml format
|
# save in yaml format
|
||||||
data = dict (
|
|
||||||
dt=dt,
|
|
||||||
dx=dx
|
|
||||||
)
|
|
||||||
print("Saving simulation summary in "+FILE_PATH)
|
print("Saving simulation summary in "+FILE_PATH)
|
||||||
|
yaml.encoding = None
|
||||||
|
text = strip_python_tags(yaml.dump(data,default_flow_style=False))
|
||||||
with open(FILE_PATH, 'w') as outfile:
|
with open(FILE_PATH, 'w') as outfile:
|
||||||
yaml.dump(data, outfile, default_flow_style=False)
|
outfile.write(text)
|
||||||
|
|
||||||
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