debug plotH

terraz_dev
Theophile Terraz 2025-01-29 15:50:56 +01:00
parent c8606cf445
commit e3229c8183
3 changed files with 20 additions and 13 deletions

View File

@ -1654,7 +1654,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
# TODO message # TODO message
return None return None
return [result1, result2] # return [result1, result2]
result3 = Results(self._study, solver3) result3 = Results(self._study, solver3)
result3.set("nb_reach", result1.get("nb_reach")) result3.set("nb_reach", result1.get("nb_reach"))
@ -1672,12 +1672,12 @@ 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(zip(reach1.profiles, reach2.profiles)): for p, (profile1, profile2) in enumerate(zip(reach1.profiles, reach2.profiles)):
for key in ["Z", "Q"]: 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)
reach3.set(p, timestamp, key, d1-d2) reach3.set(p, timestamp, key, d1-d2)
return result3 return [result1, result2, result3]
def open_results_adists(self): def open_results_adists(self):
if self._study is None: if self._study is None:

View File

@ -76,7 +76,8 @@ class PlotH(PamhyrPlot):
@timer @timer
def draw(self, highlight=None): def draw(self, highlight=None):
self.init_axes() self.canvas.axes.cla()
self.canvas.axes.grid(color='grey', linestyle='--', linewidth=0.5)
if self.results is None: if self.results is None:
return return
@ -94,14 +95,14 @@ class PlotH(PamhyrPlot):
self.draw_max(reach) self.draw_max(reach)
self.draw_data(reach, profile) self.draw_data(reach, profile)
self.draw_current()
self.set_ticks_time_formater() self.set_ticks_time_formater()
self.enable_legend() self.enable_legend()
self.idle() self.canvas.draw_idle()
self.update_current() self.update_idle
self.draw_current()
self._init = True self._init = True
def draw_data(self, reach, profile): def draw_data(self, reach, profile):
@ -156,7 +157,7 @@ class PlotH(PamhyrPlot):
def set_result(self, res_id): def set_result(self, res_id):
self._current_result_id = res_id self._current_result_id = res_id
self.update() self.draw()
def set_timestamp(self, timestamp): def set_timestamp(self, timestamp):
self._current_timestamp = timestamp self._current_timestamp = timestamp
@ -168,6 +169,7 @@ class PlotH(PamhyrPlot):
self.draw() self.draw()
self.update_data() self.update_data()
self.update_current()
self.update_idle() self.update_idle()
def update_data(self): def update_data(self):
@ -180,13 +182,14 @@ class PlotH(PamhyrPlot):
self._line.set_data(x, y) self._line.set_data(x, y)
self._current.set_data( #self._current.set_data(
[self._current_timestamp, self._current_timestamp], #[self._current_timestamp, self._current_timestamp],
self.canvas.axes.get_ylim() #self.canvas.axes.get_ylim()
) #)
def update_current(self): def update_current(self):
y = self._current.get_ydata()
self._current.set_data( self._current.set_data(
[self._current_timestamp, self._current_timestamp], [self._current_timestamp, self._current_timestamp],
self.canvas.axes.get_ylim() y
) )

View File

@ -124,6 +124,10 @@ class ResultsWindow(PamhyrWindow):
logger_exception(e) logger_exception(e)
return return
self.update(reach_id=0,
profile_id=0,
solver_id=0)
def setup_table(self): def setup_table(self):
self._table = {} self._table = {}
for t in ["reach", "profile", "raw_data", "solver"]: for t in ["reach", "profile", "raw_data", "solver"]: