work on plot multiple lines

adists_release
Theophile Terraz 2024-12-17 16:22:07 +01:00
parent 4315fb94f3
commit bdc975f280
4 changed files with 194 additions and 182 deletions

View File

@ -815,8 +815,6 @@ class AdisTSwc(AdisTS):
# print("isma") # print("isma")
# ##print("iprofiles: ", iprofiles) # ##print("iprofiles: ", iprofiles)
print("reading bin files is ok =======")
for r, reach in enumerate(reachs): for r, reach in enumerate(reachs):
for i in range(is1[r]-1, is2[r]): for i in range(is1[r]-1, is2[r]):
p_i = ip_to_ri(reach, i) p_i = ip_to_ri(reach, i)
@ -831,24 +829,7 @@ class AdisTSwc(AdisTS):
reach.set(p_i, t_data, "pols", pol_view) reach.set(p_i, t_data, "pols", pol_view)
# ##print("pi_tmp: ", pi_tmp)
# ##print("pol view: ", pol_view)
# ##print("reach from i: ", reach_tmp)
# print("pol view: ", pol_view)
# print("results: ", results)
print("'''''''reading bin files is ok =======")
results.set("timestamps", set(timestamps_keys)) results.set("timestamps", set(timestamps_keys))
# print("set timestamps results meta data: ", set(timestamps_keys))
# ##print("debug profiles for draw:")
# ##print("------------------------")
# ##print(data_tmp["AAA-silt"][0.0]["C"][0])
# ##print(data_tmp["AAA-silt"][600.0]["C"][0])
# ##print(data_tmp["AAA-silt"][1205.7208829578194]["C"][0])
# ##print("========================")
print("****reading bin files is ok =======")
@timer @timer
def results(self, study, repertory, qlog=None, name=None): def results(self, study, repertory, qlog=None, name=None):

View File

@ -37,7 +37,7 @@ logger = logging.getLogger()
class PlotAdis_dt(PamhyrPlot): class PlotAdis_dt(PamhyrPlot):
def __init__(self, canvas=None, trad=None, toolbar=None, def __init__(self, canvas=None, trad=None, toolbar=None,
results=None, reach_id=0, profile_id=0, results=None, reach_id=0, profile_id=0,
pol_id=0, key="C", type_pol=7, parent=None): pol_id=[0], key="C", type_pol=[7], parent=None):
super(PlotAdis_dt, self).__init__( super(PlotAdis_dt, self).__init__(
canvas=canvas, canvas=canvas,
trad=trad, trad=trad,
@ -57,18 +57,27 @@ class PlotAdis_dt(PamhyrPlot):
self._available_values_y = self._trad.get_dict("values_y_pol") self._available_values_y = self._trad.get_dict("values_y_pol")
self.label = {} self.label = {}
self.label["C"] = _translate("Results", "Concentration")
self.label["M"] = _translate("Results", "Mass")
self.label_max = {} self.label_max = {}
self.label_min = {}
self.label["C"] = _translate("Results", "Concentration")
self.label_max["C"] = _translate("Results", "Max Concentration") self.label_max["C"] = _translate("Results", "Max Concentration")
self.label_max["M"] = _translate("Results", "Max Mass") if self._type_pol[pol_id[0]] == -1: # Total
self.label["M"] = _translate("Results", "Thickness")
self.label_max["M"] = _translate("Results", "Max Thickness")
self.label_min["M"] = _translate("Results", "Min Thickness")
self.label_y = self._available_values_y["unit_thickness"]
else:
self.label["M"] = _translate("Results", "Mass")
self.label_max["M"] = _translate("Results", "Max Mass")
self.label_min["M"] = _translate("Results", "Min Mass")
self.label_y = self._available_values_y["unit_"+self._key]
self.val_id = {} self.val_id = {}
self.val_id["C"] = 0 self.val_id["C"] = 0
self.val_id["G"] = 1 self.val_id["G"] = 1
self.val_id["M"] = 2 self.val_id["M"] = 2
self.val_id["D"] = 3 self.val_id["D"] = 3
self.label_y = self._available_values_y["unit_"+self._key] self._lines = [None]*len(self._current_pol_id)
self._isometric_axis = False self._isometric_axis = False
@ -112,21 +121,23 @@ class PlotAdis_dt(PamhyrPlot):
self.ts.sort() self.ts.sort()
x = self.ts x = self.ts
if self.val_id[self._key] > 0 and self._type_pol == 1: for i in range(len(self._current_pol_id)):
y = [0.0]*len(x) pol_id = self._current_pol_id[i]
else: if self.val_id[self._key] > 0 and self._type_pol[pol_id] == 1:
val_id = self.val_id[self._key] y = [0.0]*len(x)
y = list(map(lambda data_el: else:
data_el[self._current_pol_id][val_id], val_id = self.val_id[self._key]
profile.get_key("pols") y = list(map(lambda data_el:
)) data_el[pol_id][val_id],
profile.get_key("pols")
))
self._line, = self.canvas.axes.plot( self._lines[i], = self.canvas.axes.plot(
x, y, x, y,
label=self.label[self._key], label=self.label[self._key],
color=self.color_plot, color=self.color_plot,
**self.plot_default_kargs **self.plot_default_kargs
) )
def draw_current(self): def draw_current(self):
self._current, = self.canvas.axes.plot( self._current, = self.canvas.axes.plot(
@ -151,7 +162,7 @@ class PlotAdis_dt(PamhyrPlot):
ts_y = list(map(lambda p: ts_y = list(map(lambda p:
p.get_ts_key( p.get_ts_key(
ts, "pols" ts, "pols"
)[self._current_pol_id][val_id], )[self._current_pol_id[0]][val_id],
reach.profiles)) reach.profiles))
y.append(np.max(ts_y)) y.append(np.max(ts_y))
@ -201,7 +212,7 @@ class PlotAdis_dt(PamhyrPlot):
ts_y = list(map(lambda p: ts_y = list(map(lambda p:
p.get_ts_key( p.get_ts_key(
ts, "pols" ts, "pols"
)[self._current_pol_id][val_id], )[self._current_pol_id[0]][val_id],
reach.profiles)) reach.profiles))
y.append(np.max(ts_y)) y.append(np.max(ts_y))
@ -212,15 +223,17 @@ class PlotAdis_dt(PamhyrPlot):
profile = reach.profile(self._current_profile_id) profile = reach.profile(self._current_profile_id)
x = self.ts x = self.ts
if self.val_id[self._key] > 0 and self._type_pol == 1: for i in range(len(self._current_pol_id)):
y = [0.0]*len(x) pol_id = self._current_pol_id[i]
else: if self.val_id[self._key] > 0 and self._type_pol[pol_id] == 1:
y = list(map(lambda data_el: y = [0.0]*len(x)
data_el[self._current_pol_id][self.val_id[self._key]], else:
profile.get_key("pols") y = list(map(lambda data_el:
)) data_el[pol_id][self.val_id[self._key]],
profile.get_key("pols")
))
self._line.set_data(x, y) self._lines[i].set_data(x, y)
self._current.set_data( self._current.set_data(
[self._current_timestamp, self._current_timestamp], [self._current_timestamp, self._current_timestamp],
@ -244,9 +257,14 @@ class PlotAdis_dt(PamhyrPlot):
def show_current(self): def show_current(self):
self._current.set_visible(True) self._current.set_visible(True)
def set_pollutant(self, pol_id, type_pol): def set_pollutant(self, pol_id):
if pol_id != self._current_pol_id: if len(pol_id) == len(self._current_pol_id):
self._type_pol = type_pol
self._current_pol_id = pol_id self._current_pol_id = pol_id
self.update() self.update()
self.update_current() self.update_current()
else:
self._current_pol_id = pol_id
self._lines = [None]*len(self._current_pol_id)
self.draw()
self.update_current()

View File

@ -21,6 +21,7 @@ import numpy as np
from functools import reduce from functools import reduce
from datetime import datetime from datetime import datetime
from math import inf
from tools import timer, trace from tools import timer, trace
from View.Tools.PamhyrPlot import PamhyrPlot from View.Tools.PamhyrPlot import PamhyrPlot
@ -37,7 +38,7 @@ logger = logging.getLogger()
class PlotAdis_dx(PamhyrPlot): class PlotAdis_dx(PamhyrPlot):
def __init__(self, canvas=None, trad=None, toolbar=None, def __init__(self, canvas=None, trad=None, toolbar=None,
results=None, reach_id=0, profile_id=0, results=None, reach_id=0, profile_id=0,
pol_id=0, key="C", type_pol=7, parent=None): pol_id=[0], key="C", type_pol=[7], parent=None):
super(PlotAdis_dx, self).__init__( super(PlotAdis_dx, self).__init__(
canvas=canvas, canvas=canvas,
trad=trad, trad=trad,
@ -62,7 +63,7 @@ class PlotAdis_dx(PamhyrPlot):
self.label["C"] = _translate("Results", "Concentration") self.label["C"] = _translate("Results", "Concentration")
self.label_max["C"] = _translate("Results", "Max Concentration") self.label_max["C"] = _translate("Results", "Max Concentration")
self.label_min["C"] = _translate("Results", "Min Concentration") self.label_min["C"] = _translate("Results", "Min Concentration")
if self._type_pol == -1: # Total if self._type_pol[pol_id[0]] == -1: # Total
self.label["M"] = _translate("Results", "Thickness") self.label["M"] = _translate("Results", "Thickness")
self.label_max["M"] = _translate("Results", "Max Thickness") self.label_max["M"] = _translate("Results", "Max Thickness")
self.label_min["M"] = _translate("Results", "Min Thickness") self.label_min["M"] = _translate("Results", "Min Thickness")
@ -78,6 +79,8 @@ class PlotAdis_dx(PamhyrPlot):
self.val_id["M"] = 2 self.val_id["M"] = 2
self.val_id["D"] = 3 self.val_id["D"] = 3
self._lines = []
self._isometric_axis = False self._isometric_axis = False
@property @property
@ -104,14 +107,14 @@ class PlotAdis_dx(PamhyrPlot):
return return
self.draw_min_and_max(reach) self.draw_min_and_max(reach)
self.draw_data(reach, profile) self.draw_data(reach)
self.draw_current(reach)
self.draw_profiles_hs(reach) self.draw_profiles_hs(reach)
self.draw_current(reach)
self.enable_legend() self.enable_legend()
self.idle() self.idle()
self.update_current() #self.update_current()
self._init = True self._init = True
def draw_profiles_hs(self, reach): def draw_profiles_hs(self, reach):
@ -145,56 +148,72 @@ class PlotAdis_dx(PamhyrPlot):
fontsize=9, color=self.color_plot_previous, fontsize=9, color=self.color_plot_previous,
) )
def draw_data(self, reach, profile): def draw_data(self, reach):
profile = reach.profile(self._current_profile_id) profile = reach.profile(self._current_profile_id)
x = reach.geometry.get_rk() x = reach.geometry.get_rk()
if self.val_id[self._key] > 0 and self._type_pol == 1: for i in range(len(self._current_pol_id)):
y = [0.0]*len(x) pol_id = self._current_pol_id[i]
else: if self.val_id[self._key] > 0 and self._type_pol[pol_id] == 1:
y = list(map(lambda p: y = [0.0]*len(x)
p.get_ts_key( else:
self._current_timestamp, "pols" y = list(map(lambda p:
)[self._current_pol_id][self.val_id[self._key]], p.get_ts_key(
reach.profiles)) self._current_timestamp, "pols"
)[pol_id][self.val_id[self._key]],
self._line, = self.canvas.axes.plot( reach.profiles))
x, y, self._lines.append(self.canvas.axes.plot(
label=self.label[self._key], x, y,
color=self.color_plot, label=self.label[self._key],
**self.plot_default_kargs color=self.color_plot,
) **self.plot_default_kargs
)[0])
self.set_y_lim() #self.set_y_lim()
def draw_current(self, reach): def draw_current(self, reach):
rk = reach.geometry.get_rk()
rk = reach.geometry.get_rk()
self._current, = self.canvas.axes.plot( self._current, = self.canvas.axes.plot(
[rk[self._current_profile_id], rk[self._current_profile_id]], [rk[self._current_profile_id], rk[self._current_profile_id]],
[self.y_max, self.y_min], self.canvas.axes.get_ylim(),
#[self.y_max, self.y_min],
color="grey", color="grey",
linestyle="dashed", linestyle="dashed",
lw=1. lw=1.,
)
def update_current(self):
self.hide_current()
self.canvas.axes.relim(visible_only=True)
self.canvas.axes.autoscale_view()
self.show_current()
reach = self.results.river.reach(self._current_reach_id)
rk = reach.geometry.get_rk()
self._current.set_data(
[rk[self._current_profile_id], rk[self._current_profile_id]],
self.canvas.axes.get_ylim()
) )
def draw_min_and_max(self, reach): def draw_min_and_max(self, reach):
profile = reach.profile(self._current_profile_id) profile = reach.profile(self._current_profile_id)
x = reach.geometry.get_rk() x = reach.geometry.get_rk()
if self.val_id[self._key] > 0 and self._type_pol == 1: y = [-inf]*reach.geometry.number_profiles
y = [0.0]*len(x) z = [inf]*reach.geometry.number_profiles
else: for pol_id in self._current_pol_id:
y = [] if self.val_id[self._key] > 0 and self._type_pol[pol_id] == 1:
z = [] for i in range(reach.geometry.number_profiles):
val_id = self.val_id[self._key] y[i] = max(0.0, y[i])
for p in reach.profiles: z[i] = min(0.0, z[i])
rk_y = list(map(lambda data_el: else:
data_el[self._current_pol_id][val_id], val_id = self.val_id[self._key]
p.get_key("pols") for i, p in enumerate(reach.profiles):
)) rk_y = list(map(lambda data_el:
y.append(np.max(rk_y)) data_el[pol_id][val_id],
z.append(np.min(rk_y)) p.get_key("pols")
))
y[i] = max(np.max(rk_y), y[i])
z[i] = min(np.min(rk_y), z[i])
self._line_max, = self.canvas.axes.plot( self._line_max, = self.canvas.axes.plot(
x, y, x, y,
@ -206,7 +225,7 @@ class PlotAdis_dx(PamhyrPlot):
) )
self._line_min, = self.canvas.axes.plot( self._line_min, = self.canvas.axes.plot(
x, y, x, z,
label=self.label_min[self._key], label=self.label_min[self._key],
color='g', color='g',
linestyle='dotted', linestyle='dotted',
@ -234,7 +253,7 @@ class PlotAdis_dx(PamhyrPlot):
self.update_min_and_max() self.update_min_and_max()
self.update_data() self.update_data()
self.set_y_lim #self.set_y_lim
self.update_idle() self.update_idle()
def update_min_and_max(self): def update_min_and_max(self):
@ -242,19 +261,22 @@ class PlotAdis_dx(PamhyrPlot):
profile = reach.profile(self._current_profile_id) profile = reach.profile(self._current_profile_id)
x = reach.geometry.get_rk() x = reach.geometry.get_rk()
if self.val_id[self._key] > 0 and self._type_pol == 1: y = [-inf]*reach.geometry.number_profiles
y = [0.0]*len(x) z = [inf]*reach.geometry.number_profiles
else: for pol_id in self._current_pol_id:
y = [] if self.val_id[self._key] > 0 and self._type_pol[pol_id] == 1:
z = [] for i in range(reach.geometry.number_profiles):
val_id = self.val_id[self._key] y[i] = max(0.0, y[i])
for p in reach.profiles: z[i] = min(0.0, z[i])
rk_y = list(map(lambda data_el: else:
data_el[self._current_pol_id][val_id], val_id = self.val_id[self._key]
p.get_key("pols") for i, p in enumerate(reach.profiles):
)) rk_y = list(map(lambda data_el:
y.append(np.max(rk_y)) data_el[pol_id][val_id],
z.append(np.min(rk_y)) p.get_key("pols")
))
y[i] = max(np.max(rk_y), y[i])
z[i] = min(np.min(rk_y), z[i])
self._line_max.set_data(x, y) self._line_max.set_data(x, y)
self._line_min.set_data(x, z) self._line_min.set_data(x, z)
@ -265,62 +287,57 @@ class PlotAdis_dx(PamhyrPlot):
x = reach.geometry.get_rk() x = reach.geometry.get_rk()
if self.val_id[self._key] > 0 and self._type_pol == 1: for i in range(len(self._current_pol_id)):
y = [0.0]*len(x) pol_id = self._current_pol_id[i]
else: if self.val_id[self._key] > 0 and self._type_pol[pol_id] == 1:
y = list(map( y = [0.0]*len(x)
lambda p: p.get_ts_key( else:
self._current_timestamp, "pols" y = list(map(
)[self._current_pol_id][self.val_id[self._key]], lambda p: p.get_ts_key(
reach.profiles)) self._current_timestamp, "pols"
)[pol_id][self.val_id[self._key]],
reach.profiles))
self._line.set_data(x, y) self._lines[i].set_data(x, y)
self.update_current() self.update_current()
self.hide_current()
self.canvas.axes.relim(visible_only=True)
self.canvas.axes.autoscale_view()
self.show_current()
def update_current(self):
reach = self.results.river.reach(self._current_reach_id)
rk = reach.geometry.get_rk()
cid = self._current_profile_id
self._current.set_data(
[rk[cid], rk[cid]],
[self.y_max, self.y_min]
)
self.canvas.figure.canvas.draw_idle()
def hide_current(self): def hide_current(self):
self._current.set_visible(False) self._current.set_visible(False)
def show_current(self): def show_current(self):
self._current.set_visible(True) self._current.set_visible(True)
def set_pollutant(self, pol_id, type_pol): def set_pollutant(self, pol_id):
if pol_id != self._current_pol_id: for l in self._lines:
self._type_pol = type_pol l.remove()
self._lines = []
reach = self.results.river.reach(self._current_reach_id)
self._current_pol_id = pol_id self._current_pol_id = pol_id
self.update() self.update_min_and_max()
self.draw_data(reach)
self.update_current()
#self.set_y_lim
self.update_idle()
def set_y_lim(self): def set_y_lim(self):
reach = self.results.river.reach(self._current_reach_id) reach = self.results.river.reach(self._current_reach_id)
if self.val_id[self._key] > 0 and self._type_pol == 1: y0 = []
y = [0.0] for pol_id in self._current_pol_id:
else: if self.val_id[self._key] > 0 and self._type_pol[pol_id] == 1:
val_id = self.val_id[self._key] y = [0.0]
y = list( else:
map(lambda p: val_id = self.val_id[self._key]
list(map(lambda data_el: y = list(
data_el[self._current_pol_id][val_id], map(lambda p:
p.get_key("pols"))), reach.profiles)) list(map(lambda data_el:
data_el[pol_id][val_id],
p.get_key("pols"))), reach.profiles))
y0.append(y)
self.y_max = np.max(y) self.y_max = np.max([np.max(y) for y in y0])
self.y_min = np.min(y) self.y_min = np.min([np.min(y) for y in y0])
if self.y_max - self.y_min < 0.000001: if self.y_max - self.y_min < 0.000001:
self.y_min = (self.y_max + self.y_min)/2 - 0.5 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.y_max = (self.y_max + self.y_min)/2 + 0.5

View File

@ -101,7 +101,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 = 1 self._pol_id = [1]
self._reach_id = 0 self._reach_id = 0
self._profile_id = 0 self._profile_id = 0
@ -115,7 +115,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
self.setup_connections() self.setup_connections()
self.update_table_selection_reach(self._reach_id) self.update_table_selection_reach(self._reach_id)
self.update_table_selection_profile(self._profile_id) self.update_table_selection_profile(self._profile_id)
self.update_table_selection_pol(self._pol_id-1) self.update_table_selection_pol(self._pol_id)
except Exception as e: except Exception as e:
logger_exception(e) logger_exception(e)
return return
@ -190,7 +190,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
profile_id=self._profile_id, profile_id=self._profile_id,
pol_id=self._pol_id, pol_id=self._pol_id,
key="C", key="C",
type_pol=self._type_pol[self._pol_id], type_pol=self._type_pol,
trad=self._trad, trad=self._trad,
toolbar=self.toolbar_cdt toolbar=self.toolbar_cdt
) )
@ -216,7 +216,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
profile_id=self._profile_id, profile_id=self._profile_id,
pol_id=self._pol_id, pol_id=self._pol_id,
key="C", key="C",
type_pol=self._type_pol[self._pol_id], type_pol=self._type_pol,
trad=self._trad, trad=self._trad,
toolbar=self.toolbar_cdx toolbar=self.toolbar_cdx
) )
@ -242,7 +242,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
profile_id=self._profile_id, profile_id=self._profile_id,
pol_id=self._pol_id, pol_id=self._pol_id,
key="M", key="M",
type_pol=self._type_pol[self._pol_id], type_pol=self._type_pol,
trad=self._trad, trad=self._trad,
toolbar=self.toolbar_mdx toolbar=self.toolbar_mdx
) )
@ -269,15 +269,15 @@ class ResultsWindowAdisTS(PamhyrWindow):
profile_id=self._profile_id, profile_id=self._profile_id,
pol_id=self._pol_id, pol_id=self._pol_id,
key="M", key="M",
type_pol=self._type_pol[self._pol_id], type_pol=self._type_pol,
trad=self._trad, trad=self._trad,
toolbar=self.toolbar_mdt toolbar=self.toolbar_mdt
) )
self.plot_mdt.draw() self.plot_mdt.draw()
if self._type_pol[self._pol_id] != 7: #if self._type_pol[self._pol_id[0]] != 7:
self.find(QTabWidget, "tabWidget").setTabVisible(2, False) #self.find(QTabWidget, "tabWidget").setTabVisible(2, False)
# Thickness # Thickness
@ -299,9 +299,9 @@ class ResultsWindowAdisTS(PamhyrWindow):
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=0, pol_id=[0],
key="M", key="M",
type_pol=self._type_pol[0], type_pol=self._type_pol,
trad=self._trad, trad=self._trad,
toolbar=self.toolbar_tdx toolbar=self.toolbar_tdx
) )
@ -326,9 +326,9 @@ class ResultsWindowAdisTS(PamhyrWindow):
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=0, pol_id=[0],
key="M", key="M",
type_pol=self._type_pol[0], type_pol=self._type_pol,
trad=self._trad, trad=self._trad,
toolbar=self.toolbar_tdt toolbar=self.toolbar_tdt
) )
@ -466,7 +466,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
for t in ["pollutants"]: for t in ["pollutants"]:
table = self.find(QTableView, f"tableView_{t}") table = self.find(QTableView, f"tableView_{t}")
selectionModel = table.selectionModel() selectionModel = table.selectionModel()
index = table.model().index(ind, 0) index = table.model().index(ind[0]- 1, 0)
selectionModel.select( selectionModel.select(
index, index,
@ -481,9 +481,9 @@ class ResultsWindowAdisTS(PamhyrWindow):
if reach_id is not None: if reach_id is not None:
self.plot_cdt.set_reach(reach_id) self.plot_cdt.set_reach(reach_id)
self.plot_cdx.set_reach(reach_id) self.plot_cdx.set_reach(reach_id)
if self._type_pol[self._pol_id] != 1: #if self._type_pol[self._pol_id[0]] != 1:
self.plot_mdx.set_reach(reach_id) self.plot_mdx.set_reach(reach_id)
self.plot_mdt.set_reach(reach_id) self.plot_mdt.set_reach(reach_id)
self.plot_tdt.set_reach(reach_id) self.plot_tdt.set_reach(reach_id)
self.plot_tdx.set_reach(reach_id) self.plot_tdx.set_reach(reach_id)
@ -493,37 +493,32 @@ class ResultsWindowAdisTS(PamhyrWindow):
if profile_id is not None: if profile_id is not None:
self.plot_cdt.set_profile(profile_id) self.plot_cdt.set_profile(profile_id)
self.plot_cdx.set_profile(profile_id) self.plot_cdx.set_profile(profile_id)
if self._type_pol[self._pol_id] != 1: #if self._type_pol[self._pol_id[0]] != 1:
self.plot_mdx.set_profile(profile_id) self.plot_mdx.set_profile(profile_id)
self.plot_mdt.set_profile(profile_id) self.plot_mdt.set_profile(profile_id)
self.plot_tdt.set_profile(profile_id) self.plot_tdt.set_profile(profile_id)
self.plot_tdx.set_profile(profile_id) self.plot_tdx.set_profile(profile_id)
self.update_table_selection_profile(profile_id) self.update_table_selection_profile(profile_id)
if pol_id is not None: if pol_id is not None:
self._pol_id = pol_id+1 self._pol_id = [p+1 for p in pol_id] # remove total_sediment
self.plot_cdt.set_pollutant(self._pol_id, self.plot_cdt.set_pollutant(self._pol_id)
self._type_pol[self._pol_id]) self.plot_cdx.set_pollutant(self._pol_id)
self.plot_cdx.set_pollutant(self._pol_id, #if self._type_pol[self._pol_id[0]] != 1:
self._type_pol[self._pol_id]) #self.find(QTabWidget, "tabWidget").setTabVisible(2, True)
if self._type_pol[self._pol_id] != 1: #self.plot_mdx.set_pollutant(self._pol_id)
self.find(QTabWidget, "tabWidget").setTabVisible(2, True) #self.plot_mdt.set_pollutant(self._pol_id)
self.plot_mdx.set_pollutant(self._pol_id, #else:
self._type_pol[self._pol_id]) #self.find(QTabWidget, "tabWidget").setTabVisible(2, False)
self.plot_mdt.set_pollutant(self._pol_id,
self._type_pol[self._pol_id])
else:
self.find(QTabWidget, "tabWidget").setTabVisible(2, False)
self.update_table_selection_pol(self._pol_id-1) #self.update_table_selection_pol(self._pol_id)
if timestamp is not None: if timestamp is not None:
self.plot_cdt.set_timestamp(timestamp) self.plot_cdt.set_timestamp(timestamp)
self.plot_cdx.set_timestamp(timestamp) self.plot_cdx.set_timestamp(timestamp)
if self._type_pol[self._pol_id] != 1: self.plot_mdx.set_timestamp(timestamp)
self.plot_mdx.set_timestamp(timestamp) self.plot_mdt.set_timestamp(timestamp)
self.plot_mdt.set_timestamp(timestamp)
self.plot_tdt.set_timestamp(timestamp) self.plot_tdt.set_timestamp(timestamp)
self.plot_tdx.set_timestamp(timestamp) self.plot_tdx.set_timestamp(timestamp)
@ -555,10 +550,11 @@ class ResultsWindowAdisTS(PamhyrWindow):
def _set_current_pol(self): def _set_current_pol(self):
table = self.find(QTableView, f"tableView_pollutants") table = self.find(QTableView, f"tableView_pollutants")
indexes = table.selectedIndexes() indexes = table.selectedIndexes()
rows = [i.row() for i in indexes]
if len(indexes) == 0: if len(indexes) == 0:
return return
self.update(pol_id=indexes[0].row()) self.update(pol_id=rows)
def _set_current_profile_raw_data(self): def _set_current_profile_raw_data(self):
table = self.find(QTableView, f"tableView_raw_data") table = self.find(QTableView, f"tableView_raw_data")