From dc7dfb2414a36f51f5c194e8a58f37add0c7eb40 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby Date: Fri, 24 Oct 2025 15:02:53 +0200 Subject: [PATCH] Results: Compare: Minor change. --- src/View/MainWindow.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py index 57b8fe48..f60d2ca1 100644 --- a/src/View/MainWindow.py +++ b/src/View/MainWindow.py @@ -32,7 +32,7 @@ from platformdirs import user_cache_dir from Solver.AdisTS import AdisTS from Solver.Mage import Mage8 from Solver.RubarBE import Rubar3 -from tools import logger_exception, pamhyr_db_need_update +from tools import logger_exception, pamhyr_db_need_update, timer from PyQt5 import QtGui from PyQt5.QtGui import ( @@ -1752,12 +1752,13 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): informative_text=self._trad["mb_diff_results_compatibility_msg"] ) + @timer def diff_results(self, solver1, solver2): if solver1 is None or solver2 is None: self.msg_diff_results_param() return None - solver3 = GenericSolver(solver1.name + " - " + solver2.name) + solver3 = GenericSolver(solver1.name + " <> " + solver2.name) result1 = solver1.results( self._study, @@ -1773,11 +1774,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): self.msg_diff_results_param() return None - if result2.get("nb_reach") != result1.get("nb_reach"): + if result1.get("nb_reach") != result2.get("nb_reach"): self.msg_diff_results_compatibility() return None - if result2.get("nb_profile") != result1.get("nb_profile"): + if result1.get("nb_profile") != result2.get("nb_profile"): self.msg_diff_results_compatibility() return None @@ -1786,6 +1787,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): result1, result2, ) + @timer def _diff_results(self, solver1, solver2, solver3, result1, result2): result3 = Results(study=self._study, solver=solver3) ts = sorted( @@ -1808,23 +1810,22 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): reach2 = result2.river.reach(r) reach3 = result3.river.reach(r) - for p, (profile1, profile2) in enumerate( - zip(reach1.profiles, - reach2.profiles)): + for profile1, profile2, profile3 in zip( + reach1.profiles, + reach2.profiles, + reach3.profiles): for key in ["Z", "Q", "V"]: d1 = profile1.get_ts_key(timestamp, key) d2 = profile2.get_ts_key(timestamp, key) - d = d1-d2 + d = d1 - d2 - reach3.set(p, timestamp, key, d) + profile3.set(timestamp, key, d) - limits = reach3.profile(p)\ - .geometry\ - .get_water_limits( - reach3.profile(p)\ - .get_ts_key(timestamp, "Z") - ) - reach3.set(p, timestamp, "water_limits", limits) + limits = profile3.geometry\ + .get_water_limits( + profile3.get_ts_key(timestamp, "Z") + ) + profile3.set(timestamp, "water_limits", limits) return [result1, result2, result3]