[comparator] [log extractor] extract cons even without emag output
This commit is contained in:
+10
-6
@@ -253,11 +253,13 @@ class Comparator(Aggregator, HDF5Container):
|
||||
return series
|
||||
|
||||
def _extract_cons_from_log(self, series, log_filename, run):
|
||||
cmd_grep = "grep 'Main step' {} -A 2".format(log_filename)
|
||||
mhd = self.pp_params.input.mhd
|
||||
nlines = 2 + int(mhd) # Number of useful lines
|
||||
cmd_grep = "grep 'Main step' {} -A {}".format(log_filename, nlines - 1)
|
||||
content = os.popen(cmd_grep).readlines()
|
||||
for i in range(0, len(content), 4):
|
||||
for i in range(0, len(content), nlines + 1):
|
||||
series["time"][run].append(
|
||||
np.float(content[i + 2].split("=")[2].split()[0])
|
||||
np.float(content[i + nlines - 1].split("=")[2].split()[0])
|
||||
)
|
||||
series["step"][run].append(np.int(content[i].split("=")[1].split()[0]))
|
||||
series["mcons"][run].append(np.float(content[i].split("=")[2].split()[0]))
|
||||
@@ -265,9 +267,11 @@ class Comparator(Aggregator, HDF5Container):
|
||||
series["epot"][run].append(np.float(content[i].split("=")[4].split()[0]))
|
||||
series["ekin"][run].append(np.float(content[i].split("=")[5].split()[0]))
|
||||
series["eint"][run].append(np.float(content[i].split("=")[6].split()[0]))
|
||||
series["emag"][run].append(
|
||||
np.float(content[i + 1].split("=")[1].split()[0])
|
||||
)
|
||||
if mhd:
|
||||
emag = np.float(content[i + 1].split("=")[1].split()[0])
|
||||
series["emag"][run].append(emag)
|
||||
else:
|
||||
series["emag"][run].append(0.0)
|
||||
return series
|
||||
|
||||
def _extract_rms_from_log(self, series, log_filename, run):
|
||||
|
||||
Reference in New Issue
Block a user