mirror of https://gitlab.com/pamhyr/pamhyr2
pep8 + colors + debug
parent
c668dddcfd
commit
54fe032791
|
|
@ -1508,9 +1508,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
return
|
return
|
||||||
|
|
||||||
if self._last_solver._type == "mage8":
|
if self._last_solver._type == "mage8":
|
||||||
self.open_solver_results(self._last_solver, self._last_results)
|
self.open_solver_results(self._last_solver,
|
||||||
|
self._last_results)
|
||||||
elif self._last_solver._type == "adistswc":
|
elif self._last_solver._type == "adistswc":
|
||||||
self.open_solver_results_adists(self._last_solver, self._last_results)
|
self.open_solver_results_adists(self._last_solver,
|
||||||
|
self._last_results)
|
||||||
|
|
||||||
def open_results_from_file(self):
|
def open_results_from_file(self):
|
||||||
if self._study is None:
|
if self._study is None:
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,7 @@ class PlotAdis(PamhyrPlot):
|
||||||
self._current_reach_id = reach_id
|
self._current_reach_id = reach_id
|
||||||
self._current_profile_id = 0
|
self._current_profile_id = 0
|
||||||
self.draw()
|
self.draw()
|
||||||
|
self.update_current()
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
if not self._init:
|
if not self._init:
|
||||||
|
|
@ -160,14 +161,15 @@ class PlotAdis(PamhyrPlot):
|
||||||
self._current.set_visible(True)
|
self._current.set_visible(True)
|
||||||
|
|
||||||
def set_pollutant(self, pol_id):
|
def set_pollutant(self, pol_id):
|
||||||
for l in self._lines:
|
for j in self._lines:
|
||||||
l.remove()
|
j.remove()
|
||||||
self._lines = []
|
self._lines = []
|
||||||
self._current_pol_id = pol_id
|
self._current_pol_id = pol_id
|
||||||
self.update_min_and_max()
|
self.update_min_and_max()
|
||||||
self.draw_data()
|
self.draw_data()
|
||||||
self.update_current()
|
self.update_current()
|
||||||
self.update_idle()
|
self.update_idle()
|
||||||
|
|
||||||
|
|
||||||
class PlotAdis_dx(PlotAdis):
|
class PlotAdis_dx(PlotAdis):
|
||||||
def __init__(self, canvas=None, trad=None, toolbar=None,
|
def __init__(self, canvas=None, trad=None, toolbar=None,
|
||||||
|
|
@ -191,6 +193,7 @@ class PlotAdis_dx(PlotAdis):
|
||||||
profile = reach.profile(self._current_profile_id)
|
profile = reach.profile(self._current_profile_id)
|
||||||
x = reach.geometry.get_rk()
|
x = reach.geometry.get_rk()
|
||||||
|
|
||||||
|
self._lines = []
|
||||||
for i in range(len(self._current_pol_id)):
|
for i in range(len(self._current_pol_id)):
|
||||||
pol_id = self._current_pol_id[i]
|
pol_id = self._current_pol_id[i]
|
||||||
name = self.data.pollutants_list[pol_id]
|
name = self.data.pollutants_list[pol_id]
|
||||||
|
|
@ -198,14 +201,14 @@ class PlotAdis_dx(PlotAdis):
|
||||||
y = [0.0]*len(x)
|
y = [0.0]*len(x)
|
||||||
else:
|
else:
|
||||||
y = list(map(lambda p:
|
y = list(map(lambda p:
|
||||||
p.get_ts_key(
|
p.get_ts_key(
|
||||||
self._current_timestamp, "pols"
|
self._current_timestamp, "pols"
|
||||||
)[pol_id][self.val_id[self._key]],
|
)[pol_id][self.val_id[self._key]],
|
||||||
reach.profiles))
|
reach.profiles))
|
||||||
self._lines.append(self.canvas.axes.plot(
|
self._lines.append(self.canvas.axes.plot(
|
||||||
x, y,
|
x, y,
|
||||||
label=self.label[self._key]+" "+name,
|
label=self.label[self._key]+" "+name,
|
||||||
color=self.color_plot,
|
color=self.colors[pol_id % len(self.colors)],
|
||||||
**self.plot_default_kargs
|
**self.plot_default_kargs
|
||||||
)[0])
|
)[0])
|
||||||
|
|
||||||
|
|
@ -220,7 +223,7 @@ class PlotAdis_dx(PlotAdis):
|
||||||
for i in range(len(self._current_pol_id)):
|
for i in range(len(self._current_pol_id)):
|
||||||
pol_id = self._current_pol_id[i]
|
pol_id = self._current_pol_id[i]
|
||||||
if self.val_id[self._key] > 0 and self._type_pol[pol_id] == 1:
|
if self.val_id[self._key] > 0 and self._type_pol[pol_id] == 1:
|
||||||
y = [0.0]*len(x)
|
continue # no mass
|
||||||
else:
|
else:
|
||||||
y = list(map(
|
y = list(map(
|
||||||
lambda p: p.get_ts_key(
|
lambda p: p.get_ts_key(
|
||||||
|
|
@ -313,6 +316,7 @@ class PlotAdis_dt(PlotAdis):
|
||||||
self.ts = list(self.results.get("timestamps"))
|
self.ts = list(self.results.get("timestamps"))
|
||||||
self.ts.sort()
|
self.ts.sort()
|
||||||
|
|
||||||
|
self._lines = []
|
||||||
x = self.ts
|
x = self.ts
|
||||||
for i in range(len(self._current_pol_id)):
|
for i in range(len(self._current_pol_id)):
|
||||||
pol_id = self._current_pol_id[i]
|
pol_id = self._current_pol_id[i]
|
||||||
|
|
@ -322,14 +326,14 @@ class PlotAdis_dt(PlotAdis):
|
||||||
else:
|
else:
|
||||||
val_id = self.val_id[self._key]
|
val_id = self.val_id[self._key]
|
||||||
y = list(map(lambda data_el:
|
y = list(map(lambda data_el:
|
||||||
data_el[pol_id][val_id],
|
data_el[pol_id][val_id],
|
||||||
profile.get_key("pols")
|
profile.get_key("pols")
|
||||||
))
|
))
|
||||||
|
|
||||||
self._lines.append(self.canvas.axes.plot(
|
self._lines.append(self.canvas.axes.plot(
|
||||||
x, y,
|
x, y,
|
||||||
label=self.label[self._key]+" "+name,
|
label=self.label[self._key]+" "+name,
|
||||||
color=self.color_plot,
|
color=self.colors[pol_id % len(self.colors)],
|
||||||
**self.plot_default_kargs
|
**self.plot_default_kargs
|
||||||
)[0])
|
)[0])
|
||||||
|
|
||||||
|
|
@ -344,12 +348,12 @@ class PlotAdis_dt(PlotAdis):
|
||||||
for i in range(len(self._current_pol_id)):
|
for i in range(len(self._current_pol_id)):
|
||||||
pol_id = self._current_pol_id[i]
|
pol_id = self._current_pol_id[i]
|
||||||
if self.val_id[self._key] > 0 and self._type_pol[pol_id] == 1:
|
if self.val_id[self._key] > 0 and self._type_pol[pol_id] == 1:
|
||||||
y = [0.0]*len(x)
|
continue # no mass
|
||||||
else:
|
else:
|
||||||
y = list(map(lambda data_el:
|
y = list(map(lambda data_el:
|
||||||
data_el[pol_id][self.val_id[self._key]],
|
data_el[pol_id][self.val_id[self._key]],
|
||||||
profile.get_key("pols")
|
profile.get_key("pols")
|
||||||
))
|
))
|
||||||
|
|
||||||
self._lines[i].set_data(x, y)
|
self._lines[i].set_data(x, y)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,7 @@ from PyQt5.QtWidgets import (
|
||||||
from View.Tools.Plot.PamhyrCanvas import MplCanvas
|
from View.Tools.Plot.PamhyrCanvas import MplCanvas
|
||||||
from View.Tools.Plot.PamhyrToolbar import PamhyrPlotToolbar
|
from View.Tools.Plot.PamhyrToolbar import PamhyrPlotToolbar
|
||||||
|
|
||||||
#from View.Results.PlotSedAdisDt import PlotAdis_dt
|
from View.Results.PlotSedAdis import PlotAdis_dx, PlotAdis_dt
|
||||||
from View.Results.PlotSedAdisDx import PlotAdis_dx, PlotAdis_dt
|
|
||||||
|
|
||||||
from View.Results.CustomPlot.Plot import CustomPlot
|
from View.Results.CustomPlot.Plot import CustomPlot
|
||||||
from View.Results.CustomPlot.CustomPlotValuesSelectionDialog import (
|
from View.Results.CustomPlot.CustomPlotValuesSelectionDialog import (
|
||||||
|
|
@ -463,7 +462,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
|
||||||
for t in ["pollutants"]:
|
for t in ["pollutants"]:
|
||||||
table = self.find(QTableView, f"tableView_{t}")
|
table = self.find(QTableView, f"tableView_{t}")
|
||||||
selectionModel = table.selectionModel()
|
selectionModel = table.selectionModel()
|
||||||
index = table.model().index(ind[0]- 1, 0)
|
index = table.model().index(ind[0] - 1, 0)
|
||||||
|
|
||||||
selectionModel.select(
|
selectionModel.select(
|
||||||
index,
|
index,
|
||||||
|
|
@ -497,13 +496,12 @@ class ResultsWindowAdisTS(PamhyrWindow):
|
||||||
self.update_table_selection_profile(profile_id)
|
self.update_table_selection_profile(profile_id)
|
||||||
|
|
||||||
if pol_id is not None:
|
if pol_id is not None:
|
||||||
self._pol_id = [p+1 for p in pol_id] # remove total_sediment
|
self._pol_id = [p+1 for p in pol_id] # remove total_sediment
|
||||||
self.plot_cdt.set_pollutant(self._pol_id)
|
self.plot_cdt.set_pollutant(self._pol_id)
|
||||||
self.plot_cdx.set_pollutant(self._pol_id)
|
self.plot_cdx.set_pollutant(self._pol_id)
|
||||||
self.plot_mdx.set_pollutant(self._pol_id)
|
self.plot_mdx.set_pollutant(self._pol_id)
|
||||||
self.plot_mdt.set_pollutant(self._pol_id)
|
self.plot_mdt.set_pollutant(self._pol_id)
|
||||||
|
|
||||||
|
|
||||||
if timestamp is not None:
|
if timestamp is not None:
|
||||||
self.plot_cdt.set_timestamp(timestamp)
|
self.plot_cdt.set_timestamp(timestamp)
|
||||||
self.plot_cdx.set_timestamp(timestamp)
|
self.plot_cdx.set_timestamp(timestamp)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue