work on results adis

adists_release
Theophile Terraz 2024-12-04 11:59:02 +01:00
parent b85962bfcd
commit d6f152958f
6 changed files with 192 additions and 94 deletions

View File

@ -53,6 +53,7 @@ class PlotAdis_dt(PamhyrPlot):
self._key = key self._key = key
self.label_x = self._trad["unit_time_s"] self.label_x = self._trad["unit_time_s"]
self._available_values_y = self._trad.get_dict("values_y_pol")
self.label = {} self.label = {}
self.label["C"] = _translate("Results", "Concentration") self.label["C"] = _translate("Results", "Concentration")
@ -64,6 +65,8 @@ class PlotAdis_dt(PamhyrPlot):
self.sed_id["C"] = 0 self.sed_id["C"] = 0
self.sed_id["M"] = 1 self.sed_id["M"] = 1
self.label_y = self._available_values_y["unit_"+self._key]
self._isometric_axis = False self._isometric_axis = False
@property @property

View File

@ -53,6 +53,7 @@ class PlotAdis_dx(PamhyrPlot):
self._key = key self._key = key
self.label_x = self._trad["unit_pk"] self.label_x = self._trad["unit_pk"]
self._available_values_y = self._trad.get_dict("values_y_pol")
self.label = {} self.label = {}
self.label["C"] = _translate("Results", "Concentration") self.label["C"] = _translate("Results", "Concentration")
@ -64,6 +65,8 @@ class PlotAdis_dx(PamhyrPlot):
self.sed_id["C"] = 0 self.sed_id["C"] = 0
self.sed_id["M"] = 1 self.sed_id["M"] = 1
self.label_y = self._available_values_y["unit_"+self._key]
self._isometric_axis = False self._isometric_axis = False
@property @property
@ -259,4 +262,8 @@ class PlotAdis_dx(PamhyrPlot):
self.y_max = np.max(y) self.y_max = np.max(y)
self.y_min = np.min(y) self.y_min = np.min(y)
if self.y_max - self.y_min < 1:
self.y_min = (self.y_max + self.y_min)/2 - 0.5
self.y_max = (self.y_max + self.y_min)/2 + 0.5
self.canvas.axes.set_ylim(self.y_min, self.y_max) self.canvas.axes.set_ylim(self.y_min, self.y_max)

View File

@ -107,7 +107,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
self._hash_data.append(self._results) self._hash_data.append(self._results)
self._additional_plot = {} self._additional_plot = {}
self._pol_id = 0 self._pol_id = 1
self._reach_id = 0 self._reach_id = 0
self._profile_id = 0 self._profile_id = 0
@ -178,95 +178,114 @@ class ResultsWindowAdisTS(PamhyrWindow):
self._timer = QTimer(self) self._timer = QTimer(self)
def setup_plots(self): def setup_plots(self):
self.canvas_dt = MplCanvas(width=5, height=4, dpi=100) self.canvas_cdt = MplCanvas(width=5, height=4, dpi=100)
self.canvas_dt.setObjectName("canvas_dt") self.canvas_cdt.setObjectName("canvas_cdt")
self.toolbar_dt = PamhyrPlotToolbar( self.toolbar_cdt = PamhyrPlotToolbar(
self.canvas_dt, self, items=[ self.canvas_cdt, self, items=[
"home", "move", "zoom", "save", "home", "move", "zoom", "save",
"iso", "back/forward" "iso", "back/forward"
] ]
) )
self.plot_layout_dt = self.find( self.plot_layout_cdt = self.find(
QVBoxLayout, "verticalLayout_concentration_dt") QVBoxLayout, "verticalLayout_concentration_dt")
self.plot_layout_dt.addWidget(self.toolbar_dt) #self.plot_layout_cdt = self.find(
self.plot_layout_dt.addWidget(self.canvas_dt) #QVBoxLayout, "verticalLayout_cdt")
self.plot_layout_cdt.addWidget(self.toolbar_cdt)
self.plot_layout_cdt.addWidget(self.canvas_cdt)
self.plot_c_dt = PlotAdis_dt( self.plot_cdt = PlotAdis_dt(
canvas=self.canvas_dt, canvas=self.canvas_cdt,
results=self._results, results=self._results,
reach_id=self._reach_id, reach_id=self._reach_id,
profile_id=self._profile_id, profile_id=self._profile_id,
pol_id=self._pol_id, pol_id=self._pol_id,
key="C", key="C",
trad=self._trad, trad=self._trad,
toolbar=self.toolbar_dt toolbar=self.toolbar_cdt
) )
self.plot_c_dt.draw() self.plot_cdt.draw()
self.canvas_dx = MplCanvas(width=5, height=4, dpi=100) self.canvas_cdx = MplCanvas(width=5, height=4, dpi=100)
self.canvas_dx.setObjectName("canvas_dx") self.canvas_cdx.setObjectName("canvas_cdx")
self.toolbar_dx = PamhyrPlotToolbar( self.toolbar_cdx = PamhyrPlotToolbar(
self.canvas_dt, self, items=[ self.canvas_cdx, self, items=[
"home", "move", "zoom", "save", "home", "move", "zoom", "save",
"iso", "back/forward" "iso", "back/forward"
] ]
) )
self.plot_layout_dx = self.find( self.plot_layout_cdx = self.find(
QVBoxLayout, "verticalLayout_concentration_dx") QVBoxLayout, "verticalLayout_concentration_dx")
self.plot_layout_dx.addWidget(self.toolbar_dx) #self.plot_layout_cdx = self.find(
self.plot_layout_dx.addWidget(self.canvas_dx) #QVBoxLayout, "verticalLayout_cdx")
self.plot_layout_cdx.addWidget(self.toolbar_cdx)
self.plot_layout_cdx.addWidget(self.canvas_cdx)
self.plot_c_dx = PlotAdis_dx( self.plot_cdx = PlotAdis_dx(
canvas=self.canvas_dx, canvas=self.canvas_cdx,
results=self._results, results=self._results,
reach_id=self._reach_id, reach_id=self._reach_id,
profile_id=self._profile_id, profile_id=self._profile_id,
pol_id=self._pol_id, pol_id=self._pol_id,
key="C", key="C",
trad=self._trad, trad=self._trad,
toolbar=self.toolbar_dx toolbar=self.toolbar_cdx
) )
self.plot_c_dx.draw() self.plot_cdx.draw()
self.canvas_3 = MplCanvas(width=5, height=4, dpi=100) self.canvas_mdx = MplCanvas(width=5, height=4, dpi=100)
self.canvas_3.setObjectName("canvas_3") self.canvas_mdx.setObjectName("canvas_mdx")
self.toolbar_3 = PamhyrPlotToolbar( self.toolbar_mdx = PamhyrPlotToolbar(
self.canvas_3, self, items=[ self.canvas_mdx, self, items=[
"home", "move", "zoom", "save", "home", "move", "zoom", "save",
"iso", "back/forward" "iso", "back/forward"
] ]
) )
self.plot_layout_3 = self.find( self.plot_layout_mdx = self.find(
QVBoxLayout, "verticalLayout_mass") QVBoxLayout, "verticalLayout_mass_dx2")
self.plot_layout_3.addWidget(self.toolbar_3) self.plot_layout_mdx.addWidget(self.toolbar_mdx)
self.plot_layout_3.addWidget(self.canvas_3) self.plot_layout_mdx.addWidget(self.canvas_mdx)
#self.plot_m = PlotM( self.plot_mdx = PlotAdis_dx(
#canvas=self.canvas_3, canvas=self.canvas_mdx,
#results=self._results,
#reach_id=self._reach_id,
#profile_id=self._profile_id,
#pol_id=self._pol_id,
#trad=self._trad,
#toolbar=self.toolbar_3
#)
self.plot_m = PlotAdis_dx(
canvas=self.canvas_3,
results=self._results, results=self._results,
reach_id=self._reach_id, reach_id=self._reach_id,
profile_id=self._profile_id, profile_id=self._profile_id,
pol_id=self._pol_id, pol_id=self._pol_id,
key="M", key="M",
trad=self._trad, trad=self._trad,
toolbar=self.toolbar_3 toolbar=self.toolbar_mdx
) )
self.plot_m.draw() self.plot_mdx.draw()
self.canvas_mdt = MplCanvas(width=5, height=4, dpi=100)
self.canvas_mdt.setObjectName("canvas_mdt")
self.toolbar_mdt = PamhyrPlotToolbar(
self.canvas_mdt, self, items=[
"home", "move", "zoom", "save",
"iso", "back/forward"
]
)
self.plot_layout_mdt = self.find(
QVBoxLayout, "verticalLayout_mass_dt2")
self.plot_layout_mdt.addWidget(self.toolbar_mdt)
self.plot_layout_mdt.addWidget(self.canvas_mdt)
self.plot_mdt = PlotAdis_dt(
canvas=self.canvas_mdt,
results=self._results,
reach_id=self._reach_id,
profile_id=self._profile_id,
pol_id=self._pol_id,
key="M",
trad=self._trad,
toolbar=self.toolbar_mdt
)
self.plot_mdt.draw()
if self._type_pol[self._pol_id] != 7: if self._type_pol[self._pol_id] != 7:
self.find(QTabWidget, "tabWidget").setTabVisible(3, False) self.find(QTabWidget, "tabWidget").setTabVisible(2, False)
self.canvas_2 = MplCanvas(width=5, height=4, dpi=100) self.canvas_2 = MplCanvas(width=5, height=4, dpi=100)
self.canvas_2.setObjectName("canvas_2") self.canvas_2.setObjectName("canvas_2")
@ -511,10 +530,11 @@ class ResultsWindowAdisTS(PamhyrWindow):
def update(self, reach_id=None, profile_id=None, pol_id=None, timestamp=None): def update(self, reach_id=None, profile_id=None, pol_id=None, timestamp=None):
if reach_id is not None: if reach_id is not None:
self.plot_c_dt.set_reach(reach_id) self.plot_cdt.set_reach(reach_id)
self.plot_c_dx.set_reach(reach_id) self.plot_cdx.set_reach(reach_id)
if self._type_pol[self._pol_id] == 7: if self._type_pol[self._pol_id] == 7:
self.plot_m.set_reach(reach_id) self.plot_mdx.set_reach(reach_id)
self.plot_mdt.set_reach(reach_id)
self.plot_tot_c.set_reach(reach_id) self.plot_tot_c.set_reach(reach_id)
self.plot_tot_eg.set_reach(reach_id) self.plot_tot_eg.set_reach(reach_id)
self.plot_tot_em.set_reach(reach_id) self.plot_tot_em.set_reach(reach_id)
@ -525,10 +545,11 @@ class ResultsWindowAdisTS(PamhyrWindow):
self.update_table_selection_pol(0) self.update_table_selection_pol(0)
if profile_id is not None: if profile_id is not None:
self.plot_c_dt.set_profile(profile_id) self.plot_cdt.set_profile(profile_id)
self.plot_c_dx.set_profile(profile_id) self.plot_cdx.set_profile(profile_id)
if self._type_pol[self._pol_id] == 7: if self._type_pol[self._pol_id] == 7:
self.plot_m.set_profile(profile_id) self.plot_mdx.set_profile(profile_id)
self.plot_mdt.set_profile(profile_id)
self.plot_tot_c.set_profile(profile_id) self.plot_tot_c.set_profile(profile_id)
self.plot_tot_eg.set_profile(profile_id) self.plot_tot_eg.set_profile(profile_id)
self.plot_tot_em.set_profile(profile_id) self.plot_tot_em.set_profile(profile_id)
@ -538,21 +559,23 @@ class ResultsWindowAdisTS(PamhyrWindow):
if pol_id is not None: if pol_id is not None:
self._pol_id = pol_id self._pol_id = pol_id
self.plot_c_dt.set_pollutant(self._pol_id) self.plot_cdt.set_pollutant(self._pol_id)
self.plot_c_dx.set_pollutant(self._pol_id) self.plot_cdx.set_pollutant(self._pol_id)
if self._type_pol[self._pol_id] == 7: if self._type_pol[self._pol_id] == 7:
self.find(QTabWidget, "tabWidget").setTabVisible(3, True) self.find(QTabWidget, "tabWidget").setTabVisible(2, True)
self.plot_m.set_pollutant(self._pol_id) self.plot_mdx.set_pollutant(self._pol_id)
self.plot_mdt.set_pollutant(self._pol_id)
else: else:
self.find(QTabWidget, "tabWidget").setTabVisible(3, False) self.find(QTabWidget, "tabWidget").setTabVisible(2, False)
self.update_table_selection_pol(self._pol_id) self.update_table_selection_pol(self._pol_id)
if timestamp is not None: if timestamp is not None:
self.plot_c_dt.set_timestamp(timestamp) self.plot_cdt.set_timestamp(timestamp)
self.plot_c_dx.set_timestamp(timestamp) self.plot_cdx.set_timestamp(timestamp)
if self._type_pol[self._pol_id] == 7: if self._type_pol[self._pol_id] == 7:
self.plot_m.set_timestamp(timestamp) self.plot_mdx.set_timestamp(timestamp)
self.plot_mdt.set_timestamp(timestamp)
#self.plot_tot_c.set_timestamp(timestamp) #self.plot_tot_c.set_timestamp(timestamp)
#self.plot_tot_eg.set_timestamp(timestamp) #self.plot_tot_eg.set_timestamp(timestamp)
#self.plot_tot_em.set_timestamp(timestamp) #self.plot_tot_em.set_timestamp(timestamp)
@ -582,7 +605,6 @@ class ResultsWindowAdisTS(PamhyrWindow):
return return
self.update(profile_id=indexes[0].row()) self.update(profile_id=indexes[0].row())
###self._slider_profile.setValue(ind)
def _set_current_pol(self): def _set_current_pol(self):
table = self.find(QTableView, f"tableView_pollutants") table = self.find(QTableView, f"tableView_pollutants")
@ -602,28 +624,26 @@ class ResultsWindowAdisTS(PamhyrWindow):
self.update(profile_id=ind) self.update(profile_id=ind)
self._slider_profile.setValue(ind) self._slider_profile.setValue(ind)
def _set_current_profile_slider(self):
pid = self._slider_profile.value()
self.update(profile_id=pid)
def _set_current_timestamp(self): def _set_current_timestamp(self):
timestamp = self._timestamps[self._slider_time.value()] timestamp = self._timestamps[self._slider_time.value()]
self.update(timestamp=timestamp) self.update(timestamp=timestamp)
def _reload_plots(self): def _reload_plots(self):
self.plot_c_dt.results = self._results self.plot_cdt.results = self._results
self.plot_c_dx.results = self._results self.plot_cdx.results = self._results
if self._type_pol[self._pol_id] == 7: if self._type_pol[self._pol_id] == 7:
self.plot_m.results = self._results self.plot_mdx.results = self._results
self.plot_mdt.results = self._results
self.plot_tot_c.results = self._results self.plot_tot_c.results = self._results
self.plot_tot_eg.results = self._results self.plot_tot_eg.results = self._results
self.plot_tot_em.results = self._results self.plot_tot_em.results = self._results
self.plot_tot_ed.results = self._results self.plot_tot_ed.results = self._results
self.plot_c_dt.draw() self.plot_cdt.draw()
self.plot_c_dx.draw() self.plot_cdx.draw()
if self._type_pol[self._pol_id] == 7: if self._type_pol[self._pol_id] == 7:
self.plot_m.draw() self.plot_mdx.draw()
self.plot_mdt.draw()
self.plot_tot_c.draw() self.plot_tot_c.draw()
self.plot_tot_eg.draw() self.plot_tot_eg.draw()
self.plot_tot_em.draw() self.plot_tot_em.draw()

View File

@ -125,3 +125,9 @@ class ResultsTranslate(MainTranslate):
"min_depth": self._dict["unit_min_depth"], "min_depth": self._dict["unit_min_depth"],
"max_depth": self._dict["unit_max_depth"], "max_depth": self._dict["unit_max_depth"],
} }
self._sub_dict["values_y_pol"] = {
"unit_C": self._dict["unit_concentration"],
"unit_M": self._dict["unit_mass"],
}

View File

@ -144,6 +144,8 @@ class UnitTranslate(CommonWordTranslate):
"Unit", "Hydraulic Radius (m)" "Unit", "Hydraulic Radius (m)"
) )
self._dict["unit_froude"] = _translate("Unit", "Froude number") self._dict["unit_froude"] = _translate("Unit", "Froude number")
self._dict["unit_mass"] = _translate("Unit", "Mass (kg)")
self._dict["unit_concentration"] = _translate("Unit", "Concentration (kg/m^3)")
class MainTranslate(UnitTranslate): class MainTranslate(UnitTranslate):

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1097</width> <width>1410</width>
<height>720</height> <height>821</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -129,8 +129,11 @@
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="enabled">
<bool>true</bool>
</property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>3</number>
</property> </property>
<widget class="QWidget" name="tab_4"> <widget class="QWidget" name="tab_4">
<attribute name="title"> <attribute name="title">
@ -149,39 +152,96 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="Concentration_dt"> <widget class="QWidget" name="Concentration">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<attribute name="title"> <attribute name="title">
<string>Concentration dt</string> <string>Concentration</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_4"> <layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_concentration_dt"/> <layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QTabWidget" name="tabWidget_c">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_cdx">
<attribute name="title">
<string>Concentration dx</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_17">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_concentration_dx"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_cdt">
<attribute name="title">
<string>Concentration dt</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_18">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_concentration_dt"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="Concentration_dx"> <widget class="QWidget" name="Mass">
<attribute name="title"> <property name="enabled">
<string>Concentration dx</string> <bool>true</bool>
</attribute> </property>
<layout class="QGridLayout" name="gridLayout_11">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_concentration_dx"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title"> <attribute name="title">
<string>Mass</string> <string>Mass</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout_13">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_mass"/> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget_m">
<property name="enabled">
<bool>true</bool>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="mdx">
<attribute name="title">
<string>Mass dx</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_15">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_mass_dx2"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="mdt">
<attribute name="title">
<string>Mass dt</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_14">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_mass_dt2"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Page</string>
</attribute>
</widget>
<widget class="QWidget" name="tab_5"> <widget class="QWidget" name="tab_5">
<attribute name="title"> <attribute name="title">
<string>Total Sediments</string> <string>Total Sediments</string>
@ -190,9 +250,9 @@
<item row="0" column="0"> <item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_tot"> <layout class="QVBoxLayout" name="verticalLayout_tot">
<item> <item>
<widget class="QTabWidget" name="tabWidget_2"> <widget class="QTabWidget" name="tabWidget_tot">
<property name="currentIndex"> <property name="currentIndex">
<number>3</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
@ -253,7 +313,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1097</width> <width>1410</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>