Tue 27 Jan 00:01:08 CET 2026
This commit is contained in:
parent
78ca43969d
commit
28cce8003a
|
|
@ -52,6 +52,7 @@ class SnapShots:
|
|||
self.volF = []
|
||||
self.volS = []
|
||||
self.volP = []
|
||||
self.vecT = [] # time vector
|
||||
|
||||
print("SnapShots Field="+str(Field)+" enableNumPy="+str(enableNumPy)+" enableCsv="+str(enableCsv)+" enableVolume="+str(enableVolume)+ " enableSignals="+str(enableSignals)+ " enableMaterial="+str(enableMaterial))
|
||||
# if self.File_path does not exist, create it
|
||||
|
|
@ -127,12 +128,18 @@ class SnapShots:
|
|||
np.save(FILE_PATH,VT)
|
||||
|
||||
|
||||
def save_signal(self, D , n, Label):
|
||||
def save_signal(self, D , n, Label, dt):
|
||||
|
||||
self.Label = Label
|
||||
xn = D.shape[1]
|
||||
yn = D.shape[0]
|
||||
print('['+str(int(n / self.Step))+'] Saving signal '+Label+' shape=('+str(xn)+','+str(yn)+') sensorShape='+str(self.sensorShape))
|
||||
if self.enableVolume:
|
||||
print('['+str(int(n / self.Step))+'@'+str(dt*n)+'] Storing signal '+Label+' field shape=('+str(xn)+','+str(yn)+')'+
|
||||
' sensorShape='+str(self.sensorShape))
|
||||
else:
|
||||
print('['+str(int(n / self.Step))+'@'+str(dt*n)+'] Saving signal '+Label+' field shape=('+str(xn)+','+str(yn)+')'+
|
||||
' sensorShape='+str(self.sensorShape))
|
||||
|
||||
dx = 1 # sensor delta
|
||||
dy = 1
|
||||
ox = 0 # offset
|
||||
|
|
@ -156,9 +163,10 @@ class SnapShots:
|
|||
S[y,x]=D[oy+y*dy,ox+x*dx]
|
||||
else:
|
||||
S = D
|
||||
|
||||
|
||||
if self.enableVolume:
|
||||
self.volS.append(np.copy(S))
|
||||
self.vecT.append(dt*n)
|
||||
elif self.enableNumPy:
|
||||
FILE = self.Filename + ("-signal-"+Label+"-%05d" % (int(n / self.Step)))
|
||||
FILE_PATH = os.path.join(self.File_path, FILE)
|
||||
|
|
@ -252,12 +260,18 @@ class SnapShots:
|
|||
FILE = self.Filename + '-signal-'+self.Label+".csv"
|
||||
FILE_PATH = os.path.join(self.File_path, FILE)
|
||||
vol=np.array(self.volS)
|
||||
vec=np.array(self.vecT)
|
||||
vec=vec.reshape(vec.shape[0],1)
|
||||
if vol.shape[1]==1:
|
||||
vol=vol.reshape(vol.shape[0],vol.shape[1])
|
||||
elif vol.shape[2]==1:
|
||||
vol=vol.reshape(vol.shape[0],vol.shape[2])
|
||||
vol=np.hstack((vec,vol))
|
||||
print("Saving reduced CSV S-volume "+str(vol.shape)+" in "+FILE_PATH)
|
||||
np.savetxt(FILE_PATH, vol, delimiter=",")
|
||||
header="time"
|
||||
for i in range(1,vol.shape[1]):
|
||||
header=header+",sig"+str(i)
|
||||
np.savetxt(FILE_PATH, vol, delimiter=",",header=header,comments="")
|
||||
self.volS=[]
|
||||
|
||||
if len(self.volP) > 0:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user