diisplay bugfix
This commit is contained in:
+18
-7
@@ -95,26 +95,37 @@ def streamplot(ax, map_h, map_v, extent, **kwargs):
|
|||||||
ax.streamplot(hh, vv, map_h, map_v, **kwargs)
|
ax.streamplot(hh, vv, map_h, map_v, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def quiver(ax, map_h, map_v, extent, key_v=None, label="", **kwargs):
|
def quiver(ax, map_h, map_v, extent, key_v=None, lognorm=False, label="", **kwargs):
|
||||||
|
|
||||||
hh, vv = gethv(map_h, map_v, extent)
|
hh, vv = gethv(map_h, map_v, extent)
|
||||||
|
|
||||||
# plot vector field
|
|
||||||
vec_field = ax.quiver(hh, vv, map_h, map_v, units="width", **kwargs)
|
|
||||||
|
|
||||||
# get norm information
|
# get norm information
|
||||||
norm_v = np.sqrt(map_h ** 2 + map_v ** 2)
|
norm_v = np.sqrt(map_h ** 2 + map_v ** 2)
|
||||||
max_v = np.max(norm_v)
|
max_v = np.max(norm_v)
|
||||||
min_v = np.min(norm_v)
|
min_v = np.min(norm_v)
|
||||||
# add vector key
|
|
||||||
if key_v is None:
|
if key_v is None:
|
||||||
key_v = (max_v + min_v) / 2.0
|
key_v = (max_v + min_v) / 2.0
|
||||||
|
|
||||||
|
key = f"${key_v:g}$ {label}"
|
||||||
|
|
||||||
|
if lognorm:
|
||||||
|
lognorm_v = np.log10(norm_v)
|
||||||
|
map_h *= lognorm_v/norm_v
|
||||||
|
map_v *= lognorm_v/norm_v
|
||||||
|
key_v = np.log10(key_v)
|
||||||
|
|
||||||
|
|
||||||
|
# plot vector field
|
||||||
|
vec_field = ax.quiver(hh, vv, map_h, map_v, units="width", **kwargs)
|
||||||
|
|
||||||
|
# add vector key
|
||||||
ax.quiverkey(
|
ax.quiverkey(
|
||||||
vec_field,
|
vec_field,
|
||||||
0.6,
|
0.6,
|
||||||
0.98,
|
0.98,
|
||||||
key_v,
|
key_v,
|
||||||
f"${key_v:g}$ {label}",
|
key,
|
||||||
labelpos="E",
|
labelpos="E",
|
||||||
coordinates="figure",
|
coordinates="figure",
|
||||||
)
|
)
|
||||||
|
|||||||
+21
-14
@@ -320,19 +320,27 @@ class StudyProcessor(Aggregator, HDF5Container):
|
|||||||
cmd_grep = "grep 'Fine step' {} ".format(log_filename)
|
cmd_grep = "grep 'Fine step' {} ".format(log_filename)
|
||||||
content = os.popen(cmd_grep).readlines()
|
content = os.popen(cmd_grep).readlines()
|
||||||
for i in range(0, len(content)):
|
for i in range(0, len(content)):
|
||||||
data = content[i].replace("=", " ").split()
|
try:
|
||||||
fine_step = np.int(data[2])
|
data = content[i].replace("=", " ").split()
|
||||||
time = np.float(data[4])
|
fine_step = np.int(data[2])
|
||||||
dt = np.float(data[6])
|
time = np.float(data[4])
|
||||||
a = np.float(data[8])
|
dt = np.float(data[6])
|
||||||
mempc1 = np.float(data[10][:-1])
|
a = np.float(data[8])
|
||||||
mempc2 = np.float(data[11][:-1])
|
mempc1 = np.float(data[10][:-1])
|
||||||
series["time"][run].append(time)
|
mempc2 = np.float(data[11][:-1])
|
||||||
series["fine_step"][run].append(fine_step)
|
series["time"][run].append(time)
|
||||||
series["dt"][run].append(dt)
|
series["fine_step"][run].append(fine_step)
|
||||||
series["a"][run].append(a)
|
series["dt"][run].append(dt)
|
||||||
series["mem_cells"][run].append(mempc1)
|
series["a"][run].append(a)
|
||||||
series["mem_parts"][run].append(mempc2)
|
series["mem_cells"][run].append(mempc1)
|
||||||
|
series["mem_parts"][run].append(mempc2)
|
||||||
|
except (ValueError, IndexError):
|
||||||
|
self._log(
|
||||||
|
"[fine step] Error encountered in parsing {} (grepped block {})".format(
|
||||||
|
log_filename, i
|
||||||
|
),
|
||||||
|
"WARNING",
|
||||||
|
)
|
||||||
return series
|
return series
|
||||||
|
|
||||||
def _extract_coarse_step_from_log(self, series, log_filename, run):
|
def _extract_coarse_step_from_log(self, series, log_filename, run):
|
||||||
@@ -374,7 +382,6 @@ class StudyProcessor(Aggregator, HDF5Container):
|
|||||||
np.float(content[j].split(":")[1].split()[0])
|
np.float(content[j].split(":")[1].split()[0])
|
||||||
)
|
)
|
||||||
series["memory"][run].append(content[j + 1].split(":")[1])
|
series["memory"][run].append(content[j + 1].split(":")[1])
|
||||||
|
|
||||||
return series
|
return series
|
||||||
|
|
||||||
def _extract_rms_from_log(self, series, log_filename, run):
|
def _extract_rms_from_log(self, series, log_filename, run):
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ def convert_exp(number, digits=4):
|
|||||||
exp = splitted[1]
|
exp = splitted[1]
|
||||||
exp_str = "10^{" + str(int(exp)) + "}"
|
exp_str = "10^{" + str(int(exp)) + "}"
|
||||||
if float(coeff) == 1.0:
|
if float(coeff) == 1.0:
|
||||||
return exp_str
|
return f"${exp_str}$"
|
||||||
else:
|
else:
|
||||||
return "{}\\times {}".format(coeff, exp_str)
|
return f"${coeff}\\times {exp_str}$"
|
||||||
|
|
||||||
|
|
||||||
def unit_str(unit, base=None, prefix="", format=" [{unit}]"):
|
def unit_str(unit, base=None, prefix="", format=" [{unit}]"):
|
||||||
|
|||||||
Reference in New Issue
Block a user