diff --git a/View/about_window.py b/View/about_window.py index 06696f3..52b499e 100644 --- a/View/about_window.py +++ b/View/about_window.py @@ -4,7 +4,7 @@ from PyQt5.QtGui import QIcon, QPixmap from PyQt5.QtWidgets import (QWidget, QLabel, QHBoxLayout, QVBoxLayout, QApplication, QMainWindow, QGridLayout, QDialog, QDialogButtonBox, QPushButton, QTextEdit, QFrame) from PyQt5.QtCore import Qt -import datetime +from datetime import date from Translation.constant_string import HORIZONTAL @@ -41,7 +41,7 @@ class AboutWindow(QDialog): self.horizontalLayout.addLayout(self.verticalLayout_AcouSed_info) self.label_acoused = QLabel() - self.label_acoused.setText(f"Acoused 1.10 \n2024.09.23 \nby INRAE") + self.label_acoused.setText(f"Acoused 1.10 \n" + date.today().isoformat() + "\n by INRAE") self.verticalLayout_AcouSed_info.addWidget(self.label_acoused) # self.label_date = QLabel() diff --git a/View/acoustic_data_tab.py b/View/acoustic_data_tab.py index c6c1561..581725d 100644 --- a/View/acoustic_data_tab.py +++ b/View/acoustic_data_tab.py @@ -19,7 +19,7 @@ from matplotlib.colors import LogNorm, CSS4_COLORS, BoundaryNorm from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolBar -from os import path +from os import path, name from copy import deepcopy import locale locale.setlocale(locale.LC_ALL, '') @@ -85,7 +85,13 @@ class AcousticDataTab(QWidget): # Utiliser os.path.split() OU os.path.join() - self.path_icon = "./icons/" + if name == 'posix': + self.path_icon = "./icons/" + print("os.name = ", self.path_icon) + else: + self.path_icon = r".\\icons\\" + print("os.name = ", self.path_icon) + self.icon_folder = QIcon(self.path_icon + "folder.png") self.icon_apply_limits = QIcon(self.path_icon + "circle_green_arrow_right.png") self.icon_triangle_left_to_begin = QIcon(self.path_icon + "triangle_left_to_begin.png") @@ -1495,27 +1501,27 @@ class AcousticDataTab(QWidget): self.label_hour_acoustic_file.show() self.gridLayout_goupbox_info.addWidget(self.label_hour_acoustic_file, 1, 1, 1, 1) - self.label_freq.show() - self.gridLayout_goupbox_info.addWidget(self.label_freq, 2, 0, 1, 1) - self.combobox_frequency_information.show() - self.gridLayout_goupbox_info.addWidget(self.combobox_frequency_information, 2, 1, 1, 1) - - self.label_kt.show() - self.gridLayout_goupbox_info.addWidget(self.label_kt, 3, 0, 1, 1) - self.spinbox_kt.show() - self.gridLayout_goupbox_info.addWidget(self.spinbox_kt, 3, 1, 1, 1) - self.checkbox_kt.show() - self.gridLayout_goupbox_info.addWidget(self.checkbox_kt, 3, 2, 1, 1) - self.label_temperature.show() - self.gridLayout_goupbox_info.addWidget(self.label_temperature, 4, 0, 1, 1) + self.gridLayout_goupbox_info.addWidget(self.label_temperature, 2, 0, 1, 1) self.spinbox_temperature.show() - self.gridLayout_goupbox_info.addWidget(self.spinbox_temperature, 4, 1, 1, 1) + self.gridLayout_goupbox_info.addWidget(self.spinbox_temperature, 2, 1, 1, 1) self.label_speed_of_sound.show() - self.gridLayout_goupbox_info.addWidget(self.label_speed_of_sound, 5, 0, 1, 1) + self.gridLayout_goupbox_info.addWidget(self.label_speed_of_sound, 3, 0, 1, 1) self.spinbox_speed_of_sound.show() - self.gridLayout_goupbox_info.addWidget(self.spinbox_speed_of_sound, 5, 1, 1, 1) + self.gridLayout_goupbox_info.addWidget(self.spinbox_speed_of_sound, 3, 1, 1, 1) + + self.label_freq.show() + self.gridLayout_goupbox_info.addWidget(self.label_freq, 4, 0, 1, 1) + self.combobox_frequency_information.show() + self.gridLayout_goupbox_info.addWidget(self.combobox_frequency_information, 4, 1, 1, 1) + + self.label_kt.show() + self.gridLayout_goupbox_info.addWidget(self.label_kt, 5, 0, 1, 1) + self.spinbox_kt.show() + self.gridLayout_goupbox_info.addWidget(self.spinbox_kt, 5, 1, 1, 1) + self.checkbox_kt.show() + self.gridLayout_goupbox_info.addWidget(self.checkbox_kt, 5, 2, 1, 1) self.label_sound_attenuation.show() self.gridLayout_goupbox_info.addWidget(self.label_sound_attenuation, 6, 0, 1, 1) @@ -1607,27 +1613,27 @@ class AcousticDataTab(QWidget): self.label_hour_acoustic_file.show() self.gridLayout_goupbox_info.addWidget(self.label_hour_acoustic_file, 1, 1, 1, 1) - self.label_freq.show() - self.gridLayout_goupbox_info.addWidget(self.label_freq, 2, 0, 1, 1) - self.combobox_frequency_information.show() - self.gridLayout_goupbox_info.addWidget(self.combobox_frequency_information, 2, 1, 1, 1) - - self.label_kt.show() - self.gridLayout_goupbox_info.addWidget(self.label_kt, 3, 0, 1, 1) - self.spinbox_kt.show() - self.gridLayout_goupbox_info.addWidget(self.spinbox_kt, 3, 1, 1, 1) - self.checkbox_kt.show() - self.gridLayout_goupbox_info.addWidget(self.checkbox_kt, 3, 2, 1, 1) - self.label_temperature.show() - self.gridLayout_goupbox_info.addWidget(self.label_temperature, 4, 0, 1, 1) + self.gridLayout_goupbox_info.addWidget(self.label_temperature, 2, 0, 1, 1) self.spinbox_temperature.show() - self.gridLayout_goupbox_info.addWidget(self.spinbox_temperature, 4, 1, 1, 1) + self.gridLayout_goupbox_info.addWidget(self.spinbox_temperature, 2, 1, 1, 1) self.label_speed_of_sound.show() - self.gridLayout_goupbox_info.addWidget(self.label_speed_of_sound, 5, 0, 1, 1) + self.gridLayout_goupbox_info.addWidget(self.label_speed_of_sound, 3, 0, 1, 1) self.spinbox_speed_of_sound.show() - self.gridLayout_goupbox_info.addWidget(self.spinbox_speed_of_sound, 5, 1, 1, 1) + self.gridLayout_goupbox_info.addWidget(self.spinbox_speed_of_sound, 3, 1, 1, 1) + + self.label_freq.show() + self.gridLayout_goupbox_info.addWidget(self.label_freq, 4, 0, 1, 1) + self.combobox_frequency_information.show() + self.gridLayout_goupbox_info.addWidget(self.combobox_frequency_information, 4, 1, 1, 1) + + self.label_kt.show() + self.gridLayout_goupbox_info.addWidget(self.label_kt, 5, 0, 1, 1) + self.spinbox_kt.show() + self.gridLayout_goupbox_info.addWidget(self.spinbox_kt, 5, 1, 1, 1) + self.checkbox_kt.show() + self.gridLayout_goupbox_info.addWidget(self.checkbox_kt, 5, 2, 1, 1) self.label_sound_attenuation.show() self.gridLayout_goupbox_info.addWidget(self.label_sound_attenuation, 6, 0, 1, 1) diff --git a/View/acoustic_inversion_tab.py b/View/acoustic_inversion_tab.py index 7849302..9c599fa 100644 --- a/View/acoustic_inversion_tab.py +++ b/View/acoustic_inversion_tab.py @@ -364,7 +364,7 @@ class AcousticInversionTab(QWidget): self.combobox_acoustic_data_choice.clear() # self.combobox_fileListWidget.addItem("") for i in range(len(stg.filename_BS_raw_data)): - self.combobox_acoustic_data_choice.addItem(stg.filename_BS_raw_data[i]) + self.combobox_acoustic_data_choice.addItem(stg.data_preprocessed[i]) self.combobox_acoustic_data_choice.currentIndexChanged.connect(self.combobox_acoustic_data_choice_currentIndexChanged) diff --git a/View/sample_data_tab.py b/View/sample_data_tab.py index 64ebc22..8b92cfa 100644 --- a/View/sample_data_tab.py +++ b/View/sample_data_tab.py @@ -213,7 +213,7 @@ class SampleDataTab(QWidget): self.groupbox_plot_total_concentration.setTitle("Plot total concentration") self.canvas_plot_total_concentration = FigureCanvas() - 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) @@ -225,7 +225,7 @@ class SampleDataTab(QWidget): self.groupbox_plot_PSD.setTitle("Plot particle size distribution") self.canvas_plot_PSD = FigureCanvas() - self.toolbar_plot_PSD = NavigationToolBar(self.canvas_plot_PSD) + self.toolbar_plot_PSD = NavigationToolBar(self.canvas_plot_PSD, self) self.verticalLayout_groupbox_plot_PSD.addWidget(self.toolbar_plot_PSD) self.verticalLayout_groupbox_plot_PSD.addWidget(self.canvas_plot_PSD) @@ -1147,6 +1147,30 @@ class SampleDataTab(QWidget): 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,): + + x_time = stg.time_cross_section[self.combobox_acoustic_data.currentIndex()] + y_depth = stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()] + + 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[self.combobox_acoustic_data.currentIndex()] + + else: + + if stg.depth_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()] + + elif stg.depth[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + x_time = stg.time[self.combobox_acoustic_data.currentIndex()] + y_depth = stg.depth[self.combobox_acoustic_data.currentIndex()] + if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()].shape != (0,): val_min = np.nanmin(stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()][ @@ -1157,17 +1181,14 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], - -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + 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)) self.axis_plot_sample_position_on_transect.plot( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + x_time[self.combobox_frequencies.currentIndex(), :], -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], color='black', linewidth=1, linestyle="solid") @@ -1181,17 +1202,14 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], - -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + 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)) self.axis_plot_sample_position_on_transect.plot( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + x_time[self.combobox_frequencies.currentIndex(), :], -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], color='black', linewidth=1, linestyle="solid") @@ -1203,13 +1221,13 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], - -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], + 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.plot( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], + 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_pre_process_average[self.combobox_acoustic_data.currentIndex()].shape != (0,): @@ -1224,10 +1242,8 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], - -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + 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)) @@ -1244,10 +1260,8 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], - -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + 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)) @@ -1262,8 +1276,8 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], - -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], + 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)) @@ -1277,8 +1291,8 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], - -stg.depth[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], + 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)) @@ -1293,8 +1307,8 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], - -stg.depth[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], + 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)) @@ -1307,8 +1321,8 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], - -stg.depth[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], + 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)) @@ -1320,6 +1334,30 @@ class SampleDataTab(QWidget): self.axis_plot_sample_position_on_transect.cla() + if stg.time_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + if stg.depth_cross_section[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()] + + 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[self.combobox_acoustic_data.currentIndex()] + + else: + + if stg.depth_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()] + + elif stg.depth[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + x_time = stg.time[self.combobox_acoustic_data.currentIndex()] + y_depth = stg.depth[self.combobox_acoustic_data.currentIndex()] + # --- Create canvas of Matplotlib figure --- if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()].shape != (0,): @@ -1333,17 +1371,14 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], - -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + 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)) self.axis_plot_sample_position_on_transect.plot( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + x_time[self.combobox_frequencies.currentIndex(), :], -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], color='black', linewidth=1, linestyle="solid") @@ -1359,17 +1394,14 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], - -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + 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)) self.axis_plot_sample_position_on_transect.plot( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + x_time[self.combobox_frequencies.currentIndex(), :], -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], color='black', linewidth=1, linestyle="solid") @@ -1381,13 +1413,13 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], - -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], + 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.plot( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], + x_time[self.combobox_frequencies.currentIndex(), :], -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], color='black', linewidth=1, linestyle="solid") @@ -1405,10 +1437,8 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], - -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + 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(), :, :], @@ -1428,10 +1458,8 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], - -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + 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(), :, :], @@ -1449,10 +1477,8 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], - -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + 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)) @@ -1471,10 +1497,8 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], - -stg.depth[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + 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(), :, :], @@ -1494,10 +1518,8 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], - -stg.depth[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + 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(), :, :], @@ -1517,10 +1539,8 @@ class SampleDataTab(QWidget): val_min = 1e-5 self.axis_plot_sample_position_on_transect.pcolormesh( - stg.time[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], - -stg.depth[self.combobox_acoustic_data.currentIndex()][ - self.combobox_frequencies.currentIndex(), :], + 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(), :, :], @@ -1658,11 +1678,20 @@ class SampleDataTab(QWidget): else: self.verticalLayout_groupbox_plot_total_concentration.removeWidget(self.canvas_plot_total_concentration) + self.verticalLayout_groupbox_plot_total_concentration.removeWidget(self.toolbar_plot_total_concentration) + 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.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()): @@ -2415,9 +2444,14 @@ class SampleDataTab(QWidget): else: self.verticalLayout_groupbox_plot_PSD.removeWidget(self.canvas_plot_PSD) + self.verticalLayout_groupbox_plot_PSD.removeWidget(self.toolbar_plot_PSD) + self.figure_plot_PSD, self.axis_plot_PSD \ = plt.subplots(nrows=1, ncols=2, layout="constrained") self.canvas_plot_PSD = FigureCanvas(self.figure_plot_PSD) + self.toolbar_plot_PSD = NavigationToolBar(self.canvas_plot_PSD, self) + + self.verticalLayout_groupbox_plot_PSD.addWidget(self.toolbar_plot_PSD) self.verticalLayout_groupbox_plot_PSD.addWidget(self.canvas_plot_PSD) # --- FINE file uploaded / SAND file NOT uploaded --- diff --git a/View/sediment_calibration_tab.py b/View/sediment_calibration_tab.py index 87484da..cd145c2 100644 --- a/View/sediment_calibration_tab.py +++ b/View/sediment_calibration_tab.py @@ -492,7 +492,7 @@ class SedimentCalibrationTab(QWidget): def update_acoustic_data(self): self.combobox_acoustic_data_choice.clear() - self.combobox_acoustic_data_choice.addItems(stg.filename_BS_raw_data) + self.combobox_acoustic_data_choice.addItems(stg.data_preprocessed) self.combobox_acoustic_data_choice.currentIndexChanged.connect(self.plot_acoustic_recording) self.combobox_freq1.clear() @@ -1137,9 +1137,31 @@ class SedimentCalibrationTab(QWidget): # --- Fill spinboxes of calibration parameter --- self.label_freq1.clear() self.label_freq1.setText(data.columns[0]) + print(stg.freq_text) + print(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) + print(data.columns[0]) + print("index freq1 ", np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) == data.columns[0])) + index_freq1 = np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) == + data.columns[0])[0][0] + stg.frequencies_for_calibration.clear() + stg.frequencies_for_calibration.append((stg.freq[self.combobox_acoustic_data_choice.currentIndex()][ + index_freq1], + index_freq1)) self.label_freq2.clear() self.label_freq2.setText(data.columns[1]) + print("index freq2 ", + np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) == data.columns[1])) + index_freq2 = np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) == + data.columns[1])[0][0] + # stg.frequencies_for_calibration.clear() + stg.frequencies_for_calibration.append((stg.freq[self.combobox_acoustic_data_choice.currentIndex()][ + index_freq2], + index_freq2)) + + stg.frequency_for_inversion = tuple() + stg.frequency_for_inversion = (stg.freq[self.combobox_acoustic_data_choice.currentIndex()][index_freq2], + index_freq2) self.spinbox_ks_freq1.clear() self.spinbox_ks_freq1.setValue(float(data.iloc[0][0])) @@ -1147,27 +1169,46 @@ class SedimentCalibrationTab(QWidget): self.spinbox_ks_freq2.clear() self.spinbox_ks_freq2.setValue(float(data.iloc[0][1])) + stg.ks.clear() + stg.ks = [self.spinbox_ks_freq1.value(), self.spinbox_ks_freq2.value()] + self.spinbox_sv_freq1.clear() self.spinbox_sv_freq1.setValue(float(data.iloc[1][0])) self.spinbox_sv_freq2.clear() self.spinbox_sv_freq2.setValue(float(data.iloc[1][1])) + stg.sv.clear() + stg.sv = [self.spinbox_sv_freq1.value(), self.spinbox_sv_freq2.value()] + self.spinbox_X.clear() self.spinbox_X.setValue(float(data.iloc[2][0])) + stg.X_exponent.clear() + stg.X_exponent.append(self.spinbox_X.value()) + self.spinbox_alphas_freq1.clear() self.spinbox_alphas_freq1.setValue(float(data.iloc[3][0])) self.spinbox_alphas_freq2.clear() self.spinbox_alphas_freq2.setValue(float(data.iloc[3][1])) + stg.alpha_s.clear() + stg.alpha_s = [self.spinbox_alphas_freq1.value(), self.spinbox_alphas_freq2.value()] + self.spinbox_zeta_freq1.clear() self.spinbox_zeta_freq1.setValue(float(data.iloc[4][0])) self.spinbox_zeta_freq2.clear() self.spinbox_zeta_freq2.setValue(float(data.iloc[4][1])) + stg.zeta.clear() + stg.zeta = [self.spinbox_zeta_freq1.value(), self.spinbox_zeta_freq2.value()] + + self.compute_depth_2D() + self.compute_kt2D_kt3D() + self.compute_J_cross_section() + def compute_depth_2D(self): print("self.combobox_acoustic_data_choice.count() ", self.combobox_acoustic_data_choice.count()) if self.combobox_acoustic_data_choice.count() > 0: @@ -1242,12 +1283,14 @@ class SedimentCalibrationTab(QWidget): def function_pushbutton_compute_calibration(self): - # --- Compute frequency --- - # self.label_freq1.clear() - # self.label_freq1.setText(str(self.combobox_freq1.currentText())) - # - # self.label_freq2.clear() - # self.label_freq2.setText(str(self.combobox_freq2.currentText())) + self.compute_ks() + self.compute_sv() + self.compute_X() + self.compute_J_cross_section() + self.compute_alpha_s() + self.compute_zeta() + + def compute_ks(self): # --- Compute ks --- psd_number_of_particles = ( @@ -1277,9 +1320,11 @@ class SedimentCalibrationTab(QWidget): self.spinbox_ks_freq2.clear() self.spinbox_ks_freq2.setValue(ks_freq2) + def compute_sv(self): + # --- Compute sv --- - sv_freq1 = self.inv_hc.sv(ks=ks_freq1, M_sand=stg.Ctot_sand[stg.sand_sample_target[0][1]]) - sv_freq2 = self.inv_hc.sv(ks=ks_freq2, M_sand=stg.Ctot_sand[stg.sand_sample_target[0][1]]) + sv_freq1 = self.inv_hc.sv(ks=stg.ks[0], M_sand=stg.Ctot_sand[stg.sand_sample_target[0][1]]) + sv_freq2 = self.inv_hc.sv(ks=stg.ks[1], M_sand=stg.Ctot_sand[stg.sand_sample_target[0][1]]) stg.sv = [sv_freq1, sv_freq2] @@ -1292,10 +1337,12 @@ class SedimentCalibrationTab(QWidget): self.spinbox_sv_freq2.clear() self.spinbox_sv_freq2.setValue(sv_freq2) + def compute_X(self): + # --- Compute exponent X --- X_exponent = self.inv_hc.X_exponent(freq1=stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex()], freq2=stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex()], - sv_freq1=sv_freq1, sv_freq2=sv_freq2) + sv_freq1=stg.sv[0], sv_freq2=stg.sv[1]) stg.X_exponent.clear() stg.X_exponent.append(X_exponent) @@ -1305,6 +1352,8 @@ class SedimentCalibrationTab(QWidget): self.spinbox_X.clear() self.spinbox_X.setValue(X_exponent) + def compute_kt2D_kt3D(self): + # --- Compute kt2D, kt3D and depth_2D --- if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): @@ -1498,38 +1547,44 @@ class SedimentCalibrationTab(QWidget): print("kt3D shape ", kt3D.shape) print("kt3D ", kt3D) + return kt2D, kt3D + + def compute_J_cross_section(self): + + kt2D, kt3D = self.compute_kt2D_kt3D() + # --- Compute J --- if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): J_cross_section_freq1 = self.inv_hc.j_cross_section( BS=stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq1.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(), + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], :, :], - kt=kt3D[self.combobox_freq1.currentIndex(), :, :]) + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) J_cross_section_freq2 = self.inv_hc.j_cross_section( BS=stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq2.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], :, :], - kt=kt3D[self.combobox_freq2.currentIndex(), :, :]) + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): J_cross_section_freq1 = self.inv_hc.j_cross_section( BS=stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq1.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(), + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], :, :], - kt=kt3D[self.combobox_freq1.currentIndex(), :, :]) + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) J_cross_section_freq2 = self.inv_hc.j_cross_section( BS=stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq2.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], :, :], - kt=kt3D[self.combobox_freq2.currentIndex(), :, :]) + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): @@ -1565,47 +1620,47 @@ class SedimentCalibrationTab(QWidget): # print("kt3D ", kt3D) J_cross_section_freq1 = self.inv_hc.j_cross_section( - BS=stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(), :, :], - kt=kt3D[self.combobox_freq1.currentIndex(), :, :]) + BS=stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) J_cross_section_freq2 = self.inv_hc.j_cross_section( BS=stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq2.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :, :], - kt=kt3D[self.combobox_freq2.currentIndex(), :, :]) + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) elif stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): J_cross_section_freq1 = self.inv_hc.j_cross_section( BS=stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq1.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(), + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], :, :], - kt=kt3D[self.combobox_freq1.currentIndex(), :, :]) + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) J_cross_section_freq2 = self.inv_hc.j_cross_section( BS=stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq2.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], :, :], - kt=kt3D[self.combobox_freq2.currentIndex(), :, :]) + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): J_cross_section_freq1 = self.inv_hc.j_cross_section( BS=stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq1.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(), + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], :, :], - kt=kt3D[self.combobox_freq1.currentIndex(), :, :]) + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) J_cross_section_freq2 = self.inv_hc.j_cross_section( BS=stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq2.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], :, :], - kt=kt3D[self.combobox_freq2.currentIndex(), :, :]) + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): @@ -1632,43 +1687,43 @@ class SedimentCalibrationTab(QWidget): J_cross_section_freq1 = self.inv_hc.j_cross_section( BS=stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq1.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex(), :, :][self.combobox_freq1.currentIndex(), :, :], - kt=kt3D[self.combobox_freq1.currentIndex(), :, :]) + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex(), :, :][stg.frequencies_for_calibration[0][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) J_cross_section_freq2 = self.inv_hc.j_cross_section( BS=stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq2.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex(), :, :][self.combobox_freq2.currentIndex(), :, :], - kt=kt3D[self.combobox_freq2.currentIndex(), :, :]) + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex(), :, :][stg.frequencies_for_calibration[1][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): J_cross_section_freq1 = self.inv_hc.j_cross_section( BS=stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq1.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(), :, :], - kt=kt3D[self.combobox_freq1.currentIndex(), :, :]) + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) J_cross_section_freq2 = self.inv_hc.j_cross_section( BS=stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq2.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :, :], - kt=kt3D[self.combobox_freq2.currentIndex(), :, :]) + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): J_cross_section_freq1 = self.inv_hc.j_cross_section( BS=stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq1.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(), :, :], - kt=kt3D[self.combobox_freq1.currentIndex(), :, :]) + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) J_cross_section_freq2 = self.inv_hc.j_cross_section( BS=stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq2.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :, :], - kt=kt3D[self.combobox_freq2.currentIndex(), :, :]) + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) elif stg.BS_raw_data: @@ -1695,15 +1750,15 @@ class SedimentCalibrationTab(QWidget): J_cross_section_freq1 = self.inv_hc.j_cross_section( BS=stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq1.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(), :, :], - kt=kt3D[self.combobox_freq1.currentIndex(), :, :]) + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) J_cross_section_freq2 = self.inv_hc.j_cross_section( BS=stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq2.currentIndex(), :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :, :], - kt=kt3D[self.combobox_freq2.currentIndex(), :, :]) + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) stg.J_cross_section.append(J_cross_section_freq1) stg.J_cross_section.append(J_cross_section_freq2) @@ -1711,12 +1766,14 @@ class SedimentCalibrationTab(QWidget): print("J_cross_section_freq1.shape ", J_cross_section_freq1.shape) print("J_cross_section_freq2.shape ", J_cross_section_freq2.shape) + def compute_alpha_s(self): + # --- Compute alpha_s --- if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): alpha_s_freq1 = self.inv_hc.alpha_s( - sv=sv_freq1, - j_cross_section=J_cross_section_freq1[stg.sand_sample_target_indice[0][0], + sv=stg.sv[0], + j_cross_section=stg.J_cross_section[0][stg.sand_sample_target_indice[0][0], stg.sand_sample_target_indice[0][1]], depth=stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_freq1.currentIndex(), stg.sand_sample_target_indice[0][0]], @@ -1724,8 +1781,8 @@ class SedimentCalibrationTab(QWidget): self.combobox_freq1.currentIndex()]) alpha_s_freq2 = self.inv_hc.alpha_s( - sv=sv_freq2, - j_cross_section=J_cross_section_freq2[stg.sand_sample_target_indice[1][0], + sv=stg.sv[1], + j_cross_section=stg.J_cross_section[1][stg.sand_sample_target_indice[1][0], stg.sand_sample_target_indice[1][1]], depth=stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_freq2.currentIndex(), stg.sand_sample_target_indice[1][0]], @@ -1735,8 +1792,8 @@ class SedimentCalibrationTab(QWidget): else: alpha_s_freq1 = self.inv_hc.alpha_s( - sv=sv_freq1, - j_cross_section=J_cross_section_freq1[stg.sand_sample_target_indice[0][0], + sv=stg.sv[0], + j_cross_section=stg.J_cross_section[0][stg.sand_sample_target_indice[0][0], stg.sand_sample_target_indice[0][1]], depth=stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_freq1.currentIndex(), stg.sand_sample_target_indice[0][0]], @@ -1744,8 +1801,8 @@ class SedimentCalibrationTab(QWidget): self.combobox_freq1.currentIndex()]) alpha_s_freq2 = self.inv_hc.alpha_s( - sv=sv_freq2, - j_cross_section=J_cross_section_freq2[stg.sand_sample_target_indice[1][0], + sv=stg.sv[1], + j_cross_section=stg.J_cross_section[1][stg.sand_sample_target_indice[1][0], stg.sand_sample_target_indice[1][1]], depth=stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_freq2.currentIndex(), stg.sand_sample_target_indice[1][0]], @@ -1781,6 +1838,7 @@ class SedimentCalibrationTab(QWidget): msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() + def compute_zeta(self): # --- Compute zeta --- if len(stg.M_profile_fine) == 0: @@ -1796,21 +1854,21 @@ class SedimentCalibrationTab(QWidget): if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - zeta_freq1 = self.inv_hc.zeta(alpha_s=alpha_s_freq1, + zeta_freq1 = self.inv_hc.zeta(alpha_s=stg.alpha_s[0], r=stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_freq1.currentIndex(), :], M_profile_fine=stg.M_profile_fine) - zeta_freq2 = self.inv_hc.zeta(alpha_s=alpha_s_freq2, + zeta_freq2 = self.inv_hc.zeta(alpha_s=stg.alpha_s[1], r=stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_freq2.currentIndex(), :], M_profile_fine=stg.M_profile_fine) else: - zeta_freq1 = self.inv_hc.zeta(alpha_s=alpha_s_freq1, + zeta_freq1 = self.inv_hc.zeta(alpha_s=stg.alpha_s[0], r=stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_freq1.currentIndex(), :], M_profile_fine=stg.M_profile_fine) - zeta_freq2 = self.inv_hc.zeta(alpha_s=alpha_s_freq2, + zeta_freq2 = self.inv_hc.zeta(alpha_s=stg.alpha_s[1], r=stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_freq2.currentIndex(), :], M_profile_fine=stg.M_profile_fine) diff --git a/View/signal_processing_tab.py b/View/signal_processing_tab.py index ea26d4c..4d36bb3 100644 --- a/View/signal_processing_tab.py +++ b/View/signal_processing_tab.py @@ -1680,14 +1680,18 @@ class SignalProcessingTab(QWidget): stg.noise_value[self.combobox_fileListWidget.currentIndex()] = self.spinbox_compute_noise_from_value.value() - stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()] = ( - np.full(stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()].shape, - self.spinbox_compute_noise_from_value.value())) + # stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()] = ( + # np.full(stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()].shape, + # self.spinbox_compute_noise_from_value.value())) # --- Compute noise from value and compute SNR --- if stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()].shape != (0,): + stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()] = ( + np.full(stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()].shape, + self.spinbox_compute_noise_from_value.value())) + stg.BS_noise_averaged_data[self.combobox_fileListWidget.currentIndex()] = ( stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()][:, :, :stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()].shape[2]]) @@ -1701,6 +1705,10 @@ class SignalProcessingTab(QWidget): elif stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()] = ( + np.full(stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()].shape, + self.spinbox_compute_noise_from_value.value())) + stg.BS_noise_averaged_data[self.combobox_fileListWidget.currentIndex()] = ( stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()][:, :, :stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()].shape[2]]) @@ -1714,6 +1722,10 @@ class SignalProcessingTab(QWidget): else: + stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()] = ( + np.full(stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()].shape, + self.spinbox_compute_noise_from_value.value())) + stg.BS_noise_averaged_data[self.combobox_fileListWidget.currentIndex()] = ( stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()]) stg.SNR_raw_data[self.combobox_fileListWidget.currentIndex()] = ( @@ -1757,6 +1769,10 @@ class SignalProcessingTab(QWidget): # stg.SNR_stream_bed = np.divide((stg.BS_stream_bed - stg.BS_noise_raw_data) ** 2, # stg.BS_noise_raw_data ** 2) + self.combobox_frequency_profile.clear() + self.combobox_frequency_profile.addItems( + [f for f in stg.freq_text[self.combobox_fileListWidget.currentIndex()]]) + # --- Trigger graphic widgets --- if stg.SNR_filter_value[self.combobox_fileListWidget.currentIndex()] == 0: @@ -1867,8 +1883,33 @@ class SignalProcessingTab(QWidget): if stg.SNR_stream_bed[self.combobox_fileListWidget.currentIndex()].shape != (0,): - x, y = np.meshgrid(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][0, :], - stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][0, :]) + if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x, y = np.meshgrid( + stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], + stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][f, :]) + + elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x, y = np.meshgrid( + stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], + stg.depth[self.combobox_fileListWidget.currentIndex()][f, :]) + + else: + + if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x, y = np.meshgrid( + stg.time[self.combobox_fileListWidget.currentIndex()][f, :], + stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][f, :]) + + elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x, y = np.meshgrid( + stg.time[self.combobox_fileListWidget.currentIndex()][f, :], + stg.depth[self.combobox_fileListWidget.currentIndex()][f, :]) print("0 plot SNR with SNR_stream_bed") val_min = np.nanmin(stg.SNR_stream_bed[self.combobox_fileListWidget.currentIndex()][f, :, :]) @@ -1894,8 +1935,33 @@ class SignalProcessingTab(QWidget): elif stg.SNR_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): - x, y = np.meshgrid(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][0, :], - stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][0, :]) + if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x, y = np.meshgrid( + stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], + stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][f, :]) + + elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x, y = np.meshgrid( + stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], + stg.depth[self.combobox_fileListWidget.currentIndex()][f, :]) + + else: + + if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x, y = np.meshgrid( + stg.time[self.combobox_fileListWidget.currentIndex()][f, :], + stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][f, :]) + + elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x, y = np.meshgrid( + stg.time[self.combobox_fileListWidget.currentIndex()][f, :], + stg.depth[self.combobox_fileListWidget.currentIndex()][f, :]) print("1 plot SNR with SNR_cross_section") val_min = np.nanmin(stg.SNR_cross_section[self.combobox_fileListWidget.currentIndex()][f, :, :]) @@ -2103,6 +2169,31 @@ class SignalProcessingTab(QWidget): self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.addWidget(self.toolbar_BS) self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.addWidget(self.scroll_BS) + if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x_time = stg.time_cross_section[self.combobox_fileListWidget.currentIndex()] + y_depth = stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()] + + elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x_time = stg.time_cross_section[self.combobox_fileListWidget.currentIndex()] + y_depth = stg.depth[self.combobox_fileListWidget.currentIndex()] + + else: + + if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x_time = stg.time[self.combobox_fileListWidget.currentIndex()] + y_depth = stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()] + + elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x_time = stg.time[self.combobox_fileListWidget.currentIndex()] + y_depth = stg.depth[self.combobox_fileListWidget.currentIndex()] + + for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): if stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): @@ -2113,13 +2204,11 @@ class SignalProcessingTab(QWidget): if val_min == 0: val_min = 1e-5 - pcm = self.axis_BS[f].pcolormesh(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], + pcm = self.axis_BS[f].pcolormesh(x_time[f, :], -y_depth[f, :], stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - self.axis_BS[f].plot(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], - -stg.depth_bottom[self.combobox_fileListWidget.currentIndex()], + self.axis_BS[f].plot(x_time[f, :], -stg.depth_bottom[self.combobox_fileListWidget.currentIndex()], color='black', linewidth=1, linestyle="solid") elif stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): @@ -2133,8 +2222,7 @@ class SignalProcessingTab(QWidget): val_min = 1e-5 pcm = self.axis_BS[f].pcolormesh( - stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], + x_time[f, :], -y_depth[f, :], stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) @@ -2148,8 +2236,7 @@ class SignalProcessingTab(QWidget): if val_min == 0: val_min = 1e-5 - pcm = self.axis_BS[f].pcolormesh(stg.time[self.combobox_fileListWidget.currentIndex()][f, :], - -stg.depth[self.combobox_fileListWidget.currentIndex()][f, :], + pcm = self.axis_BS[f].pcolormesh(x_time[f, :], -y_depth[f, :], stg.BS_raw_data_pre_process_average[ self.combobox_fileListWidget.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) @@ -2162,12 +2249,11 @@ class SignalProcessingTab(QWidget): if val_min == 0: val_min = 1e-5 - pcm = self.axis_BS[f].pcolormesh(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], + pcm = self.axis_BS[f].pcolormesh(x_time[f, :], -y_depth[f, :], stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - self.axis_BS[f].plot(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], + self.axis_BS[f].plot(x_time[f, :], -stg.depth_bottom[self.combobox_fileListWidget.currentIndex()], color='black', linewidth=1, linestyle="solid") @@ -2182,8 +2268,7 @@ class SignalProcessingTab(QWidget): val_min = 1e-5 pcm = self.axis_BS[f].pcolormesh( - stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], + x_time[f, :], -y_depth[f, :], stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) @@ -2197,8 +2282,7 @@ class SignalProcessingTab(QWidget): if val_min == 0: val_min = 1e-5 - pcm = self.axis_BS[f].pcolormesh(stg.time[self.combobox_fileListWidget.currentIndex()][f, :], - -stg.depth[self.combobox_fileListWidget.currentIndex()][f, :], + pcm = self.axis_BS[f].pcolormesh(x_time[f, :], -y_depth[f, :], stg.BS_raw_data_pre_process_SNR[ self.combobox_fileListWidget.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) @@ -2213,8 +2297,7 @@ class SignalProcessingTab(QWidget): if val_min == 0: val_min = 1e-5 - pcm = self.axis_BS[f].pcolormesh(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], + pcm = self.axis_BS[f].pcolormesh(x_time[f, :], -y_depth[f, :], stg.BS_stream_bed[ self.combobox_fileListWidget.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) @@ -2229,8 +2312,7 @@ class SignalProcessingTab(QWidget): if val_min == 0: val_min = 1e-5 - pcm = self.axis_BS[f].pcolormesh(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], + pcm = self.axis_BS[f].pcolormesh(x_time[f, :], -y_depth[f, :], stg.BS_cross_section[ self.combobox_fileListWidget.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) @@ -2245,8 +2327,7 @@ class SignalProcessingTab(QWidget): if val_min == 0: val_min = 1e-5 - pcm = self.axis_BS[f].pcolormesh(stg.time[self.combobox_fileListWidget.currentIndex()][f, :], - -stg.depth[self.combobox_fileListWidget.currentIndex()][f, :], + pcm = self.axis_BS[f].pcolormesh(x_time[f, :], -y_depth[f, :], stg.BS_raw_data[ self.combobox_fileListWidget.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) @@ -2257,50 +2338,57 @@ class SignalProcessingTab(QWidget): transform=self.axis_BS[f].transAxes) # --- Display red line on acoustic recording for profile position --- - # print("current freq profile ", self.combobox_frequency_profile.currentIndex()) - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): - if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + self.red_line_return, = self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( + x_time[self.combobox_frequency_profile.currentIndex(), self.slider.value() - 1] * + np.ones(y_depth.shape[1]), + -y_depth[self.combobox_frequency_profile.currentIndex(), :], + linestyle="solid", linewidth=2, color="red") - self.red_line_return, = self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( - stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][ - self.combobox_frequency_profile.currentIndex(), self.slider.value() - 1] * - np.ones(stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape[1]), - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ - self.combobox_frequency_profile.currentIndex(), :], - linestyle="solid", linewidth=2, color="red") - - elif stg.time[self.combobox_fileListWidget.currentIndex()].shape != (0,): - - self.red_line_return, = self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( - stg.time[self.combobox_fileListWidget.currentIndex()][ - self.combobox_frequency_profile.currentIndex(), self.slider.value() - 1] * - np.ones(stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape[1]), - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ - self.combobox_frequency_profile.currentIndex(), :], - linestyle="solid", linewidth=2, color="red") - - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): - - if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): - - self.red_line_return, = self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( - stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][ - self.combobox_frequency_profile.currentIndex(), self.slider.value() - 1] * - np.ones(stg.depth[self.combobox_fileListWidget.currentIndex()].shape[1]), - -stg.depth[self.combobox_fileListWidget.currentIndex()][ - self.combobox_frequency_profile.currentIndex(), :], - linestyle="solid", linewidth=2, color="red") - - elif stg.time[self.combobox_fileListWidget.currentIndex()].shape != (0,): - - self.red_line_return, = self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( - stg.time[self.combobox_fileListWidget.currentIndex()][ - self.combobox_frequency_profile.currentIndex(), self.slider.value() - 1] * - np.ones(stg.depth[self.combobox_fileListWidget.currentIndex()].shape[1]), - -stg.depth[self.combobox_fileListWidget.currentIndex()][ - self.combobox_frequency_profile.currentIndex(), :], - linestyle="solid", linewidth=2, color="red") + # # print("current freq profile ", self.combobox_frequency_profile.currentIndex()) + # if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # + # if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # + # self.red_line_return, = self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( + # stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][ + # self.combobox_frequency_profile.currentIndex(), self.slider.value() - 1] * + # np.ones(stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape[1]), + # -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + # self.combobox_frequency_profile.currentIndex(), :], + # linestyle="solid", linewidth=2, color="red") + # + # elif stg.time[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # + # self.red_line_return, = self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( + # stg.time[self.combobox_fileListWidget.currentIndex()][ + # self.combobox_frequency_profile.currentIndex(), self.slider.value() - 1] * + # np.ones(stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape[1]), + # -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + # self.combobox_frequency_profile.currentIndex(), :], + # linestyle="solid", linewidth=2, color="red") + # + # elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # + # if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # + # self.red_line_return, = self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( + # stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][ + # self.combobox_frequency_profile.currentIndex(), self.slider.value() - 1] * + # np.ones(stg.depth[self.combobox_fileListWidget.currentIndex()].shape[1]), + # -stg.depth[self.combobox_fileListWidget.currentIndex()][ + # self.combobox_frequency_profile.currentIndex(), :], + # linestyle="solid", linewidth=2, color="red") + # + # elif stg.time[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # + # self.red_line_return, = self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( + # stg.time[self.combobox_fileListWidget.currentIndex()][ + # self.combobox_frequency_profile.currentIndex(), self.slider.value() - 1] * + # np.ones(stg.depth[self.combobox_fileListWidget.currentIndex()].shape[1]), + # -stg.depth[self.combobox_fileListWidget.currentIndex()][ + # self.combobox_frequency_profile.currentIndex(), :], + # linestyle="solid", linewidth=2, color="red") self.fig_BS.supxlabel('Time (sec)', fontsize=10) self.fig_BS.supylabel('Depth (m)', fontsize=10) @@ -2341,13 +2429,37 @@ class SignalProcessingTab(QWidget): stg.Nb_cells_to_average_BS_signal[self.combobox_fileListWidget.currentIndex()] = ( self.spinbox_average_horizontal.value()) + if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x_time = stg.time_cross_section[self.combobox_fileListWidget.currentIndex()] + y_depth = stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()] + + elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x_time = stg.time_cross_section[self.combobox_fileListWidget.currentIndex()] + y_depth = stg.depth[self.combobox_fileListWidget.currentIndex()] + + else: + + if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x_time = stg.time[self.combobox_fileListWidget.currentIndex()] + y_depth = stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()] + + elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + + x_time = stg.time[self.combobox_fileListWidget.currentIndex()] + y_depth = stg.depth[self.combobox_fileListWidget.currentIndex()] + if stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape != (0,): stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()] = (deepcopy( stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()])) for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - for i in range(stg.depth[self.combobox_fileListWidget.currentIndex()].shape[1]): + for i in range(y_depth.shape[1]): # stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, i,:] = ( # convolve1d(stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ # f, i, :], weights=kernel_avg) / len(kernel_avg)) @@ -2363,7 +2475,7 @@ class SignalProcessingTab(QWidget): stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()])) for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - for i in range(stg.depth[self.combobox_fileListWidget.currentIndex()].shape[1]): + for i in range(y_depth.shape[1]): # stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, i, :] = ( # convolve1d(stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ # f, i, :], weights=kernel_avg) / len(kernel_avg)) @@ -2379,7 +2491,7 @@ class SignalProcessingTab(QWidget): stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()])) for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - for i in range(stg.depth[self.combobox_fileListWidget.currentIndex()].shape[1]): + for i in range(y_depth.shape[1]): # stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, i, :] = ( # convolve1d(stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ # f, i, :], weights=kernel_avg) / len(kernel_avg)) @@ -2395,7 +2507,7 @@ class SignalProcessingTab(QWidget): stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()])) for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - for i in range(stg.depth[self.combobox_fileListWidget.currentIndex()].shape[1]): + for i in range(y_depth.shape[1]): # stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, i, :] = ( # convolve1d(stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()][ # f, i, :], weights=kernel_avg) / len(kernel_avg)) @@ -2410,7 +2522,7 @@ class SignalProcessingTab(QWidget): stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()])) for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - for i in range(stg.depth[self.combobox_fileListWidget.currentIndex()].shape[1]): + for i in range(y_depth.shape[1]): # stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, i, :] = ( # convolve1d(stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()][ # f, i, :], weights=kernel_avg) / len(kernel_avg)) @@ -2426,7 +2538,7 @@ class SignalProcessingTab(QWidget): stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()])) for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - for i in range(stg.depth[self.combobox_fileListWidget.currentIndex()].shape[1]): + for i in range(y_depth.shape[1]): # stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, i, :] = ( # convolve1d(stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()][ # f, i, :], weights=kernel_avg) / len(kernel_avg))