Results: Compare: Minor change.

scenarios
Pierre-Antoine 2025-10-24 15:02:53 +02:00
parent ee01beb844
commit dc7dfb2414
1 changed files with 17 additions and 16 deletions

View File

@ -32,7 +32,7 @@ from platformdirs import user_cache_dir
from Solver.AdisTS import AdisTS from Solver.AdisTS import AdisTS
from Solver.Mage import Mage8 from Solver.Mage import Mage8
from Solver.RubarBE import Rubar3 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 import QtGui
from PyQt5.QtGui import ( from PyQt5.QtGui import (
@ -1752,12 +1752,13 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
informative_text=self._trad["mb_diff_results_compatibility_msg"] informative_text=self._trad["mb_diff_results_compatibility_msg"]
) )
@timer
def diff_results(self, solver1, solver2): def diff_results(self, solver1, solver2):
if solver1 is None or solver2 is None: if solver1 is None or solver2 is None:
self.msg_diff_results_param() self.msg_diff_results_param()
return None return None
solver3 = GenericSolver(solver1.name + " - " + solver2.name) solver3 = GenericSolver(solver1.name + " <> " + solver2.name)
result1 = solver1.results( result1 = solver1.results(
self._study, self._study,
@ -1773,11 +1774,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
self.msg_diff_results_param() self.msg_diff_results_param()
return None 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() self.msg_diff_results_compatibility()
return None 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() self.msg_diff_results_compatibility()
return None return None
@ -1786,6 +1787,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
result1, result2, result1, result2,
) )
@timer
def _diff_results(self, solver1, solver2, solver3, result1, result2): def _diff_results(self, solver1, solver2, solver3, result1, result2):
result3 = Results(study=self._study, solver=solver3) result3 = Results(study=self._study, solver=solver3)
ts = sorted( ts = sorted(
@ -1808,23 +1810,22 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
reach2 = result2.river.reach(r) reach2 = result2.river.reach(r)
reach3 = result3.river.reach(r) reach3 = result3.river.reach(r)
for p, (profile1, profile2) in enumerate( for profile1, profile2, profile3 in zip(
zip(reach1.profiles, reach1.profiles,
reach2.profiles)): reach2.profiles,
reach3.profiles):
for key in ["Z", "Q", "V"]: for key in ["Z", "Q", "V"]:
d1 = profile1.get_ts_key(timestamp, key) d1 = profile1.get_ts_key(timestamp, key)
d2 = profile2.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)\ limits = profile3.geometry\
.geometry\ .get_water_limits(
.get_water_limits( profile3.get_ts_key(timestamp, "Z")
reach3.profile(p)\ )
.get_ts_key(timestamp, "Z") profile3.set(timestamp, "water_limits", limits)
)
reach3.set(p, timestamp, "water_limits", limits)
return [result1, result2, result3] return [result1, result2, result3]