mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
more work on compare results
This commit is contained in:
1 parent
84486c03ed
commit
e6dd983f97
3 files changed
+40
-67
No files matched your search
@@ -1416,3 +1416,16 @@ class CustomPlot(PamhyrPlot):
|
||||
)
|
||||
labs = list(map(lambda line: self._trad[line], self.lines))
|
||||
self.canvas.axes.legend(lns, labs, loc="best")
|
||||
|
||||
def add_imported_plot(self, data):
|
||||
if (data["type_x"] == self._x and
|
||||
data["type_y"] in self._y):
|
||||
while data["legend"] in self.lines:
|
||||
data["legend"] += '*'
|
||||
self._trad._dict[data["legend"]] = data["legend"] + data["unit"]
|
||||
self.lines[data["legend"]] = self.canvas.axes.plot(data["x"],
|
||||
data["y"],
|
||||
marker="+",
|
||||
linestyle="--")
|
||||
self.update_legend()
|
||||
self.idle()
|
||||
+15
-31
@@ -1243,24 +1243,12 @@ class ResultsWindow(PamhyrWindow):
|
||||
for line in lines:
|
||||
if line[0] != "*" and line[0] != "#" and line[0] != "$":
|
||||
row = line.split(sep)
|
||||
print(row)
|
||||
if len(row) >= 2:
|
||||
try:
|
||||
x.append(float(row[0]))
|
||||
y.append(float(row[1]))
|
||||
except:
|
||||
pass
|
||||
print(x)
|
||||
print(y)
|
||||
|
||||
# with open(filename, 'r', newline='') as f:
|
||||
# reader = csv.reader(f, delimiter=sep, quotechar='|',
|
||||
# quoting=csv.QUOTE_NONNUMERIC)
|
||||
# for row in reader:
|
||||
# print(row)
|
||||
# if len(row) == 2:
|
||||
# x.append(float(row[0]))
|
||||
# y.append(float(row[1]))
|
||||
|
||||
data_type_lst = ['Q(t)', 'Z(t)', 'Z(x)']
|
||||
data_type, ok = QInputDialog.getItem(
|
||||
@@ -1269,8 +1257,7 @@ class ResultsWindow(PamhyrWindow):
|
||||
if not ok:
|
||||
return
|
||||
|
||||
legend, ok = QInputDialog.getText(
|
||||
self, 'Legend','Legend:' )
|
||||
legend, ok = QInputDialog.getText(self, 'Legend', 'Legend:')
|
||||
|
||||
if not ok:
|
||||
return
|
||||
@@ -1286,28 +1273,25 @@ class ResultsWindow(PamhyrWindow):
|
||||
tmp_unit = {'Z': ' (m)',
|
||||
'Q': ' (m³/s)'}
|
||||
|
||||
data = {'type_x': tmp_dict[data_type[2]],
|
||||
'type_y': tmp_dict[data_type[0]],
|
||||
'legend': legend,
|
||||
'unit': tmp_unit[data_type[0]],
|
||||
'x': x,
|
||||
'y': y}
|
||||
|
||||
if data_type == 'Z(x)':
|
||||
line = self.canvas_2.axes.plot(x, y, marker="+",
|
||||
label = legend + ' (m)')
|
||||
label=legend + ' (m)')
|
||||
self.plot_rkc.canvas.draw_idle()
|
||||
self.plot_rkc.update_idle()
|
||||
if data_type == 'Q(t)':
|
||||
line = self.canvas_4.axes.plot(x, y,
|
||||
marker="+",
|
||||
label = legend + ' (m³/s)')
|
||||
line = self.canvas_4.axes.plot(x, y, marker="+",
|
||||
label=legend + ' (m³/s)')
|
||||
self.plot_h._line.append(line)
|
||||
self.plot_h.enable_legend()
|
||||
self.plot_h.canvas.draw_idle()
|
||||
self.plot_h.update_idle
|
||||
|
||||
for p in self._additional_plot:
|
||||
plot = self._additional_plot[p]
|
||||
x_key = p.split(": ")[0]
|
||||
y_key = p.split(": ")[1].split(",")
|
||||
if (tmp_dict[data_type[2]] in x_key and
|
||||
tmp_dict[data_type[0]] in y_key):
|
||||
while legend in plot.lines:
|
||||
legend += '*'
|
||||
plot._trad._dict[legend] = legend + tmp_unit[data_type[0]]
|
||||
plot.lines[legend] = plot.canvas.axes.plot(x, y,
|
||||
marker="+",
|
||||
linestyle="--")
|
||||
plot.update_legend()
|
||||
plot.idle()
|
||||
self._additional_plot[p].add_imported_plot(data)
|
||||
Reference in new issue
Block a user