diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py index 02ae86b9..aa910ae6 100644 --- a/src/View/MainWindow.py +++ b/src/View/MainWindow.py @@ -1508,9 +1508,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): return 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": - 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): if self._study is None: diff --git a/src/View/Results/PlotSedAdis.py b/src/View/Results/PlotSedAdis.py index 6431b6ca..14fdab54 100644 --- a/src/View/Results/PlotSedAdis.py +++ b/src/View/Results/PlotSedAdis.py @@ -144,6 +144,7 @@ class PlotAdis(PamhyrPlot): self._current_reach_id = reach_id self._current_profile_id = 0 self.draw() + self.update_current() def update(self): if not self._init: @@ -160,14 +161,15 @@ class PlotAdis(PamhyrPlot): self._current.set_visible(True) def set_pollutant(self, pol_id): - for l in self._lines: - l.remove() - self._lines = [] - self._current_pol_id = pol_id - self.update_min_and_max() - self.draw_data() - self.update_current() - self.update_idle() + for j in self._lines: + j.remove() + self._lines = [] + self._current_pol_id = pol_id + self.update_min_and_max() + self.draw_data() + self.update_current() + self.update_idle() + class PlotAdis_dx(PlotAdis): def __init__(self, canvas=None, trad=None, toolbar=None, @@ -191,6 +193,7 @@ class PlotAdis_dx(PlotAdis): profile = reach.profile(self._current_profile_id) x = reach.geometry.get_rk() + self._lines = [] for i in range(len(self._current_pol_id)): pol_id = self._current_pol_id[i] name = self.data.pollutants_list[pol_id] @@ -198,14 +201,14 @@ class PlotAdis_dx(PlotAdis): y = [0.0]*len(x) else: y = list(map(lambda p: - p.get_ts_key( - self._current_timestamp, "pols" - )[pol_id][self.val_id[self._key]], - reach.profiles)) + p.get_ts_key( + self._current_timestamp, "pols" + )[pol_id][self.val_id[self._key]], + reach.profiles)) self._lines.append(self.canvas.axes.plot( x, y, label=self.label[self._key]+" "+name, - color=self.color_plot, + color=self.colors[pol_id % len(self.colors)], **self.plot_default_kargs )[0]) @@ -220,7 +223,7 @@ class PlotAdis_dx(PlotAdis): for i in range(len(self._current_pol_id)): pol_id = self._current_pol_id[i] if self.val_id[self._key] > 0 and self._type_pol[pol_id] == 1: - y = [0.0]*len(x) + continue # no mass else: y = list(map( lambda p: p.get_ts_key( @@ -313,6 +316,7 @@ class PlotAdis_dt(PlotAdis): self.ts = list(self.results.get("timestamps")) self.ts.sort() + self._lines = [] x = self.ts for i in range(len(self._current_pol_id)): pol_id = self._current_pol_id[i] @@ -322,14 +326,14 @@ class PlotAdis_dt(PlotAdis): else: val_id = self.val_id[self._key] y = list(map(lambda data_el: - data_el[pol_id][val_id], - profile.get_key("pols") - )) + data_el[pol_id][val_id], + profile.get_key("pols") + )) self._lines.append(self.canvas.axes.plot( x, y, label=self.label[self._key]+" "+name, - color=self.color_plot, + color=self.colors[pol_id % len(self.colors)], **self.plot_default_kargs )[0]) @@ -344,12 +348,12 @@ class PlotAdis_dt(PlotAdis): for i in range(len(self._current_pol_id)): pol_id = self._current_pol_id[i] if self.val_id[self._key] > 0 and self._type_pol[pol_id] == 1: - y = [0.0]*len(x) + continue # no mass else: y = list(map(lambda data_el: - data_el[pol_id][self.val_id[self._key]], - profile.get_key("pols") - )) + data_el[pol_id][self.val_id[self._key]], + profile.get_key("pols") + )) self._lines[i].set_data(x, y) diff --git a/src/View/Results/WindowAdisTS.py b/src/View/Results/WindowAdisTS.py index 9a11d3c5..d11cf8d9 100644 --- a/src/View/Results/WindowAdisTS.py +++ b/src/View/Results/WindowAdisTS.py @@ -46,8 +46,7 @@ from PyQt5.QtWidgets import ( from View.Tools.Plot.PamhyrCanvas import MplCanvas from View.Tools.Plot.PamhyrToolbar import PamhyrPlotToolbar -#from View.Results.PlotSedAdisDt import PlotAdis_dt -from View.Results.PlotSedAdisDx import PlotAdis_dx, PlotAdis_dt +from View.Results.PlotSedAdis import PlotAdis_dx, PlotAdis_dt from View.Results.CustomPlot.Plot import CustomPlot from View.Results.CustomPlot.CustomPlotValuesSelectionDialog import ( @@ -463,7 +462,7 @@ class ResultsWindowAdisTS(PamhyrWindow): for t in ["pollutants"]: table = self.find(QTableView, f"tableView_{t}") selectionModel = table.selectionModel() - index = table.model().index(ind[0]- 1, 0) + index = table.model().index(ind[0] - 1, 0) selectionModel.select( index, @@ -497,13 +496,12 @@ class ResultsWindowAdisTS(PamhyrWindow): self.update_table_selection_profile(profile_id) 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_cdx.set_pollutant(self._pol_id) self.plot_mdx.set_pollutant(self._pol_id) self.plot_mdt.set_pollutant(self._pol_id) - if timestamp is not None: self.plot_cdt.set_timestamp(timestamp) self.plot_cdx.set_timestamp(timestamp)