From bfc40f2e5e071626ec0b671425fc17deef762b18 Mon Sep 17 00:00:00 2001 From: brahim Date: Tue, 1 Oct 2024 13:05:21 +0200 Subject: [PATCH] Fine sediments table and sand sediment data are reorganize in horizotal layout. Color lists use to plot samples are simplified with less color. --- View/sample_data_tab.py | 1128 ++++++++++++++++++--------------------- 1 file changed, 517 insertions(+), 611 deletions(-) diff --git a/View/sample_data_tab.py b/View/sample_data_tab.py index 8b92cfa..b125066 100644 --- a/View/sample_data_tab.py +++ b/View/sample_data_tab.py @@ -10,7 +10,7 @@ import pandas as pd import itertools import matplotlib.pyplot as plt -from matplotlib.colors import CSS4_COLORS, LogNorm +from matplotlib.colors import CSS4_COLORS, LogNorm, BASE_COLORS from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolBar from copy import deepcopy @@ -67,17 +67,14 @@ class SampleDataTab(QWidget): self.groupbox_display_option = QGroupBox() self.verticalLayout_groupboxes_plot_sample_position_display_option.addWidget(self.groupbox_display_option, 3) - self.verticalLayout_groupboxes_fine_sand = QVBoxLayout() - self.horizontalLayoutTop_sampleDataTab.addLayout(self.verticalLayout_groupboxes_fine_sand, 6) + # self.verticalLayout_groupboxes_fine_sand = QVBoxLayout() + # self.horizontalLayoutTop_sampleDataTab.addLayout(self.verticalLayout_groupboxes_fine_sand, 6) self.groupbox_fine = QGroupBox() - self.verticalLayout_groupboxes_fine_sand.addWidget(self.groupbox_fine, 5) + self.horizontalLayoutTop_sampleDataTab.addWidget(self.groupbox_fine, 4) self.groupbox_sand = QGroupBox() - self.verticalLayout_groupboxes_fine_sand.addWidget(self.groupbox_sand, 5) - - - + self.horizontalLayoutTop_sampleDataTab.addWidget(self.groupbox_sand, 4) # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # +++ --- GroupBox download and visualize tables of values --- +++ @@ -94,7 +91,7 @@ class SampleDataTab(QWidget): self.horizontalLayout_download_fine_sediment.addWidget(self.pushbutton_fine_sediment) self.lineEdit_fine_sediment = QLineEdit() self.horizontalLayout_download_fine_sediment.addWidget(self.lineEdit_fine_sediment) - self.horizontalSpacerItem_fine = QSpacerItem(600, 10, QSizePolicy.Expanding, QSizePolicy.Minimum) + self.horizontalSpacerItem_fine = QSpacerItem(50, 10, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_download_fine_sediment.addItem(self.horizontalSpacerItem_fine) # self.pushbutton_fine_sediment.clicked.connect(self.open_dialog_box_fine_sediment) @@ -115,7 +112,7 @@ class SampleDataTab(QWidget): self.horizontalLayout_download_sand_sediment.addWidget(self.pushbutton_sand_sediment) self.lineEdit_sand_sediment = QLineEdit() self.horizontalLayout_download_sand_sediment.addWidget(self.lineEdit_sand_sediment) - self.horizontalSpacerItem_sand = QSpacerItem(600, 10, QSizePolicy.Expanding, QSizePolicy.Minimum) + self.horizontalSpacerItem_sand = QSpacerItem(50, 10, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_download_sand_sediment.addItem(self.horizontalSpacerItem_sand) self.tableWidget_sand = QTableWidget() @@ -690,13 +687,13 @@ class SampleDataTab(QWidget): # --- Set vertical header (color) --- self.tableWidget_fine.verticalHeader().setVisible(False) - color_list = CSS4_COLORS + color_list = BASE_COLORS for i in range(self.tableWidget_fine.rowCount()): exec("self.comboBox_sample_table_fine" + str(i) + "= QComboBox()") exec("self.comboBox_sample_table_fine" + str(i) + ".addItems(color_list)") eval(f"self.tableWidget_fine.setCellWidget(i, 0, self.comboBox_sample_table_fine{i})") - eval(f"self.comboBox_sample_table_fine{i}.currentTextChanged." - f"connect(self.extract_position_list_and_color_list_from_table_checkboxes_fine)") + # eval(f"self.comboBox_sample_table_fine{i}.currentTextChanged." + # f"connect(self.extract_position_list_and_color_list_from_table_checkboxes_fine)") eval(f"self.comboBox_sample_table_fine{i}.currentTextChanged." f"connect(self.plot_total_concentration)") eval(f"self.comboBox_sample_table_fine{i}.currentTextChanged." @@ -707,7 +704,7 @@ class SampleDataTab(QWidget): # --- Fill Sample column with checkbox --- for i in range(self.tableWidget_fine.rowCount()): self.item_checkbox_fine = QTableWidgetItem() - self.item_checkbox_fine.setCheckState(Qt.Unchecked) + self.item_checkbox_fine.setCheckState(Qt.Checked) self.tableWidget_fine.setItem(i, 1, self.item_checkbox_fine) self.item_checkbox_fine.setText("F" + str(i + 1)) stg.sample_fine.append(("F" + str(i + 1), i)) @@ -728,8 +725,8 @@ class SampleDataTab(QWidget): # self.allChkBox.stateChanged.connect(self.check_allChkBox) # --- Connect checkbox items of tableWidget to update plots --- - self.tableWidget_fine.itemChanged.connect( - self.extract_position_list_and_color_list_from_table_checkboxes_fine) + # self.tableWidget_fine.itemChanged.connect( + # self.extract_position_list_and_color_list_from_table_checkboxes_fine) self.tableWidget_fine.itemChanged.connect(self.update_plot_sample_position_on_transect) self.tableWidget_fine.itemChanged.connect(self.plot_total_concentration) self.tableWidget_fine.itemChanged.connect(self.plot_PSD_fine_and_sand_sediments) @@ -737,6 +734,10 @@ class SampleDataTab(QWidget): self.combobox_x_axis.currentIndexChanged.connect(self.plot_total_concentration) self.combobox_y_axis.currentIndexChanged.connect(self.plot_total_concentration) + self.plot_sample_position_on_transect() + self.plot_total_concentration() + self.plot_PSD_fine_and_sand_sediments() + # elif not (self.lineEdit_fine_sediment.text()) and (self.lineEdit_sand.text()): # # self.row = self.tableWidget_sample.setRowCount(stg.sample_depth.shape[0]) @@ -907,13 +908,13 @@ class SampleDataTab(QWidget): # --- Set vertical header (color) --- self.tableWidget_sand.verticalHeader().setVisible(False) - color_list = CSS4_COLORS + color_list = BASE_COLORS for i in range(self.tableWidget_sand.rowCount()): exec("self.comboBox_sample_table_sand" + str(i) + "= QComboBox()") exec("self.comboBox_sample_table_sand" + str(i) + ".addItems(color_list)") eval(f"self.tableWidget_sand.setCellWidget(i, 0, self.comboBox_sample_table_sand{i})") - eval(f"self.comboBox_sample_table_sand{i}.currentTextChanged." - f"connect(self.extract_position_list_and_color_list_from_table_checkboxes_sand)") + # eval(f"self.comboBox_sample_table_sand{i}.currentTextChanged." + # f"connect(self.extract_position_list_and_color_list_from_table_checkboxes_sand)") eval(f"self.comboBox_sample_table_sand{i}.currentTextChanged." f"connect(self.plot_total_concentration)") eval(f"self.comboBox_sample_table_sand{i}.currentTextChanged." @@ -924,7 +925,7 @@ class SampleDataTab(QWidget): # --- Fill Sample column with checkbox --- for i in range(self.tableWidget_sand.rowCount()): self.item_checkbox_sand = QTableWidgetItem() - self.item_checkbox_sand.setCheckState(Qt.Unchecked) + self.item_checkbox_sand.setCheckState(Qt.Checked) self.tableWidget_sand.setItem(i, 1, self.item_checkbox_sand) self.item_checkbox_sand.setText("S" + str(i + 1)) stg.sample_sand.append(("S" + str(i + 1), i)) @@ -942,8 +943,8 @@ class SampleDataTab(QWidget): self.tableWidget_sand.setItem(i, j + 6, QTableWidgetItem(str(stg.frac_vol_sand[i, j]))) # --- Connect checkbox items of tableWidget to update plots --- - self.tableWidget_sand.itemChanged.connect( - self.extract_position_list_and_color_list_from_table_checkboxes_sand) + # self.tableWidget_sand.itemChanged.connect( + # self.extract_position_list_and_color_list_from_table_checkboxes_sand) self.tableWidget_sand.itemChanged.connect(self.update_plot_sample_position_on_transect) self.tableWidget_sand.itemChanged.connect(self.plot_total_concentration) self.tableWidget_sand.itemChanged.connect(self.plot_PSD_fine_and_sand_sediments) @@ -951,6 +952,10 @@ class SampleDataTab(QWidget): self.combobox_x_axis.currentIndexChanged.connect(self.plot_total_concentration) self.combobox_y_axis.currentIndexChanged.connect(self.plot_total_concentration) + self.plot_sample_position_on_transect() + self.plot_total_concentration() + self.plot_PSD_fine_and_sand_sediments() + # --- Function to extract position of sample from table checkboxes to update plots --- def extract_position_list_and_color_list_from_table_checkboxes_fine(self): # if self.tableWidget_fine.columnCount() > 10: @@ -966,6 +971,79 @@ class SampleDataTab(QWidget): print("FINE : position ", position, " color_list ", color_list) return position, color_list + def read_select_samples_fine(self): + + # --- Read selected samples (checkboxes) --- + position_list_fine, _ = self.extract_position_list_and_color_list_from_table_checkboxes_fine() + Ctot_fine_to_plot = [] + Ctot_fine_percent_to_plot = [] + sample_depth_to_plot_fine = [] + indices_bottom_fine = [] + depth_bottom_to_plot_fine = [] + print("time fine ", stg.time_fine) + for k in range(len(position_list_fine)): + print("k = ", k, "type(k) = ", type(k)) + Ctot_fine_to_plot.append(stg.Ctot_fine[position_list_fine[k]]) + Ctot_fine_percent_to_plot.append(stg.Ctot_fine_per_cent[position_list_fine[k]]) + sample_depth_to_plot_fine.append(stg.depth_fine[position_list_fine[k]]) + if stg.depth_bottom[self.combobox_acoustic_data.currentIndex()].shape != (0,): + print("stg.time_fine ", stg.time_fine[position_list_fine[k]]) + + indice_test = np.argmax(np.abs([stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex()] + - stg.time_fine[position_list_fine[k]]])) + print("indice test ", indice_test) + print(np.where(np.abs([stg.time_cross_section[ + self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex()] - + stg.time_fine[position_list_fine[k]]]) == + np.nanmin(np.abs(stg.time_cross_section[ + self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex()] - + stg.time_fine[position_list_fine[k]])))) + indices_bottom_fine.append(np.where(np.abs([stg.time_cross_section[ + self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex()] - + stg.time_fine[position_list_fine[k]]]) == + np.nanmin(np.abs(stg.time_cross_section[ + self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex()] - + stg.time_fine[position_list_fine[k]])))[0][0]) + depth_bottom_to_plot_fine.append( + stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_fine[-1]]) + + print("depth_bottom_to_plot_fine ", depth_bottom_to_plot_fine) + print("indices_bottom_fine ", indices_bottom_fine) + + elif stg.time_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + indices_bottom_fine.append(np.where( + np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex()] - stg.time_fine[position_list_fine[k]]) == + np.nanmin( + np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex()] - stg.time_fine[position_list_fine[k]])))[ + 0][0]) + depth_bottom_to_plot_fine.append( + stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), -1]) + + else: + + indices_bottom_fine.append(np.where( + np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - + stg.time_fine[position_list_fine[k]]) == + np.nanmin( + np.abs( + stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - + stg.time_fine[position_list_fine[k]])))[ + 0][0]) + depth_bottom_to_plot_fine.append( + stg.depth[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), -1]) + + return Ctot_fine_to_plot, Ctot_fine_percent_to_plot, sample_depth_to_plot_fine, indices_bottom_fine, depth_bottom_to_plot_fine + def extract_position_list_and_color_list_from_table_checkboxes_sand(self): if self.tableWidget_sand.columnCount() > 10: position = [] @@ -981,6 +1059,76 @@ class SampleDataTab(QWidget): # self.update_plot_sample_position_on_transect() return position, color_list + def read_select_samples_sand(self): + + # --- Read selected sand samples (checkboxes) --- + position_list_sand, color_list_sand = self.extract_position_list_and_color_list_from_table_checkboxes_sand() + Ctot_sand_to_plot = [] + Ctot_sand_percent_to_plot = [] + sample_depth_to_plot_sand = [] + indices_bottom_sand = [] + depth_bottom_to_plot_sand = [] + for k in range(len(position_list_sand)): + Ctot_sand_to_plot.append(stg.Ctot_sand[position_list_sand[k]]) + Ctot_sand_percent_to_plot.append(stg.Ctot_sand_per_cent[position_list_sand[k]]) + sample_depth_to_plot_sand.append(stg.depth_sand[position_list_sand[k]]) + if stg.depth_bottom[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + indices_bottom_sand.append(np.where(np.abs( + stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex()] - stg.time_sand[ + position_list_sand[k]]) == + np.nanmin(np.abs(stg.time_cross_section[ + self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex()] - + stg.time_sand[k])))[0][0]) + depth_bottom_to_plot_sand.append( + stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_sand[-1]]) + + elif stg.time_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + print("The test 0 : ", np.where(np.abs( + stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex()] - stg.time_sand[ + position_list_sand[k]]) == + np.nanmin(np.abs(stg.time_cross_section[ + self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex()] - + stg.time_sand[k])))) + + indices_bottom_sand.append(np.where( + np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]]) == + np.nanmin( + np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]])))[ + 0][0]) + depth_bottom_to_plot_sand.append( + stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), -1]) + + else: + print("The test 1 : ", np.where( + np.abs( + stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - + stg.time_sand[position_list_sand[k]]) == + np.nanmin( + np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]])))) + + indices_bottom_sand.append(np.where( + np.abs( + stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - + stg.time_sand[position_list_sand[k]]) == + np.nanmin( + np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]])))[ + 0][0]) + depth_bottom_to_plot_sand.append( + stg.depth[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), -1]) + + return Ctot_sand_to_plot, Ctot_sand_percent_to_plot, sample_depth_to_plot_sand, indices_bottom_sand, depth_bottom_to_plot_sand def check_allChkBox(self, state): for i in range(self.tableWidget_sample.rowCount()): @@ -1125,13 +1273,40 @@ class SampleDataTab(QWidget): def plot_sample_position_on_transect(self): - if len(stg.BS_raw_data) == 0: - msgBox = QMessageBox() - msgBox.setWindowTitle("Plot transect Error") - msgBox.setIcon(QMessageBox.Warning) - msgBox.setText("Load data from acoustic data tab before plotting transect with sample position") - msgBox.setStandardButtons(QMessageBox.Ok) - msgBox.exec() + self.verticalLayout_groupbox_plot_transect.removeWidget(self.canvas_plot_sample_position_on_transect) + + self.figure_plot_sample_position_on_transect, self.axis_plot_sample_position_on_transect = \ + plt.subplots(nrows=1, ncols=1, layout="constrained") + self.canvas_plot_sample_position_on_transect = FigureCanvas(self.figure_plot_sample_position_on_transect) + + self.verticalLayout_groupbox_plot_transect.addWidget(self.canvas_plot_sample_position_on_transect) + + if self.combobox_acoustic_data.count() == 0: + + if self.tableWidget_fine.columnCount() > 10: + + position_list_fine, color_list_fine = self.extract_position_list_and_color_list_from_table_checkboxes_fine() + + self.axis_plot_sample_position_on_transect.scatter( + stg.time_fine, stg.depth_fine, + linestyle='None', marker="x", s=15, c=color_list_fine) + + for i in range(len(stg.time_fine)): + self.axis_plot_sample_position_on_transect.text( + stg.time_fine[i] - 8, stg.depth_fine[i] - .2, "F" + str(i+1), + fontstyle="normal", fontweight="light", fontsize=8) + + if self.tableWidget_sand.columnCount() > 10: + position_list_sand, color_list_sand = self.extract_position_list_and_color_list_from_table_checkboxes_sand() + + self.axis_plot_sample_position_on_transect.scatter( + stg.time_sand, stg.depth_sand, + linestyle='None', marker="o", s=60, facecolors='None', edgecolors=color_list_sand) + + for i in range(len(stg.time_sand)): + self.axis_plot_sample_position_on_transect.text( + stg.time_sand[i] + 3, stg.depth_sand[i] - .2, "S" + str(i+1), + fontstyle="normal", fontweight="light", fontsize=8) else: @@ -1139,14 +1314,6 @@ class SampleDataTab(QWidget): self.combobox_frequencies.addItems(stg.freq_text[self.combobox_acoustic_data.currentIndex()]) # self.combobox_frequencies.currentTextChanged.connect(self.update_plot_sample_position_on_transect) - self.verticalLayout_groupbox_plot_transect.removeWidget(self.canvas_plot_sample_position_on_transect) - - self.figure_plot_sample_position_on_transect, self.axis_plot_sample_position_on_transect = \ - plt.subplots(nrows=1, ncols=1, layout="constrained") - self.canvas_plot_sample_position_on_transect = FigureCanvas(self.figure_plot_sample_position_on_transect) - - self.verticalLayout_groupbox_plot_transect.addWidget(self.canvas_plot_sample_position_on_transect) - if stg.time_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): if stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): @@ -1326,252 +1493,340 @@ class SampleDataTab(QWidget): stg.BS_raw_data[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - self.axis_plot_sample_position_on_transect.set_xticks([]) - self.axis_plot_sample_position_on_transect.set_yticks([]) - self.figure_plot_sample_position_on_transect.canvas.draw_idle() + if self.tableWidget_fine.columnCount() > 10: + + position_list_fine, color_list_fine = self.extract_position_list_and_color_list_from_table_checkboxes_fine() + + self.axis_plot_sample_position_on_transect.scatter( + stg.time_fine, stg.depth_fine, + linestyle='None', marker="x", s=15, c=color_list_fine) + + for i in range(len(stg.time_fine)): + self.axis_plot_sample_position_on_transect.text( + stg.time_fine[i] - 8, stg.depth_fine[i] - .2, "F" + str(i+1), + fontstyle="normal", fontweight="light", fontsize=8) + + if self.tableWidget_sand.columnCount() > 10: + position_list_sand, color_list_sand = self.extract_position_list_and_color_list_from_table_checkboxes_sand() + + self.axis_plot_sample_position_on_transect.scatter( + stg.time_sand, stg.depth_sand, + linestyle='None', marker="o", s=60, facecolors='None', edgecolors=color_list_sand) + + for i in range(len(stg.time_sand)): + self.axis_plot_sample_position_on_transect.text( + stg.time_sand[i] + 3, stg.depth_sand[i] - .2, "S" + str(i+1), + fontstyle="normal", fontweight="light", fontsize=8) + + + self.axis_plot_sample_position_on_transect.set_xticks([]) + self.axis_plot_sample_position_on_transect.set_yticks([]) + self.figure_plot_sample_position_on_transect.canvas.draw_idle() def update_plot_sample_position_on_transect(self): self.axis_plot_sample_position_on_transect.cla() - if stg.time_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): + if self.combobox_acoustic_data.count() == 0: - if stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): + if self.tableWidget_fine.columnCount() > 10: - x_time = stg.time_cross_section[self.combobox_acoustic_data.currentIndex()] - y_depth = stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()] + position_list_fine, color_list_fine = self.extract_position_list_and_color_list_from_table_checkboxes_fine() - elif stg.depth[self.combobox_acoustic_data.currentIndex()].shape != (0,): + if len(position_list_fine) != 0: + time_fine_to_plot = [] + depth_fine_to_plot = [] + for k in position_list_fine: + time_fine_to_plot.append(stg.time_fine[k]) + depth_fine_to_plot.append(stg.depth_fine[k]) - x_time = stg.time_cross_section[self.combobox_acoustic_data.currentIndex()] - y_depth = stg.depth[self.combobox_acoustic_data.currentIndex()] + self.axis_plot_sample_position_on_transect.scatter( + time_fine_to_plot, depth_fine_to_plot, + linestyle='None', marker="x", s=15, c=color_list_fine) + + for i in range(len(time_fine_to_plot)): + self.axis_plot_sample_position_on_transect.text( + time_fine_to_plot[i] - 8, depth_fine_to_plot[i] - .2, "F" + str(i+1), + fontstyle="normal", fontweight="light", fontsize=8) + + if self.tableWidget_sand.columnCount() > 10: + + position_list_sand, color_list_sand = self.extract_position_list_and_color_list_from_table_checkboxes_sand() + + if len(position_list_sand) != 0: + time_sand_to_plot = [] + depth_sand_to_plot = [] + for k in position_list_sand: + time_sand_to_plot.append(stg.time_sand[k]) + depth_sand_to_plot.append(stg.depth_sand[k]) + + self.axis_plot_sample_position_on_transect.scatter( + time_sand_to_plot, depth_sand_to_plot, + linestyle='None', marker="o", s=60, facecolors='None', edgecolors=color_list_sand) + + for i in range(len(time_sand_to_plot)): + self.axis_plot_sample_position_on_transect.text( + time_sand_to_plot[i] + 3, depth_sand_to_plot[i] - .2, "S" + str(i+1), + fontstyle="normal", fontweight="light", fontsize=8) else: - if stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): + if stg.time_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): - x_time = stg.time[self.combobox_acoustic_data.currentIndex()] - y_depth = stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()] + if stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): - elif stg.depth[self.combobox_acoustic_data.currentIndex()].shape != (0,): + x_time = stg.time_cross_section[self.combobox_acoustic_data.currentIndex()] + y_depth = stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()] - x_time = stg.time[self.combobox_acoustic_data.currentIndex()] - y_depth = stg.depth[self.combobox_acoustic_data.currentIndex()] + elif stg.depth[self.combobox_acoustic_data.currentIndex()].shape != (0,): - # --- Create canvas of Matplotlib figure --- - if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()].shape != (0,): + x_time = stg.time_cross_section[self.combobox_acoustic_data.currentIndex()] + y_depth = stg.depth[self.combobox_acoustic_data.currentIndex()] - val_min = np.nanmin( - stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), - :, :]) - val_max = np.nanmax( - stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), - :, :]) - if val_min == 0: - val_min = 1e-5 + else: - self.axis_plot_sample_position_on_transect.pcolormesh( - x_time[self.combobox_frequencies.currentIndex(), :], - -y_depth[self.combobox_frequencies.currentIndex(), :], - stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), - :, :], - cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + if stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): - self.axis_plot_sample_position_on_transect.plot( - x_time[self.combobox_frequencies.currentIndex(), :], - -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], - color='black', linewidth=1, linestyle="solid") + x_time = stg.time[self.combobox_acoustic_data.currentIndex()] + y_depth = stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()] - elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data.currentIndex()].shape != (0,): - val_min = np.nanmin( - stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), - :, :]) - val_max = np.nanmax( - stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), - :, :]) - if val_min == 0: - val_min = 1e-5 + x_time = stg.time[self.combobox_acoustic_data.currentIndex()] + y_depth = stg.depth[self.combobox_acoustic_data.currentIndex()] - self.axis_plot_sample_position_on_transect.pcolormesh( - x_time[self.combobox_frequencies.currentIndex(), :], - -y_depth[self.combobox_frequencies.currentIndex(), :], - stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), - :, :], - cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + # --- Create canvas of Matplotlib figure --- + if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()].shape != (0,): - self.axis_plot_sample_position_on_transect.plot( - x_time[self.combobox_frequencies.currentIndex(), :], - -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], - color='black', linewidth=1, linestyle="solid") + val_min = np.nanmin( + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), + :, :]) + val_max = np.nanmax( + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), + :, :]) + if val_min == 0: + val_min = 1e-5 - elif stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,): + self.axis_plot_sample_position_on_transect.pcolormesh( + x_time[self.combobox_frequencies.currentIndex(), :], + -y_depth[self.combobox_frequencies.currentIndex(), :], + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), + :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - val_min = np.nanmin(stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :, :]) - val_max = np.nanmax(stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :, :]) - if val_min == 0: - val_min = 1e-5 + self.axis_plot_sample_position_on_transect.plot( + x_time[self.combobox_frequencies.currentIndex(), :], + -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], + color='black', linewidth=1, linestyle="solid") - self.axis_plot_sample_position_on_transect.pcolormesh( - x_time[self.combobox_frequencies.currentIndex(), :], - -y_depth[self.combobox_frequencies.currentIndex(), :], - stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :, :], - cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()].shape != (0,): - self.axis_plot_sample_position_on_transect.plot( - x_time[self.combobox_frequencies.currentIndex(), :], - -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], - color='black', linewidth=1, linestyle="solid") + val_min = np.nanmin( + stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), + :, :]) + val_max = np.nanmax( + stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), + :, :]) + if val_min == 0: + val_min = 1e-5 - elif stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()].shape != (0,): + self.axis_plot_sample_position_on_transect.pcolormesh( + x_time[self.combobox_frequencies.currentIndex(), :], + -y_depth[self.combobox_frequencies.currentIndex(), :], + stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), + :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - val_min = np.nanmin( - stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), - :, :]) - val_max = np.nanmax( - stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), - :, :]) - if val_min == 0: - val_min = 1e-5 + self.axis_plot_sample_position_on_transect.plot( + x_time[self.combobox_frequencies.currentIndex(), :], + -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], + color='black', linewidth=1, linestyle="solid") - self.axis_plot_sample_position_on_transect.pcolormesh( - x_time[self.combobox_frequencies.currentIndex(), :], - -y_depth[self.combobox_frequencies.currentIndex(), :], - stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), - :, :], - cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + elif stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,): - elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()].shape != (0,): + val_min = np.nanmin(stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :, :]) + val_max = np.nanmax(stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :, :]) + if val_min == 0: + val_min = 1e-5 - val_min = np.nanmin( - stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), - :, :]) - val_max = np.nanmax( - stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), - :, :]) - if val_min == 0: - val_min = 1e-5 + self.axis_plot_sample_position_on_transect.pcolormesh( + x_time[self.combobox_frequencies.currentIndex(), :], + -y_depth[self.combobox_frequencies.currentIndex(), :], + stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - self.axis_plot_sample_position_on_transect.pcolormesh( - x_time[self.combobox_frequencies.currentIndex(), :], - -y_depth[self.combobox_frequencies.currentIndex(), :], - stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), - :, :], - cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + self.axis_plot_sample_position_on_transect.plot( + x_time[self.combobox_frequencies.currentIndex(), :], + -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], + color='black', linewidth=1, linestyle="solid") - elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): + elif stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()].shape != (0,): - val_min = np.nanmin( - stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), - :, :]) - val_max = np.nanmax( - stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), - :, :]) - if val_min == 0: - val_min = 1e-5 + val_min = np.nanmin( + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + val_max = np.nanmax( + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + if val_min == 0: + val_min = 1e-5 - self.axis_plot_sample_position_on_transect.pcolormesh( - x_time[self.combobox_frequencies.currentIndex(), :], - -y_depth[self.combobox_frequencies.currentIndex(), :], - stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), - :, :], - cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + self.axis_plot_sample_position_on_transect.pcolormesh( + x_time[self.combobox_frequencies.currentIndex(), :], + -y_depth[self.combobox_frequencies.currentIndex(), :], + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()].shape != (0,): + elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()].shape != (0,): - val_min = np.nanmin( - stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), - :, :]) - val_max = np.nanmax( - stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), - :, :]) - if val_min == 0: - val_min = 1e-5 + val_min = np.nanmin( + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + val_max = np.nanmax( + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + if val_min == 0: + val_min = 1e-5 - self.axis_plot_sample_position_on_transect.pcolormesh( - x_time[self.combobox_frequencies.currentIndex(), :], - -y_depth[self.combobox_frequencies.currentIndex(), :], - stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), - :, :], - cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + self.axis_plot_sample_position_on_transect.pcolormesh( + x_time[self.combobox_frequencies.currentIndex(), :], + -y_depth[self.combobox_frequencies.currentIndex(), :], + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()].shape != (0,): + elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): - val_min = np.nanmin( - stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), - :, :]) - val_max = np.nanmax( - stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), - :, :]) - if val_min == 0: - val_min = 1e-5 + val_min = np.nanmin( + stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), + :, :]) + val_max = np.nanmax( + stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), + :, :]) + if val_min == 0: + val_min = 1e-5 - self.axis_plot_sample_position_on_transect.pcolormesh( - x_time[self.combobox_frequencies.currentIndex(), :], - -y_depth[self.combobox_frequencies.currentIndex(), :], - stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), - :, :], - cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + self.axis_plot_sample_position_on_transect.pcolormesh( + x_time[self.combobox_frequencies.currentIndex(), :], + -y_depth[self.combobox_frequencies.currentIndex(), :], + stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), + :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - elif stg.BS_raw_data[self.combobox_acoustic_data.currentIndex()].shape != (0,): + elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()].shape != (0,): - val_min = np.nanmin( - stg.BS_raw_data[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), - :, :]) - val_max = np.nanmax( - stg.BS_raw_data[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), - :, :]) - if val_min == 0: - val_min = 1e-5 + val_min = np.nanmin( + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + val_max = np.nanmax( + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + if val_min == 0: + val_min = 1e-5 - self.axis_plot_sample_position_on_transect.pcolormesh( - x_time[self.combobox_frequencies.currentIndex(), :], - -y_depth[self.combobox_frequencies.currentIndex(), :], - stg.BS_raw_data[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), - :, :], - cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + self.axis_plot_sample_position_on_transect.pcolormesh( + x_time[self.combobox_frequencies.currentIndex(), :], + -y_depth[self.combobox_frequencies.currentIndex(), :], + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - # --- Read selected samples (checkboxes) --- - if self.tableWidget_fine.columnCount() > 10: + elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()].shape != (0,): - position_list_fine, color_list_fine = self.extract_position_list_and_color_list_from_table_checkboxes_fine() + val_min = np.nanmin( + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + val_max = np.nanmax( + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + if val_min == 0: + val_min = 1e-5 - if len(position_list_fine) != 0: - time_fine_to_plot = [] - depth_fine_to_plot = [] - for k in position_list_fine: - time_fine_to_plot.append(stg.time_fine[k]) - depth_fine_to_plot.append(stg.depth_fine[k]) - self.axis_plot_sample_position_on_transect.scatter(time_fine_to_plot, depth_fine_to_plot, - linestyle='None', marker="o", s=12, c=color_list_fine) + self.axis_plot_sample_position_on_transect.pcolormesh( + x_time[self.combobox_frequencies.currentIndex(), :], + -y_depth[self.combobox_frequencies.currentIndex(), :], + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - if self.tableWidget_sand.columnCount() > 10: - position_list_sand, color_list_sand = self.extract_position_list_and_color_list_from_table_checkboxes_sand() + elif stg.BS_raw_data[self.combobox_acoustic_data.currentIndex()].shape != (0,): - if len(position_list_sand) != 0: - time_sand_to_plot = [] - depth_sand_to_plot = [] - for k in position_list_sand: - time_sand_to_plot.append(stg.time_sand[k]) - depth_sand_to_plot.append(stg.depth_sand[k]) + val_min = np.nanmin( + stg.BS_raw_data[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + val_max = np.nanmax( + stg.BS_raw_data[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + if val_min == 0: + val_min = 1e-5 - self.axis_plot_sample_position_on_transect.scatter(time_sand_to_plot, depth_sand_to_plot, - linestyle='None', marker="o", s=24, edgecolor=color_list_sand) + self.axis_plot_sample_position_on_transect.pcolormesh( + x_time[self.combobox_frequencies.currentIndex(), :], + -y_depth[self.combobox_frequencies.currentIndex(), :], + stg.BS_raw_data[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + + # --- Read selected samples (checkboxes) --- + if self.tableWidget_fine.columnCount() > 10: + + position_list_fine, color_list_fine = self.extract_position_list_and_color_list_from_table_checkboxes_fine() + + if len(position_list_fine) != 0: + time_fine_to_plot = [] + depth_fine_to_plot = [] + label_fine_to_plot = [] + for k in position_list_fine: + time_fine_to_plot.append(stg.time_fine[k]) + depth_fine_to_plot.append(stg.depth_fine[k]) + label_fine_to_plot.append(stg.sample_fine[k][0]) + + self.axis_plot_sample_position_on_transect.scatter( + time_fine_to_plot, depth_fine_to_plot, + linestyle='None', marker="x", s=15, c=color_list_fine) + + for i in range(len(time_fine_to_plot)): + self.axis_plot_sample_position_on_transect.text( + time_fine_to_plot[i] - 8, depth_fine_to_plot[i] - .2, label_fine_to_plot[i], + fontstyle="normal", fontweight="light", fontsize=8) + + if self.tableWidget_sand.columnCount() > 10: + + position_list_sand, color_list_sand = self.extract_position_list_and_color_list_from_table_checkboxes_sand() + + if len(position_list_sand) != 0: + time_sand_to_plot = [] + depth_sand_to_plot = [] + label_sand_to_plot = [] + for k in position_list_sand: + time_sand_to_plot.append(stg.time_sand[k]) + depth_sand_to_plot.append(stg.depth_sand[k]) + label_sand_to_plot.append(stg.sample_sand[k][0]) + + self.axis_plot_sample_position_on_transect.scatter( + time_sand_to_plot, depth_sand_to_plot, + linestyle='None', marker="o", s=60, facecolors='None', edgecolors=color_list_sand) + + for i in range(len(time_sand_to_plot)): + self.axis_plot_sample_position_on_transect.text( + time_sand_to_plot[i] + 3, depth_sand_to_plot[i] - .2, label_sand_to_plot[i], + fontstyle="normal", fontweight="light", fontsize=8) self.axis_plot_sample_position_on_transect.set_xticks([]) self.axis_plot_sample_position_on_transect.set_yticks([]) @@ -1666,15 +1921,6 @@ class SampleDataTab(QWidget): msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() - # if (position_list_fine == []) and (position_list_sand == []): - # - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Axis choice Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Select sample(s) before changing axis") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() - else: self.verticalLayout_groupbox_plot_total_concentration.removeWidget(self.canvas_plot_total_concentration) @@ -1683,83 +1929,29 @@ class SampleDataTab(QWidget): self.figure_total_concentration, self.axis_total_concentration \ = plt.subplots(nrows=1, ncols=1, layout="constrained") self.canvas_plot_total_concentration = FigureCanvas(self.figure_total_concentration) - self.toolbar_plot_total_concentration = NavigationToolBar(self.canvas_plot_total_concentration) + self.toolbar_plot_total_concentration = NavigationToolBar(self.canvas_plot_total_concentration, self) self.verticalLayout_groupbox_plot_total_concentration.addWidget(self.toolbar_plot_total_concentration) self.verticalLayout_groupbox_plot_total_concentration.addWidget(self.canvas_plot_total_concentration) - self.axis_total_concentration.clear() - print("axis_total_concentration ", self.axis_total_concentration) + # =================================================== # --- FINE file uploaded / SAND file NOT uploaded --- if (self.lineEdit_fine_sediment.text()) and not (self.lineEdit_sand_sediment.text()): self.compute_Ctot_per_cent() - # --- Read selected samples (checkboxes) --- - position_list_fine, color_list_fine = self.extract_position_list_and_color_list_from_table_checkboxes_fine() - Ctot_fine_to_plot = [] - Ctot_fine_percent_to_plot = [] - sample_depth_to_plot_fine = [] - indices_bottom_fine = [] - depth_bottom_to_plot_fine = [] - print("time fine ", stg.time_fine) - for k in range(len(position_list_fine)): - print("k = ", k, "type(k) = ", type(k)) - Ctot_fine_to_plot.append(stg.Ctot_fine[position_list_fine[k]]) - Ctot_fine_percent_to_plot.append(stg.Ctot_fine_per_cent[position_list_fine[k]]) - sample_depth_to_plot_fine.append(stg.depth_fine[position_list_fine[k]]) - if stg.depth_bottom[self.combobox_acoustic_data.currentIndex()].shape != (0,): - print("stg.time_fine ", stg.time_fine[position_list_fine[k]]) + _, color_list_fine = self.extract_position_list_and_color_list_from_table_checkboxes_fine() - indice_test = np.argmax(np.abs([stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - - stg.time_fine[position_list_fine[k]]])) - print("indice test ", indice_test) - print(np.where(np.abs([stg.time_cross_section[ - self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - - stg.time_fine[position_list_fine[k]]]) == - np.nanmin(np.abs(stg.time_cross_section[ - self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - - stg.time_fine[position_list_fine[k]])))) - indices_bottom_fine.append(np.where(np.abs([stg.time_cross_section[ - self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - - stg.time_fine[position_list_fine[k]]]) == - np.nanmin(np.abs(stg.time_cross_section[ - self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - - stg.time_fine[position_list_fine[k]])))[0][0]) - depth_bottom_to_plot_fine.append( - stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_fine[-1]]) + (Ctot_fine_to_plot, Ctot_fine_percent_to_plot, sample_depth_to_plot_fine, indices_bottom_fine, + depth_bottom_to_plot_fine) = self.read_select_samples_fine() - print("depth_bottom_to_plot_fine ", depth_bottom_to_plot_fine) - print("indices_bottom_fine ", indices_bottom_fine) - - elif stg.time_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): - - indices_bottom_fine.append(np.where( - np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_fine[position_list_fine[k]]) == - np.nanmin( - np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_fine[position_list_fine[k]])))[ - 0][0]) - depth_bottom_to_plot_fine.append( - stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), -1]) - - else: - - indices_bottom_fine.append(np.where( - np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_fine[position_list_fine[k]]) == - np.nanmin( - np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_fine[position_list_fine[k]])))[ - 0][0]) - depth_bottom_to_plot_fine.append( - stg.depth[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), -1]) - - self.axis_total_concentration.cla() + # self.axis_total_concentration.cla() # --- Concentration (g/L) VS z (m) --- if (self.combobox_x_axis.currentIndex() == 0) and (self.combobox_y_axis.currentIndex() == 0): + self.axis_total_concentration.cla() self.axis_total_concentration.scatter(Ctot_fine_to_plot, sample_depth_to_plot_fine, s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) @@ -1768,6 +1960,7 @@ class SampleDataTab(QWidget): # --- Concentration (%) VS z (m) --- elif (self.combobox_x_axis.currentIndex() == 1) and (self.combobox_y_axis.currentIndex() == 0): + self.axis_total_concentration.cla() self.axis_total_concentration.scatter(Ctot_fine_percent_to_plot, sample_depth_to_plot_fine, s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) self.axis_total_concentration.set_xlim(0, 100) @@ -1776,7 +1969,7 @@ class SampleDataTab(QWidget): # --- Concentration (g/L) VS z / h --- elif (self.combobox_x_axis.currentIndex() == 0) and (self.combobox_y_axis.currentIndex() == 1): - + self.axis_total_concentration.cla() if stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,): self.axis_total_concentration.scatter( @@ -1793,32 +1986,13 @@ class SampleDataTab(QWidget): msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() - - # elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): - # - # self.axis_total_concentration.scatter( - # Ctot_fine_to_plot, - # [x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)], - # # stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - # # self.combobox_frequencies.currentIndex(), -1], - # s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) - # - # else: - # - # self.axis_total_concentration.scatter( - # Ctot_fine_to_plot, - # [x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)], - # # stg.depth[self.combobox_acoustic_data.currentIndex()][ - # # self.combobox_frequencies.currentIndex(), -1], - # s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) - self.axis_total_concentration.set_ylim(-1, 0) self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText()) self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText()) # --- Concentration (%) VS z / h --- elif (self.combobox_x_axis.currentIndex() == 1) and (self.combobox_y_axis.currentIndex() == 1): - + self.axis_total_concentration.cla() if stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,): self.axis_total_concentration.scatter( @@ -1835,24 +2009,6 @@ class SampleDataTab(QWidget): msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() - # elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): - # - # self.axis_total_concentration.scatter( - # Ctot_fine_percent_to_plot, - # [x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)], - # # stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - # # self.combobox_frequencies.currentIndex(), -1], - # s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) - # - # else: - # - # self.axis_total_concentration.scatter( - # Ctot_fine_percent_to_plot, - # [x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)], - # # stg.depth[self.combobox_acoustic_data.currentIndex()][ - # # self.combobox_frequencies.currentIndex(), -1], - # s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) - self.axis_total_concentration.set_xlim(0, 100) self.axis_total_concentration.set_ylim(-1, 0) self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText()) @@ -1860,74 +2016,22 @@ class SampleDataTab(QWidget): self.figure_total_concentration.canvas.draw_idle() + # =================================================== # --- FINE file NOT uploaded / SAND file uploaded --- elif not (self.lineEdit_fine_sediment.text()) and (self.lineEdit_sand_sediment.text()): self.compute_Ctot_per_cent() print("Ctot sand % ", stg.Ctot_sand_per_cent) - # --- Read selected sand samples (checkboxes) --- - position_list_sand, color_list_sand = self.extract_position_list_and_color_list_from_table_checkboxes_sand() - Ctot_sand_to_plot = [] - Ctot_sand_percent_to_plot = [] - sample_depth_to_plot_sand = [] - indices_bottom_sand = [] - depth_bottom_to_plot_sand = [] - for k in range(len(position_list_sand)): - Ctot_sand_to_plot.append(stg.Ctot_sand[position_list_sand[k]]) - Ctot_sand_percent_to_plot.append(stg.Ctot_sand_per_cent[position_list_sand[k]]) - sample_depth_to_plot_sand.append(stg.depth_sand[position_list_sand[k]]) - if stg.depth_bottom[self.combobox_acoustic_data.currentIndex()].shape != (0,): + _, color_list_sand = self.extract_position_list_and_color_list_from_table_checkboxes_sand() + (Ctot_sand_to_plot, Ctot_sand_percent_to_plot, sample_depth_to_plot_sand, indices_bottom_sand, + depth_bottom_to_plot_sand) = self.read_select_samples_sand() - indices_bottom_sand.append(np.where(np.abs( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[ - position_list_sand[k]]) == - np.nanmin(np.abs(stg.time_cross_section[ - self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - - stg.time_sand[k])))[0][0]) - depth_bottom_to_plot_sand.append( - stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_sand[-1]]) - - elif stg.time_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): - - print("The test 0 : ", np.where(np.abs( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex()] - stg.time_sand[ - position_list_sand[k]]) == - np.nanmin(np.abs(stg.time_cross_section[ - self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex()] - - stg.time_sand[k])))) - - indices_bottom_sand.append(np.where( - np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]]) == - np.nanmin( - np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]])))[ - 0][0]) - depth_bottom_to_plot_sand.append( - stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), -1]) - - else: - print("The test 1 : ", np.where( - np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]]) == - np.nanmin( - np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]])))) - - indices_bottom_sand.append(np.where( - np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]]) == - np.nanmin( - np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]])))[ - 0][0]) - depth_bottom_to_plot_sand.append( - stg.depth[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), -1]) - - - self.axis_total_concentration.cla() + # self.axis_total_concentration.cla() # --- Concentration (g/L) VS z (m) --- if (self.combobox_x_axis.currentIndex() == 0) and (self.combobox_y_axis.currentIndex() == 0): + self.axis_total_concentration.cla() print("Je suis dans 1") self.axis_total_concentration.scatter(Ctot_sand_to_plot, sample_depth_to_plot_sand, @@ -1938,6 +2042,7 @@ class SampleDataTab(QWidget): # --- Concentration (%) VS z (m) --- elif (self.combobox_x_axis.currentIndex() == 1) and (self.combobox_y_axis.currentIndex() == 0): + self.axis_total_concentration.cla() print("Je suis dans 2") print("Ctot_sand_percent_to_plot ", Ctot_sand_percent_to_plot) self.axis_total_concentration.scatter(Ctot_sand_percent_to_plot, sample_depth_to_plot_sand, @@ -1949,6 +2054,7 @@ class SampleDataTab(QWidget): # --- Concentration (g/L) VS z / h --- elif (self.combobox_x_axis.currentIndex() == 0) and (self.combobox_y_axis.currentIndex() == 1): + self.axis_total_concentration.cla() print("Je suis dans 3") if stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,): @@ -1967,30 +2073,13 @@ class SampleDataTab(QWidget): msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() - # elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): - # - # self.axis_total_concentration.scatter( - # Ctot_sand_to_plot, - # [x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)], - # # stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - # # self.combobox_frequencies.currentIndex(), -1], - # s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) - # - # else: - # - # self.axis_total_concentration.scatter( - # Ctot_sand_to_plot, - # [x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)], - # # stg.depth[self.combobox_acoustic_data.currentIndex()][ - # # self.combobox_frequencies.currentIndex(), -1], - # s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) - self.axis_total_concentration.set_ylim(-1, 0) self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText()) self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText()) # --- Concentration (%) VS z / h --- elif (self.combobox_x_axis.currentIndex() == 1) and (self.combobox_y_axis.currentIndex() == 1): + self.axis_total_concentration.cla() print("Je suis dans 4") if stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,): @@ -2009,24 +2098,6 @@ class SampleDataTab(QWidget): msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() - # elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): - # - # self.axis_total_concentration.scatter( - # Ctot_sand_percent_to_plot, - # [x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)], - # # stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - # # self.combobox_frequencies.currentIndex(), -1], - # s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) - # - # else: - # - # self.axis_total_concentration.scatter( - # Ctot_sand_percent_to_plot, - # [x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)], - # # stg.depth[self.combobox_acoustic_data.currentIndex()][ - # # self.combobox_frequencies.currentIndex(), -1], - # s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) - self.axis_total_concentration.set_xlim(0, 100) self.axis_total_concentration.set_ylim(-1, 0) self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText()) @@ -2034,137 +2105,23 @@ class SampleDataTab(QWidget): self.figure_total_concentration.canvas.draw_idle() + # =============================================== # --- FINE file uploaded / SAND file uploaded --- elif (self.lineEdit_fine_sediment.text()) and (self.lineEdit_sand_sediment.text()): self.compute_Ctot_per_cent() - # --- Read selected fine samples (checkboxes) --- - position_list_fine, color_list_fine = self.extract_position_list_and_color_list_from_table_checkboxes_fine() - Ctot_fine_to_plot = [] - Ctot_fine_percent_to_plot = [] - sample_depth_to_plot_fine = [] - indices_bottom_fine = [] - depth_bottom_to_plot_fine = [] - # print("time fine ", stg.time_fine) - for k in range(len(position_list_fine)): - # print("k = ", k, "type(k) = ", type(k)) - Ctot_fine_to_plot.append(stg.Ctot_fine[position_list_fine[k]]) - Ctot_fine_percent_to_plot.append(stg.Ctot_fine_per_cent[position_list_fine[k]]) - sample_depth_to_plot_fine.append(stg.depth_fine[position_list_fine[k]]) - if stg.depth_bottom[self.combobox_acoustic_data.currentIndex()].shape != (0,): - indices_bottom_fine.append(np.where(np.asarray(np.abs([stg.time_cross_section[ - self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - - stg.time_fine[position_list_fine[k]]])) == - np.nanmin(np.abs(stg.time_cross_section[ - self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - - stg.time_fine[position_list_fine[k]])))[0][0]) - print("indices_bottom_fine ", indices_bottom_fine) - depth_bottom_to_plot_fine.append( - stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_fine[-1]]) + _, color_list_fine = self.extract_position_list_and_color_list_from_table_checkboxes_fine() + (Ctot_fine_to_plot, Ctot_fine_percent_to_plot, sample_depth_to_plot_fine, indices_bottom_fine, + depth_bottom_to_plot_fine) = self.read_select_samples_fine() - elif stg.time_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): - - indices_bottom_fine.append(np.where(np.asarray(np.abs([stg.time_cross_section[ - self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex()] - - stg.time_fine[ - position_list_fine[k]]])) == - np.nanmin(np.abs(stg.time_cross_section[ - self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex()] - - stg.time_fine[position_list_fine[k]])))[0][ - 0]) - print() - depth_bottom_to_plot_fine.append( - stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), -1]) - - else: - - indices_bottom_fine.append(np.where( - np.asarray(np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - - stg.time_fine[k])) == - np.nanmin( - np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - - stg.time_fine[k])))[0][0]) - - depth_bottom_to_plot_fine.append( - stg.depth[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), - -1]) - - - - # print(stg.time_fine[k]) - # print(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()]) - # print(np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_fine[k])) - # print(np.nanmin(np.abs(np.asarray(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_fine[k])))) - # print(np.where(np.asarray(np.abs([stg.time_cross_section[ - # self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - - # stg.time_fine[k]])) == - # np.nanmin(np.abs(stg.time_cross_section[ - # self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - - # stg.time_fine[k])))) - # # plt.plot(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()], - # # (np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_fine[k]))) - # # plt.show() - # print("indices_bottom_fine ", indices_bottom_fine) - # print(stg.depth_bottom[self.combobox_acoustic_data.currentIndex()]) - # # depth_bottom_to_plot_fine.append(stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_fine[-1]]) - # print("depth_bottom_to_plot_fine ", depth_bottom_to_plot_fine) - - # --- Read selected sand samples (checkboxes) --- - position_list_sand, color_list_sand = self.extract_position_list_and_color_list_from_table_checkboxes_sand() - Ctot_sand_to_plot = [] - Ctot_sand_percent_to_plot = [] - sample_depth_to_plot_sand = [] - indices_bottom_sand = [] - depth_bottom_to_plot_sand = [] - for k in range(len(position_list_sand)): - Ctot_sand_to_plot.append(stg.Ctot_sand[position_list_sand[k]]) - Ctot_sand_percent_to_plot.append(stg.Ctot_sand_per_cent[position_list_sand[k]]) - sample_depth_to_plot_sand.append(stg.depth_sand[position_list_sand[k]]) - if stg.depth_bottom[self.combobox_acoustic_data.currentIndex()].shape != (0,): - indices_bottom_sand.append(np.where(np.abs( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - - stg.time_sand[ - position_list_sand[k]]) == np.nanmin(np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - - stg.time_sand[position_list_sand[k]])))[0][0]) - - depth_bottom_to_plot_sand.append(stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_sand[-1]]) - - elif stg.time_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): - - indices_bottom_sand.append(np.where(np.abs( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex()] - - stg.time_sand[ - position_list_sand[k]]) == np.nanmin(np.abs( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex()] - - stg.time_sand[position_list_sand[k]])))[0][0]) - - depth_bottom_to_plot_sand.append( - stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), -1]) - - else: - indices_bottom_sand.append(np.where( - np.abs( - stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]]) == - np.nanmin( - np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]])))[0][0]) - - depth_bottom_to_plot_sand.append( - stg.depth[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), - -1]) - - # print("indices_bottom_sand ", indices_bottom_sand) - # print("depth_bottom_to_plot_sand ", depth_bottom_to_plot_sand) - - self.axis_total_concentration.cla() + _, color_list_sand = self.extract_position_list_and_color_list_from_table_checkboxes_sand() + (Ctot_sand_to_plot, Ctot_sand_percent_to_plot, sample_depth_to_plot_sand, indices_bottom_sand, + depth_bottom_to_plot_sand) = self.read_select_samples_sand() # --- Concentration (g/L) VS z (m) --- if (self.combobox_x_axis.currentIndex() == 0) and (self.combobox_y_axis.currentIndex() == 0): - + self.axis_total_concentration.cla() self.axis_total_concentration.scatter(Ctot_fine_to_plot, sample_depth_to_plot_fine, s=100, facecolor=color_list_fine, edgecolor="None", @@ -2178,6 +2135,7 @@ class SampleDataTab(QWidget): # --- Concentration (%) VS z (m) --- elif (self.combobox_x_axis.currentIndex() == 1) and (self.combobox_y_axis.currentIndex() == 0): + self.axis_total_concentration.cla() print("Ctot_fine_percent_to_plot", Ctot_fine_percent_to_plot) print("sample_depth_to_plot_fine", sample_depth_to_plot_fine) self.axis_total_concentration.scatter(Ctot_fine_percent_to_plot, sample_depth_to_plot_fine, @@ -2192,7 +2150,7 @@ class SampleDataTab(QWidget): # --- Concentration (g/L) VS z / h --- elif (self.combobox_x_axis.currentIndex() == 0) and (self.combobox_y_axis.currentIndex() == 1): - + self.axis_total_concentration.cla() if stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,): print("x/y ", [x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)]) self.axis_total_concentration.scatter( @@ -2213,41 +2171,13 @@ class SampleDataTab(QWidget): msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() - # elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): - # - # self.axis_total_concentration.scatter( - # Ctot_fine_to_plot, - # stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - # self.combobox_frequencies.currentIndex(), -1], - # s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) - # - # self.axis_total_concentration.scatter( - # Ctot_sand_to_plot, - # stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - # self.combobox_frequencies.currentIndex(), -1], - # s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) - # - # else: - # - # self.axis_total_concentration.scatter( - # Ctot_fine_to_plot, - # stg.depth[self.combobox_acoustic_data.currentIndex()][ - # self.combobox_frequencies.currentIndex(), -1], - # s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) - # - # self.axis_total_concentration.scatter( - # Ctot_sand_to_plot, - # stg.depth[self.combobox_acoustic_data.currentIndex()][ - # self.combobox_frequencies.currentIndex(), -1], - # s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) - self.axis_total_concentration.set_ylim(-1, 0) self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText()) self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText()) # --- Concentration (%) VS z / h --- elif (self.combobox_x_axis.currentIndex() == 1) and (self.combobox_y_axis.currentIndex() == 1): - + self.axis_total_concentration.cla() if stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,): self.axis_total_concentration.scatter( @@ -2269,30 +2199,6 @@ class SampleDataTab(QWidget): msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() - # elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): - # - # self.axis_total_concentration.scatter( - # Ctot_fine_percent_to_plot, - # [x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)], - # s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) - # - # self.axis_total_concentration.scatter( - # Ctot_sand_percent_to_plot, - # [x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)], - # s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) - # - # else: - # - # self.axis_total_concentration.scatter( - # Ctot_fine_percent_to_plot, - # [x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)], - # s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) - # - # self.axis_total_concentration.scatter( - # Ctot_sand_percent_to_plot, - # [x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)], - # s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) - self.axis_total_concentration.set_xlim(0, 100) self.axis_total_concentration.set_ylim(-1, 0) self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())