diff --git a/View/signal_processing_tab.py b/View/signal_processing_tab.py index 79e229c..bb6697e 100644 --- a/View/signal_processing_tab.py +++ b/View/signal_processing_tab.py @@ -4,7 +4,7 @@ from PyQt5.QtWidgets import (QWidget, QHBoxLayout, QVBoxLayout, QPushButton, QGr QSpinBox, QDoubleSpinBox, QComboBox, QLineEdit, QSlider, QGridLayout, QMessageBox, QScrollArea, QRadioButton, QFileDialog, QSpacerItem, QSizePolicy, QTextEdit, QPlainTextEdit) from PyQt5.QtGui import QFont, QIcon, QPixmap, QSyntaxHighlighter, QTextCharFormat -from PyQt5.QtCore import Qt, QCoreApplication, QEvent, pyqtSignal +from PyQt5.QtCore import Qt, QCoreApplication, QEvent, pyqtSignal, QPropertyAnimation, QSize import numpy as np from copy import deepcopy @@ -73,9 +73,21 @@ class SignalProcessingTab(QWidget): self.icon_triangle_right_to_end = QIcon(self.path_icon + "triangle_right_to_end.png") self.icon_update = QIcon(self.path_icon + "update.png") self.icon_clear = QIcon(self.path_icon + "clear.png") + self.icon_apply = QIcon(self.path_icon + "circle_green_arrow_right.png") ### --- General layout of widgets --- + # |-----------------| |------------| |-----------------| + # | Data to be | | Plot SNR | | Pre-processing | + # | pre-processed | |------------| | options | + # |-----------------| |-----------------| + # |------------------------------------------------------------------------| + # |-----------------------| |-----------------------| |------------------| + # | Plot pre-processed | | Plot pre-processed | | Pre-processed | + # | data 2D field | | data profile | | data list | + # |-----------------------| |-----------------------| |------------------| + # |------------------------------------------------------------------------| + self.verticalLayoutMain = QVBoxLayout(widget_tab) self.horizontalLayout_Top = QHBoxLayout() @@ -88,117 +100,135 @@ class SignalProcessingTab(QWidget): ### --- Layout of groupbox in the top layout box self.groupbox_study_data = QGroupBox() - self.horizontalLayout_Top.addWidget(self.groupbox_study_data, 2) + self.horizontalLayout_Top.addWidget(self.groupbox_study_data, 3) self.groupbox_plot_SNR = QGroupBox() - self.horizontalLayout_Top.addWidget(self.groupbox_plot_SNR, 4) + self.horizontalLayout_Top.addWidget(self.groupbox_plot_SNR, 5) self.groupbox_pre_processing_option = QGroupBox() - self.horizontalLayout_Top.addWidget(self.groupbox_pre_processing_option, 4) + self.horizontalLayout_Top.addWidget(self.groupbox_pre_processing_option, 2) - # self.groupbox_plot_BS_signal_filtered_with_SNR = QGroupBox() - # self.horizontalLayout_Top.addWidget(self.groupbox_plot_BS_signal_filtered_with_SNR, 4) + # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + # +++ --- Download data to be processed + Download noise file + compute noise data from profile tail + --- +++ + # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - # +++ --- Download noise file + compute noise data from profile tail + --- +++ - # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + self.groupbox_study_data.setTitle("Study data") + ### --- Groupbox download data to be processed --- self.verticalLayout_groupbox_study_data = QVBoxLayout(self.groupbox_study_data) + self.horizontalLayout_groupbox_data_to_be_processed_Pushbutton_plot_clear_noise = QHBoxLayout() + self.verticalLayout_groupbox_study_data.addLayout(self.horizontalLayout_groupbox_data_to_be_processed_Pushbutton_plot_clear_noise) + self.groupbox_data_to_be_processed = QGroupBox() - self.horizontalLayout_groupbox_data_to_be_processed = QHBoxLayout(self.groupbox_data_to_be_processed) + self.gridLayout_groupbox_data_to_be_processed = QGridLayout(self.groupbox_data_to_be_processed) self.groupbox_data_to_be_processed.setTitle("Data to be processed") - # self.textEdit_acoustic_file_to_be_processed = QTextEdit() - # self.verticalLayout_groupbox_data_to_be_processed.addWidget(self.textEdit_acoustic_file_to_be_processed) - - self.combobox_fileListWidget = ComboBoxShowPopUpWindow() - self.horizontalLayout_groupbox_data_to_be_processed.addWidget(self.combobox_fileListWidget) + self.combobox_acoustic_data_choice = QComboBox() + self.combobox_acoustic_data_choice.setMinimumWidth(200) + self.gridLayout_groupbox_data_to_be_processed.addWidget(self.combobox_acoustic_data_choice, 0, 0, 1, 1, Qt.AlignCenter) self.pushbutton_update = QPushButton() self.pushbutton_update.setIcon(self.icon_update) - self.pushbutton_update.setMaximumWidth(40) - self.horizontalLayout_groupbox_data_to_be_processed.addWidget(self.pushbutton_update) + # self.pushbutton_update.setMaximumWidth(50) + self.gridLayout_groupbox_data_to_be_processed.addWidget(self.pushbutton_update, 0, 1, 1, 1, Qt.AlignCenter) - self.verticalLayout_groupbox_study_data.addWidget(self.groupbox_data_to_be_processed) + self.horizontalLayout_groupbox_data_to_be_processed_Pushbutton_plot_clear_noise.addWidget( + self.groupbox_data_to_be_processed) - ### --- Radio button : File VS Profile tail VS Value --- + self.pushbutton_plot_noise_data = QPushButton() + self.pushbutton_plot_noise_data.setText("Plot noise field") + self.horizontalLayout_groupbox_data_to_be_processed_Pushbutton_plot_clear_noise.addWidget( + self.pushbutton_plot_noise_data) - self.gridLayout_radiobutton_noise_data = QGridLayout() - self.verticalLayout_groupbox_study_data.addLayout(self.gridLayout_radiobutton_noise_data) - - self.radiobutton_file = QRadioButton("File") - self.radiobutton_file.setChecked(True) - self.gridLayout_radiobutton_noise_data.addWidget(self.radiobutton_file, 0, 0, 1, 1) - - self.radiobutton_profile_tail = QRadioButton("Profile tail") - # self.radiobutton_file.setChecked(False) - self.gridLayout_radiobutton_noise_data.addWidget(self.radiobutton_profile_tail, 0, 1, 1, 1) - - self.radiobutton_value = QRadioButton("Value") - self.gridLayout_radiobutton_noise_data.addWidget(self.radiobutton_value, 0, 2, 1, 1) - - self.pushbutton_clear_noise = QPushButton() - self.pushbutton_clear_noise.setIcon(self.icon_clear) - self.pushbutton_clear_noise.setMaximumWidth(50) - self.gridLayout_radiobutton_noise_data.addWidget(self.pushbutton_clear_noise, 0, 3, 1, 1) + self.pushbutton_clear_noise_data = QPushButton() + self.pushbutton_clear_noise_data.setIcon(self.icon_clear) + self.horizontalLayout_groupbox_data_to_be_processed_Pushbutton_plot_clear_noise.addWidget( + self.pushbutton_clear_noise_data) ### --- Groupbox download noise file --- self.groupbox_download_noise_file = QGroupBox() - self.groupbox_download_noise_file.setVisible(True) + self.groupbox_download_noise_file.setTitle("Noise file") + self.groupbox_download_noise_file.setCheckable(True) + self.groupbox_download_noise_file.setChecked(True) self.gridLayout_groupbox_noise_file = QGridLayout(self.groupbox_download_noise_file) + self.verticalLayout_groupbox_study_data.addWidget(self.groupbox_download_noise_file) self.pushbutton_noise_file = QPushButton() - self.pushbutton_noise_file.setObjectName("pushbutton_noise_file") self.pushbutton_noise_file.setIcon(self.icon_folder) - self.gridLayout_groupbox_noise_file.addWidget(self.pushbutton_noise_file, 0, 0, 1, 1) + self.gridLayout_groupbox_noise_file.addWidget(self.pushbutton_noise_file, 0, 0, 1, 1, Qt.AlignCenter) self.lineEdit_noise_file = QLineEdit() - self.gridLayout_groupbox_noise_file.addWidget(self.lineEdit_noise_file, 0, 1, 1, 1) - - self.pushbutton_plot_noise_file = QPushButton() - self.pushbutton_plot_noise_file.setText("Plot noise field") - self.gridLayout_groupbox_noise_file.addWidget(self.pushbutton_plot_noise_file, 1, 0, 1, 2) - - # self.label_date_groupbox_noise_file = QLabel() - # self.gridLayout_groupbox_noise_file.addWidget(self.label_date_groupbox_noise_file, 1, 0, 1, 2) - # self.label_hour_groupbox_noise_file = QLabel() - # self.gridLayout_groupbox_noise_file.addWidget(self.label_hour_groupbox_noise_file, 1, 2, 1, 1) - - # Download Push Button event : connect button clicked signal to open file slot - - self.verticalLayout_groupbox_study_data.addWidget(self.groupbox_download_noise_file) + # self.lineEdit_noise_file.setMaximumWidth(1000) + self.gridLayout_groupbox_noise_file.addWidget(self.lineEdit_noise_file, 0, 1, 1, 2, Qt.AlignLeft) ### --- Groupbox compute noise from profile tail --- self.groupbox_compute_noise_from_profile_tail = QGroupBox() - self.groupbox_compute_noise_from_profile_tail.setVisible(False) + self.groupbox_compute_noise_from_profile_tail.setTitle("Profile tail") + self.groupbox_compute_noise_from_profile_tail.setCheckable(True) + self.groupbox_compute_noise_from_profile_tail.setChecked(False) self.verticalLayout_groupbox_study_data.addWidget(self.groupbox_compute_noise_from_profile_tail) - ### --- Groupbox compute noise from value --- + self.horizontalLayout_groupbox_compute_noise_from_profile_tail = QHBoxLayout(self.groupbox_compute_noise_from_profile_tail) - self.groupbox_compute_noise_from_value = QGroupBox() - self.groupbox_compute_noise_from_value.setVisible(False) + self.groupbox_plot_profile_tail = QGroupBox() + self.horizontalLayout_groupbox_compute_noise_from_profile_tail.addWidget(self.groupbox_plot_profile_tail) - self.gridLayout_compute_noise_from_value = QGridLayout(self.groupbox_compute_noise_from_value) - self.label_noise_value = QLabel() - self.label_noise_value.setText("Value : ") - self.gridLayout_compute_noise_from_value.addWidget(self.label_noise_value, 0, 0, 1, 1) - self.spinbox_compute_noise_from_value = QDoubleSpinBox() - self.spinbox_compute_noise_from_value.setDecimals(6) - self.gridLayout_compute_noise_from_value.addWidget(self.spinbox_compute_noise_from_value, 0, 1, 1, 1) - self.label_Volts = QLabel("Volts") - self.gridLayout_compute_noise_from_value.addWidget(self.label_Volts, 0, 2, 1, 1) - self.pushbutton_compute_noise_from_value = QPushButton() - self.pushbutton_compute_noise_from_value.setText("Apply noise") - self.gridLayout_compute_noise_from_value.addWidget(self.pushbutton_compute_noise_from_value, 0, 3, 1, 1) + self.verticalLayout_groupbox_plot_profile_tail = QVBoxLayout(self.groupbox_plot_profile_tail) + self.canvas_profile_tail = FigureCanvas() + self.verticalLayout_groupbox_plot_profile_tail.addWidget(self.canvas_profile_tail) + self.horizontalLayout_groupbox_compute_noise_from_profile_tail.addWidget(self.groupbox_plot_profile_tail) - self.pushbutton_plot_noise_value = QPushButton() - self.pushbutton_plot_noise_value.setText("Plot noise field") - self.gridLayout_compute_noise_from_value.addWidget(self.pushbutton_plot_noise_value, 1, 0, 1, 4) + self.groupbox_option_profile_tail = QGroupBox() + # self.groupbox_option_profile_tail.setCheckable(True) + # self.groupbox_option_profile_tail.setChecked(False) + self.horizontalLayout_groupbox_compute_noise_from_profile_tail.addWidget(self.groupbox_option_profile_tail) - self.verticalLayout_groupbox_study_data.addWidget(self.groupbox_compute_noise_from_value) + self.gridLayout_groupbox_option_profile_tail = QGridLayout(self.groupbox_option_profile_tail) + + self.combobox_freq_noise_from_profile_tail = QComboBox() + self.gridLayout_groupbox_option_profile_tail.addWidget(self.combobox_freq_noise_from_profile_tail, 0, 0, 1, 2, Qt.AlignCenter) + + self.lineEdit_val1 = QLineEdit() + self.lineEdit_val1.setText("0.00") + self.gridLayout_groupbox_option_profile_tail.addWidget(self.lineEdit_val1, 1, 0, 1, 1, Qt.AlignCenter) + + self.lineEdit_val2 = QLineEdit() + self.lineEdit_val2.setText("0.00") + self.gridLayout_groupbox_option_profile_tail.addWidget(self.lineEdit_val2, 1, 1, 1, 1, Qt.AlignCenter) + + self.pushbutton_plot_profile_tail = QPushButton() + # self.pushbutton_plot_profile_tail.setText("Profile tail") + self.pushbutton_plot_profile_tail.setIcon(self.icon_apply) + self.gridLayout_groupbox_option_profile_tail.addWidget(self.pushbutton_plot_profile_tail, 1, 2, 1, 1, Qt.AlignCenter) + + self.lineEdit_profile_tail_value = QLineEdit() + self.lineEdit_profile_tail_value.setText("0.0000") + self.gridLayout_groupbox_option_profile_tail.addWidget(self.lineEdit_profile_tail_value, 2, 0, 1, 1, Qt.AlignCenter) + + self.label_Volts = QLabel() + self.label_Volts.setText("Volts") + self.gridLayout_groupbox_option_profile_tail.addWidget(self.label_Volts, 2, 1, 1, 1, Qt.AlignLeft) + + self.pushbutton_apply_noise_from_profile_tail = QPushButton() + self.pushbutton_apply_noise_from_profile_tail.setIcon(self.icon_apply) + self.gridLayout_groupbox_option_profile_tail.addWidget(self.pushbutton_apply_noise_from_profile_tail, 2, 2, 1, 1, Qt.AlignCenter) + + # --- Push button Plot/Clear noise data --- + # self.gridLayout_pushbutton_noise_data = QGridLayout() + # self.verticalLayout_groupbox_study_data.addLayout(self.gridLayout_pushbutton_noise_data) + # + # self.pushbutton_plot_noise_data = QPushButton() + # self.pushbutton_plot_noise_data.setText("Plot noise field") + # self.gridLayout_pushbutton_noise_data.addWidget(self.pushbutton_plot_noise_data, 0, 0, 1, 1, Qt.AlignCenter) + # + # self.pushbutton_clear_noise_data = QPushButton() + # self.pushbutton_clear_noise_data.setIcon(self.icon_clear) + # # self.pushbutton_clear_noise_data.setMaximumWidth(50) + # self.gridLayout_pushbutton_noise_data.addWidget(self.pushbutton_clear_noise_data, 0, 1, 1, 1, Qt.AlignCenter) + # self.verticalLayout_groupbox_study_data.addWidget(self.groupbox_compute_noise_from_value) ### --- Push button plot noise --- @@ -206,40 +236,13 @@ class SignalProcessingTab(QWidget): # self.pushbutton_plot_noise.setText("Plot noise") # self.verticalLayout_groupbox_study_data.addWidget(self.pushbutton_plot_noise) - # +++++++++++++++++++++++++++++ - # +++ --- Plot SNR data --- +++ - # +++++++++++++++++++++++++++++ + # ++++++++++++++++++++++++ + # +++ --- Plot SNR --- +++ + # ++++++++++++++++++++++++ - # self.verticalLayout_groupbox_plot_Noise_SNR = QVBoxLayout(self.groupbox_plot_Noise_SNR) - - ### --- Groupbox plot noise data --- - - # self.groupbox_plot_noise_data = QGroupBox() - # self.horizontalLayout_groupbox_plot_noise_data = QHBoxLayout(self.groupbox_plot_noise_data) - # - # self.combobox_freq_noise = QComboBox() - # self.horizontalLayout_groupbox_plot_noise_data.addWidget(self.combobox_freq_noise) - # - # self.spacerItem_frequency_noise = QSpacerItem(10, 10, QSizePolicy.Expanding, QSizePolicy.Minimum) - # self.horizontalLayout_groupbox_plot_noise_data.addItem(self.spacerItem_frequency_noise) - # - # self.canvas_noise = None - # - # self.verticalLayout_groupbox_plot_Noise_SNR.addWidget(self.groupbox_plot_noise_data, 3) - - ### --- Groupbox plot SNR --- - - # self.groupbox_plot_SNR = QGroupBox() self.groupbox_plot_SNR.setTitle("Plot SNR") self.verticalLayout_groupbox_plot_SNR = QVBoxLayout(self.groupbox_plot_SNR) - # self.pushbutton_plot_SNR = QPushButton() - # self.verticalLayout_groupbox_plot_Noise_SNR.addWidget(self.pushbutton_plot_SNR) - # self.pushbutton_plot_SNR.clicked.connect(self.plot_transect_with_SNR_data) - - # self.canvas_SNR = None - # self.scroll_SNR = None - self.canvas_SNR = FigureCanvas() self.toolbar_SNR = NavigationToolBar(self.canvas_SNR, self) self.verticalLayout_groupbox_plot_SNR.addWidget(self.toolbar_SNR) @@ -251,12 +254,11 @@ class SignalProcessingTab(QWidget): self.scroll_SNR.setAlignment(Qt.AlignCenter) self.verticalLayout_groupbox_plot_SNR.addWidget(self.scroll_SNR) - # self.verticalLayout_groupbox_plot_SNR.addWidget(self.groupbox_plot_SNR, 7) - # +++++++++++++++++++++++++++++++++++++ # +++ --- Pre-processing option --- +++ # +++++++++++++++++++++++++++++++++++++ + self.groupbox_pre_processing_option.setTitle("Pre-processing options") self.verticalLayout_groupbox_pre_processing_option = QVBoxLayout(self.groupbox_pre_processing_option) ### --- Groupbox SNR criterion --- @@ -266,16 +268,22 @@ class SignalProcessingTab(QWidget): self.gridLayout_SNR_criterion = QGridLayout(self.groupbox_SNR_criterion) self.label_SNR_criterion = QLabel("SNR < ") - self.gridLayout_SNR_criterion.addWidget(self.label_SNR_criterion, 0, 0, 1, 1) - self.spinbox_SNR_criterion = QSpinBox() - self.gridLayout_SNR_criterion.addWidget(self.spinbox_SNR_criterion, 0, 1, 1, 1) + self.gridLayout_SNR_criterion.addWidget(self.label_SNR_criterion, 0, 0, 1, 1, Qt.AlignCenter) + self.lineEdit_SNR_criterion = QLineEdit() + self.lineEdit_SNR_criterion.setMaximumWidth(60) + self.gridLayout_SNR_criterion.addWidget(self.lineEdit_SNR_criterion, 0, 1, 1, 1, Qt.AlignCenter) self.pushbutton_Apply_SNR_filter = QPushButton() - self.gridLayout_SNR_criterion.addWidget(self.pushbutton_Apply_SNR_filter, 0, 2, 1, 1) + # self.pushbutton_Apply_SNR_filter.setText("Apply SNR") + self.pushbutton_Apply_SNR_filter.setIcon(self.icon_apply) + self.gridLayout_SNR_criterion.addWidget(self.pushbutton_Apply_SNR_filter, 0, 2, 1, 1, Qt.AlignCenter) self.verticalLayout_groupbox_pre_processing_option.addWidget(self.groupbox_SNR_criterion) # --- Rayleigh criterion groupbox --- self.groupbox_Rayleigh_criterion = QGroupBox() + + self.groupbox_Rayleigh_criterion.setTitle("Despiking the signal") + self.groupbox_Rayleigh_criterion.setDisabled(True) self.gridLayout_Rayleigh_criterion = QGridLayout(self.groupbox_Rayleigh_criterion) self.label_Rayleigh_criterion = QLabel() @@ -299,54 +307,40 @@ class SignalProcessingTab(QWidget): # --- Average signal groupbox --- self.groupbox_window_size = QGroupBox() + + self.groupbox_window_size.setTitle("Horizontal averaging") self.gridLayout_groupbox_window_size = QGridLayout(self.groupbox_window_size) self.label_signal_averaging_horizontal = QLabel() self.label_signal_averaging_horizontal.setText("Horizontal +/- ") # self.horizontalLayout_groupbox_window_size.addWidget(self.label_signal_averaging_over) - self.gridLayout_groupbox_window_size.addWidget(self.label_signal_averaging_horizontal, 0, 0, 1, 1) - self.spinbox_average_horizontal = QSpinBox() - self.spinbox_average_horizontal.setRange(0, 9999) - self.spinbox_average_horizontal.setValue(0) + self.gridLayout_groupbox_window_size.addWidget(self.label_signal_averaging_horizontal, 0, 0, 1, 1, Qt.AlignCenter) + # self.spinbox_average_horizontal = QSpinBox() + # self.spinbox_average_horizontal.setRange(0, 9999) + # self.spinbox_average_horizontal.setValue(0) + self.lineEdit_horizontal_average = QLineEdit() + self.lineEdit_horizontal_average.setText("0.00") + self.lineEdit_horizontal_average.setMaximumWidth(60) # self.horizontalLayout_groupbox_window_size.addWidget(self.spinbox_average) - self.gridLayout_groupbox_window_size.addWidget(self.spinbox_average_horizontal, 0, 1, 1, 1) + self.gridLayout_groupbox_window_size.addWidget(self.lineEdit_horizontal_average, 0, 1, 1, 1, Qt.AlignCenter) + # self.lineEdit_horizontal_average = QLineEdit() + # self.lineEdit_horizontal_average.setMaximumWidth(60) + # self.gridLayout_groupbox_window_size.addWidget(self.lineEdit_horizontal_average, 0, 1, 1, 1, Qt.AlignCenter) self.label_cells_horizontal = QLabel() self.label_cells_horizontal.setText("cells = +/- ? sec") # self.horizontalLayout_groupbox_window_size.addWidget(self.label_cells) - self.gridLayout_groupbox_window_size.addWidget(self.label_cells_horizontal, 0, 2, 1, 1) + self.gridLayout_groupbox_window_size.addWidget(self.label_cells_horizontal, 0, 2, 1, 1, Qt.AlignCenter) self.pushbutton_average = QPushButton() - self.pushbutton_average.setText("Apply averaging") - self.gridLayout_groupbox_window_size.addWidget(self.pushbutton_average, 0, 3, 1, 1) + # self.pushbutton_average.setText("Apply averaging") + self.pushbutton_average.setIcon(self.icon_apply) + self.gridLayout_groupbox_window_size.addWidget(self.pushbutton_average, 0, 3, 1, 1, Qt.AlignCenter) self.verticalLayout_groupbox_pre_processing_option.addWidget(self.groupbox_window_size) # # ++++++++++++++++++++++++++++++++++++++++++++++ # # +++ --- Plot BS data filtered with SNR --- +++ # # ++++++++++++++++++++++++++++++++++++++++++++++ - # - # self.groupbox_plot_BS_signal_filtered_with_SNR.setTitle("Plot SNR Filter for recording of acoustic backscatter") - # self.verticalLayout_groupbox_plot_BS_field = QVBoxLayout(self.groupbox_plot_BS_signal_filtered_with_SNR) - # - # # self.verticalLayout_groupbox_plot_BS_field.addWidget(self.groupbox_SNR_criterion, 2) - # - # ### --- Groupbox plot BS signal filtered with SNR criterion --- - # # self.groupbox_BS_SNR_filter = QGroupBox() - # # self.verticalLayout_groupbox_BS_SNR_filter = QVBoxLayout(self.groupbox_BS_SNR_filter) - # - # # self.canvas_BS = None - # # self.scroll_BS = None - # - # self.canvas_BS = FigureCanvas() - # - # self.scroll_BS = QScrollArea() - # self.scroll_BS.setWidget(self.canvas_BS) - # self.scroll_BS.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) - # self.scroll_BS.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) - # self.scroll_BS.setAlignment(Qt.AlignCenter) - # self.verticalLayout_groupbox_plot_BS_field.addWidget(self.scroll_BS) - # - # # self.verticalLayout_groupbox_plot_BS_field.addWidget(self.groupbox_BS_SNR_filter, 8) # -------------------------------------------------------------------------------------------------------------- ### --- Layout of groupbox in the bottom layout box @@ -367,19 +361,11 @@ class SignalProcessingTab(QWidget): # +++ --- Plot pre-processed data 2D field --- +++ # ++++++++++++++++++++++++++++++++++++++++++++++++ + self.groupbox_plot_pre_processed_data_2D_field.setTitle("Display pre-processed data 2D fields") + self.verticalLayout_groupbox_plot_pre_processed_data_2D_field = QVBoxLayout( self.groupbox_plot_pre_processed_data_2D_field) - # self.horizontalLayout_label_profile_number_combobox_frequency_profile = QHBoxLayout() - # self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.addLayout(self.horizontalLayout_label_profile_number_combobox_frequency_profile) - # self.label_profile_number = QLabel() - # self.label_profile_number.setText("Profile ") - # self.horizontalLayout_label_profile_number_combobox_frequency_profile.addWidget(self.label_profile_number) - # self.spacerItem_frequency_profile = QSpacerItem(50, 10, QSizePolicy.Expanding, QSizePolicy.Minimum) - # self.horizontalLayout_label_profile_number_combobox_frequency_profile.addSpacerItem(self.spacerItem_frequency_profile) - # self.combobox_frequency_profile = QComboBox() - # self.horizontalLayout_label_profile_number_combobox_frequency_profile.addWidget(self.combobox_frequency_profile) - self.canvas_BS = FigureCanvas() self.toolbar_BS = NavigationToolBar(self.canvas_BS, self) @@ -397,6 +383,8 @@ class SignalProcessingTab(QWidget): # +++ --- Plot pre-processed data profile --- +++ # +++++++++++++++++++++++++++++++++++++++++++++++ + self.groupbox_plot_pre_processed_data_profile.setTitle("Display pre-processed data profile") + self.verticalLayout_groupbox_plot_pre_processed_data_2D_profile = QVBoxLayout( self.groupbox_plot_pre_processed_data_profile) @@ -420,23 +408,6 @@ class SignalProcessingTab(QWidget): self.verticalLayout_groupbox_plot_pre_processed_data_2D_profile.addWidget(self.groupbox_plot_profile) - # --- Figure to plot profiles and BS signal 2D field below--- - # self.verticalLayout_groupbox_plot_pre_processed_data.removeWidget(self.canvas_profile) - - # self.figure_profile, self.axis_profile = plt.subplots(nrows=2, ncols=1)#, gridspec_kw={'width_ratios': [2, 1], - # # 'height_ratios': [3, 1]}) - # self.canvas_profile = FigureCanvas(self.figure_profile) - - # self.scroll_profile = QScrollArea() - # self.scroll_profile.setWidget(self.canvas_profile) - # self.scroll_profile.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - # self.scroll_profile.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) - # # self.scroll_BS.setWidgetResizable(True) - # self.scroll_profile.setAlignment(Qt.AlignCenter) - # self.verticalLayout_groupbox_plot_pre_processed_data.addWidget(self.scroll_profile) - - # self.verticalLayout_groupbox_plot_pre_processed_data.addWidget(self.canvas_profile) - # --- Slider for moving the profile --- self.horizontalLayout_slider = QHBoxLayout() self.verticalLayout_groupbox_plot_pre_processed_data_2D_profile.addLayout(self.horizontalLayout_slider) @@ -476,6 +447,8 @@ class SignalProcessingTab(QWidget): # +++ --- List of pre-processed data --- +++ # ++++++++++++++++++++++++++++++++++++++++++ + self.groupbox_list_pre_processed_data.setTitle("List pre-processed data: user label") + self.verticalLayout_groupbox_list_pre_processed_data = QVBoxLayout(self.groupbox_list_pre_processed_data) # Create a scroll area @@ -510,30 +483,44 @@ class SignalProcessingTab(QWidget): # self.plaintextedit_list_pre_processed_data.appendPlainText("blablabla \nblobloblo") # -------------------------------------------------------------------------------------------------------------- - # --- Connect signal of widget --- + # -------------------------------------------------------------------------------------------------------------- + # +++++++++ CONNECT SIGNAL OF WIDGET TO SLOT FUNCTION +++++++++ + # -------------------------------------------------------------------------------------------------------------- + # -------------------------------------------------------------------------------------------------------------- self.pushbutton_update.clicked.connect(self.update_SignalPreprocessingTab) + self.pushbutton_update.clicked.connect(self.compute_average_profile_tail) + self.pushbutton_update.clicked.connect(self.plot_averaged_profile_tail) - # self.combobox_fileListWidget.ShowPopUpWindowSignal.connect(self.event_combobobx_fileListWidget) - # self.combobox_fileListWidget.currentIndexChanged.connect(self.combobox_fileListWidget_change_index) + self.combobox_acoustic_data_choice.currentIndexChanged.connect(self.combobox_acoustic_data_choice_change_index) - self.radiobutton_file.toggled.connect(self.onClicked_radiobutton_noise_data) - self.radiobutton_profile_tail.toggled.connect(self.onClicked_radiobutton_noise_data) - self.radiobutton_value.toggled.connect(self.onClicked_radiobutton_noise_data) + self.groupbox_download_noise_file.toggled.connect(self.groupbox_download_noise_file_toggle) + # self.groupbox_download_noise_file.toggled.connect(self.groupbox_download_noise_file_size_change) - self.pushbutton_clear_noise.clicked.connect(self.clear_noise_data) + self.groupbox_compute_noise_from_profile_tail.toggled.connect(self.groupbox_option_profile_tail_toggle) + # self.groupbox_compute_noise_from_profile_tail.toggled.connect(self.groupbox_option_profile_tail_size_change) self.pushbutton_noise_file.clicked.connect(self.open_dialog_box) - self.pushbutton_plot_noise_file.clicked.connect(self.open_plot_noise_window) - self.pushbutton_compute_noise_from_value.clicked.connect(self.compute_noise_from_value) - self.pushbutton_plot_noise_value.clicked.connect(self.open_plot_noise_window) + self.pushbutton_plot_noise_data.clicked.connect(self.open_plot_noise_window) + + self.pushbutton_clear_noise_data.clicked.connect(self.clear_noise_data) + + self.pushbutton_plot_profile_tail.clicked.connect(self.compute_average_profile_tail) + self.pushbutton_plot_profile_tail.clicked.connect(self.plot_averaged_profile_tail) + + self.pushbutton_apply_noise_from_profile_tail.clicked.connect(self.plot_averaged_profile_tail) + self.pushbutton_apply_noise_from_profile_tail.clicked.connect(self.compute_noise_from_profile_tail_value) + + self.combobox_freq_noise_from_profile_tail.currentIndexChanged.connect(self.compute_average_profile_tail) + self.combobox_freq_noise_from_profile_tail.currentIndexChanged.connect(self.plot_averaged_profile_tail) self.pushbutton_Apply_SNR_filter.clicked.connect(self.remove_point_with_snr_filter) # self.pushbutton_Apply_SNR_filter.clicked.connect(self.plot_pre_processed_BS_signal) # self.pushbutton_Apply_SNR_filter.clicked.connect(self.update_plot_pre_processed_profile) - self.spinbox_average_horizontal.valueChanged.connect(self.update_label_cells_sec) + # self.spinbox_average_horizontal.valueChanged.connect(self.update_label_cells_sec) + self.lineEdit_horizontal_average.returnPressed.connect(self.update_label_cells_sec) self.pushbutton_average.clicked.connect(self.compute_averaged_BS_data) # self.pushbutton_average.clicked.connect(self.plot_pre_processed_BS_signal) # self.pushbutton_average.clicked.connect(self.update_plot_pre_processed_profile) @@ -551,662 +538,11 @@ class SignalProcessingTab(QWidget): self.slider.valueChanged.connect(self.update_lineEdit_by_moving_slider) self.slider.valueChanged.connect(self.update_plot_pre_processed_profile) - # ______ _______ - # | | | | \ - # | | | | \ - # | | | | | - # | | | | / - # |______| |________ |________/ - - # COMMENT OLD CODE LINE FROM HERE .... - - # ### --- General layout of widgets --- - # - # # ___________ ____________________________ - # # | profile | | Profile | - # # | position | | | - # # | | | | - # # | | | Averaged profile | - # # | post | | | - # # | proc | | | - # # | options | | FCB option | - # # |___________| |____________________________| - # - # self.horizontalLayout_Main = QHBoxLayout(widget_tab) - # - # self.verticalLayout_Left = QVBoxLayout() - # self.horizontalLayout_Main.addLayout(self.verticalLayout_Left, 2) - # - # self.verticalLayout_Right = QVBoxLayout() - # self.horizontalLayout_Main.addLayout(self.verticalLayout_Right, 8) - # - # - # # -------------------------------------------------------------------------------------------------------------- - # ### --- Layout of groupbox in the Left vertical layout box - # - # # Push button Load data - # # --------------------- - # # Profile position - # # --------------------- - # # Post processing - # # --------------------- - # # FCB options - # - # self.horizontalLayout_pushbutton_load_data_plot_bottom_line = QHBoxLayout() - # self.verticalLayout_Left.addLayout(self.horizontalLayout_pushbutton_load_data_plot_bottom_line) - # - # self.groupbox_display_profile_position = QGroupBox() - # self.verticalLayout_Left.addWidget(self.groupbox_display_profile_position) - # - # self.groupbox_post_processing = QGroupBox() - # self.verticalLayout_Left.addWidget(self.groupbox_post_processing) - # - # self.groupbox_FCBoption = QGroupBox() - # self.verticalLayout_Left.addWidget(self.groupbox_FCBoption) - # - # # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - # # +++ --- Push button Load data + Push button plot bottom --- +++ - # # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - # - # self.pushbutton_load_data = QPushButton() - # self.horizontalLayout_pushbutton_load_data_plot_bottom_line.addWidget(self.pushbutton_load_data) - # self.pushbutton_load_data.clicked.connect(self.compute_BS_data_section) - # # self.pushbutton_load_data.clicked.connect(self.plot_profile_position_on_transect) - # # self.pushbutton_load_data.clicked.connect(self.plot_profile) - # - # self.combobox_frequency = QComboBox() - # self.horizontalLayout_pushbutton_load_data_plot_bottom_line.addWidget(self.combobox_frequency) - # # self.combobox_frequency.currentTextChanged.connect(self.update_plot_profile_position_on_transect) - # - # # +++++++++++++++++++++++++++++++++++++++++++++++++ - # # +++ --- GroupBox Display Profile Position --- +++ - # # +++++++++++++++++++++++++++++++++++++++++++++++++ - # - # self.verticalLayout_groupbox_display_profile_position = QVBoxLayout(self.groupbox_display_profile_position) - # - # self.label_profile_number = QLabel() - # self.label_profile_number.setFont(QFont("Ubuntu", 16, QFont.Bold)) - # self.label_profile_number.setAlignment(Qt.AlignCenter) - # # self.label_profile_number.setText("Profile 1 / " + str(stg.nb_profiles)) - # self.verticalLayout_groupbox_display_profile_position.addWidget(self.label_profile_number) - # - # self.canvas_plot_profile_position_on_transect = None - # - # # self.figure_plot_profile_position_on_transect, self.axis_plot_profile_position_on_transect = \ - # # plt.subplots(nrows=1, ncols=1, layout="constrained") - # # self.canvas_plot_profile_position_on_transect = FigureCanvas(self.figure_plot_profile_position_on_transect) - # # self.plot_transect_bottom_with_profile_position(0) - # # - # # # self.axis_plot_profile_position_on_transect.plot( - # # # 0 * np.ones(self.model.r_bottom_cross_section.shape[0]), - # # # self.model.r_bottom_cross_section, color='red', linestyle="solid", linewidth=2) - # # - # # self.verticalLayout_groupbox_display_profile_position.addWidget(self.canvas_plot_profile_position_on_transect) - # # - # # self.horizontalLayout_slider_plot_profile_position = QHBoxLayout() - # # self.verticalLayout_groupbox_display_profile_position.addLayout( - # # self.horizontalLayout_slider_plot_profile_position) - # # - # # # self.icon_triangle_left = QPixmap(path_icon + "triangle_left.png") - # # # self.pushButton_slider_plot_profile_position_left = QPushButton() - # # # self.pushButton_slider_plot_profile_position_left.setIcon(QIcon(self.icon_triangle_left)) - # # # self.icon_triangle_right = QPixmap(path_icon + "triangle_right.png") - # # # self.pushButton_slider_plot_profile_position_right = QPushButton() - # # # self.pushButton_slider_plot_profile_position_right.setIcon(QIcon(self.icon_triangle_right)) - # # # - # # # self.horizontalLayout_slider_plot_profile_position.addWidget(self.pushButton_slider_plot_profile_position_left) - # # # self.horizontalLayout_slider_plot_profile_position.addWidget(self.pushButton_slider_plot_profile_position_right) - # # # - # # # self.lineEdit_slider_plot_profile_position = QLineEdit() - # # # self.horizontalLayout_slider_plot_profile_position.addWidget(self.lineEdit_slider_plot_profile_position) - # # # - # # # self.slider_plot_profile_position = QSlider() - # # # self.slider_plot_profile_position.setOrientation(Qt.Horizontal) - # # # self.slider_plot_profile_position.setTickPosition(QSlider.TicksBelow) - # # # self.slider_plot_profile_position.setCursor(Qt.OpenHandCursor) - # # # self.slider_plot_profile_position.setMinimum(0) - # # # self.slider_plot_profile_position.setMaximum(1) - # # # self.slider_plot_profile_position.setTickInterval(1) - # # # self.slider_plot_profile_position.setValue(0) - # # # self.horizontalLayout_slider_plot_profile_position.addWidget(self.slider_plot_profile_position) - # # - # # # self.horizontalLayoutTop_signalProcessing.addWidget(self.groupbox_display_profile_position, 3) - # - # # ++++++++++++++++++++++++++++++++++++++++ - # # +++ --- GroupBox Post Processing --- +++ - # # ++++++++++++++++++++++++++++++++++++++++ - # - # self.verticalLayout_groupbox_post_processing = QVBoxLayout(self.groupbox_post_processing) - # - # self.groupbox_acoustic_profile = QGroupBox() - # self.verticalLayout_groupbox_post_processing.addWidget(self.groupbox_acoustic_profile) - # - # self.groupbox_rayleigh_criterion = QGroupBox() - # self.verticalLayout_groupbox_post_processing.addWidget(self.groupbox_rayleigh_criterion) - # - # self.groupbox_window_size = QGroupBox() - # self.verticalLayout_groupbox_post_processing.addWidget(self.groupbox_window_size) - # - # # --- Groupbox acoustic profile --- - # - # self.gridLayout_groupbox_acoustic_profile = QGridLayout(self.groupbox_acoustic_profile) - # - # # self.checkbox_SNR_criterion = QCheckBox() - # self.label_SNR_criterion = QLabel() - # self.gridLayout_groupbox_acoustic_profile.addWidget(self.label_SNR_criterion, 0, 0, 1, 1) - # self.spinbox_SNR_criterion = QSpinBox() - # self.spinbox_SNR_criterion.setRange(0, 9999) - # self.spinbox_SNR_criterion.setValue(0) - # # self.spinbox_SNR_criterion.setDisabled(True) - # self.gridLayout_groupbox_acoustic_profile.addWidget(self.spinbox_SNR_criterion, 0, 1, 1, 1) - # - # # self.spinbox_SNR_criterion.valueChanged.connect(self.remove_point_with_snr_filter) - # - # self.pushbutton_snr_filter = QPushButton() - # self.pushbutton_snr_filter.setText("Apply SNR") - # self.gridLayout_groupbox_acoustic_profile.addWidget(self.pushbutton_snr_filter, 0, 2, 1, 1) - # - # self.pushbutton_snr_filter.clicked.connect(self.remove_point_with_snr_filter) - # # self.pushbutton_snr_filter.clicked.connect(self.update_plot_profile) - # # self.pushbutton_snr_filter.clicked.connect(self.update_plot_profile_position_on_transect) - # - # # --- Groupbox Rayleigh criterion --- - # - # self.gridLayout_rayleigh_criterion = QGridLayout(self.groupbox_rayleigh_criterion) - # - # self.label_Rayleigh_criterion = QLabel() - # self.label_Rayleigh_criterion.setText("/² <=") - # self.gridLayout_rayleigh_criterion.addWidget(self.label_Rayleigh_criterion, 0, 0, 1, 1) - # - # self.spinbox_rayleigh_criterion = QSpinBox() - # self.spinbox_rayleigh_criterion.setRange(0, 9999) - # self.spinbox_rayleigh_criterion.setValue(10) - # self.gridLayout_rayleigh_criterion.addWidget(self.spinbox_rayleigh_criterion, 0, 1, 1, 1) - # - # self.label_4pi = QLabel() - # self.label_4pi.setText("% x 4/pi") - # self.gridLayout_rayleigh_criterion.addWidget(self.label_4pi, 0, 2, 1, 1) - # - # self.pushbutton_despiking_signal = QPushButton() - # self.pushbutton_despiking_signal.setText("Despiking the signal") - # self.gridLayout_rayleigh_criterion.addWidget(self.pushbutton_despiking_signal, 0, 3, 1, 1) - # - # # --- Groupbox Window size --- - # - # # self.horizontalLayout_groupbox_window_size = QHBoxLayout(self.groupbox_window_size) - # self.gridLayout_groupbox_window_size = QGridLayout(self.groupbox_window_size) - # - # self.label_signal_averaging_horizontal = QLabel() - # self.label_signal_averaging_horizontal.setText("Horizontal +/- ") - # # self.horizontalLayout_groupbox_window_size.addWidget(self.label_signal_averaging_over) - # self.gridLayout_groupbox_window_size.addWidget(self.label_signal_averaging_horizontal, 0, 0, 1, 1) - # self.spinbox_average_horizontal = QSpinBox() - # self.spinbox_average_horizontal.setRange(0, 9999) - # self.spinbox_average_horizontal.setValue(0) - # # self.horizontalLayout_groupbox_window_size.addWidget(self.spinbox_average) - # self.gridLayout_groupbox_window_size.addWidget(self.spinbox_average_horizontal, 0, 1, 1, 1) - # self.label_cells_horizontal = QLabel() - # self.label_cells_horizontal.setText("cells = +/- ? sec") - # # self.horizontalLayout_groupbox_window_size.addWidget(self.label_cells) - # self.gridLayout_groupbox_window_size.addWidget(self.label_cells_horizontal, 0, 2, 1, 1) - # - # # self.label_signal_averaging_vertical = QLabel() - # # self.label_signal_averaging_vertical.setText("Vertical +/- ") - # # # self.horizontalLayout_groupbox_window_size.addWidget(self.label_signal_averaging_over) - # # self.gridLayout_groupbox_window_size.addWidget(self.label_signal_averaging_vertical, 1, 0, 1, 1) - # # self.spinbox_average_vertical = QSpinBox() - # # self.spinbox_average_vertical.setRange(0, 9999) - # # self.spinbox_average_vertical.setValue(0) - # # # self.horizontalLayout_groupbox_window_size.addWidget(self.spinbox_average) - # # self.gridLayout_groupbox_window_size.addWidget(self.spinbox_average_vertical, 1, 1, 1, 1) - # # self.label_cells_vertical = QLabel() - # # self.label_cells_vertical.setText("cells = +/- ? sec") - # # # self.horizontalLayout_groupbox_window_size.addWidget(self.label_cells) - # # self.gridLayout_groupbox_window_size.addWidget(self.label_cells_vertical, 1, 2, 1, 1) - # - # # self.spinbox_average.valueChanged.connect(self.compute_averaged_profile) - # - # self.pushbutton_average = QPushButton() - # self.pushbutton_average.setText("Apply averaging") - # # self.pushbutton_snr_filter.setDisabled(True) - # # self.horizontalLayout_groupbox_window_size.addWidget(self.pushbutton_average) - # self.gridLayout_groupbox_window_size.addWidget(self.pushbutton_average, 0, 3, 2, 1) - # - # self.pushbutton_average.clicked.connect(self.compute_averaged_profile) - # # self.pushbutton_average.clicked.connect(self.update_plot_profile_position_on_transect) - # # self.pushbutton_average.clicked.connect(self.plot_averaged_profile) - # - # # ++++++++++++++++++++++++++++++++++++ - # # +++ --- GroupBox FCB options --- +++ - # # ++++++++++++++++++++++++++++++++++++ - # - # self.verticalLayout_groupbox_FCBoption = QVBoxLayout(self.groupbox_FCBoption) - # - # self.groupbox_water_attenuation = QGroupBox() - # self.verticalLayout_groupbox_FCBoption.addWidget(self.groupbox_water_attenuation) - # - # self.groupbox_fit_regression_line = QGroupBox() - # self.verticalLayout_groupbox_FCBoption.addWidget(self.groupbox_fit_regression_line) - # - # # --- Groupbox water attenuation --- - # - # self.gridLayout_groupbox_water_attenuation = QGridLayout(self.groupbox_water_attenuation) - # - # self.combobox_water_attenuation_model = QComboBox() - # self.combobox_water_attenuation_model.addItem("François & Garrison 1982") - # self.combobox_water_attenuation_model.addItem("Other model") - # self.gridLayout_groupbox_water_attenuation.addWidget(self.combobox_water_attenuation_model, 0, 0, 1, 1) - # - # self.label_temperature_water_attenation = QLabel() - # self.gridLayout_groupbox_water_attenuation.addWidget(self.label_temperature_water_attenation, 0, 1, 1, 1) - # - # self.spinbox_temperature_water_attenuation = QSpinBox() - # self.gridLayout_groupbox_water_attenuation.addWidget(self.spinbox_temperature_water_attenuation, 0, 2, 1, 1) - # - # self.label_degre_celsius = QLabel() - # self.label_degre_celsius.setText("°C") - # self.gridLayout_groupbox_water_attenuation.addWidget(self.label_degre_celsius, 0, 3, 1, 1) - # - # self.combobox_freq_for_water_attenuation = QComboBox() - # # self.combobox_water_attenuation.currentIndexChanged.connect(self.alpha_value_changed) - # self.gridLayout_groupbox_water_attenuation.addWidget(self.combobox_freq_for_water_attenuation, 1, 0, 1, 1) - # - # self.pushbutton_water_attenuation = QPushButton() - # self.pushbutton_water_attenuation.setText("Compute \u03B1w") - # self.gridLayout_groupbox_water_attenuation.addWidget(self.pushbutton_water_attenuation, 1, 1, 1, 1) - # self.pushbutton_water_attenuation.clicked.connect(self.compute_water_attenuation) - # - # self.label_water_attenuation = QLabel() - # self.label_water_attenuation.setText("\u03B1w = 0.00 dB/m") - # self.label_water_attenuation.setFont(QFont("Ubuntu", 14, QFont.Normal)) - # self.gridLayout_groupbox_water_attenuation.addWidget(self.label_water_attenuation, 1, 2, 1, 1) - # - # # --- Groupbox fit regression line --- - # - # self.gridLayout_groupbox_fit_regression = QGridLayout(self.groupbox_fit_regression_line) - # - # self.label_alphaS_expression = QLabel() - # # self.label_alphaS_expression.setText("For homogeneous suspension: dFCB/dr = -2\u03B1s<\sub>") - # self.gridLayout_groupbox_fit_regression.addWidget(self.label_alphaS_expression, 0, 0, 1, 5) - # - # self.combobox_frequency_compute_alphaS = QComboBox() - # self.gridLayout_groupbox_fit_regression.addWidget(self.combobox_frequency_compute_alphaS, 1, 0, 1, 1) - # - # self.label_alphaS_computation_from = QLabel() - # self.label_alphaS_computation_from.setText("From -") - # self.gridLayout_groupbox_fit_regression.addWidget(self.label_alphaS_computation_from, 1, 1, 1, 1) - # - # self.spinbox_alphaS_computation_from = QDoubleSpinBox() - # self.spinbox_alphaS_computation_from.setRange(0, 9999) - # self.gridLayout_groupbox_fit_regression.addWidget(self.spinbox_alphaS_computation_from, 1, 2, 1, 1) - # - # self.label_alphaS_computation_to = QLabel() - # self.label_alphaS_computation_to.setText("To -") - # self.gridLayout_groupbox_fit_regression.addWidget(self.label_alphaS_computation_to, 1, 3, 1, 1) - # - # self.spinbox_alphaS_computation_to = QDoubleSpinBox() - # self.gridLayout_groupbox_fit_regression.addWidget(self.spinbox_alphaS_computation_to, 1, 4, 1, 1) - # - # self.pushbutton_plot_FCB = QPushButton() - # self.pushbutton_plot_FCB.setText("Plot FCB") - # self.gridLayout_groupbox_fit_regression.addWidget(self.pushbutton_plot_FCB, 2, 0, 1, 1) - # - # self.pushbutton_plot_FCB.clicked.connect(self.compute_FCB) - # # self.pushbutton_plot_FCB.clicked.connect(self.plot_FCB) - # - # self.pushbutton_fit_linear_regression = QPushButton() - # self.pushbutton_fit_linear_regression.setText("Fit && Compute \u03B1s") - # self.gridLayout_groupbox_fit_regression.addWidget(self.pushbutton_fit_linear_regression, 2, 1, 1, 1) - # - # self.pushbutton_fit_linear_regression.clicked.connect(self.fit_FCB_profile_with_linear_regression_and_compute_alphaS) - # self.pushbutton_fit_linear_regression.clicked.connect(self.plot_FCB) - # - # self.label_alphaS = QLabel() - # self.label_alphaS.setText("\u03B1s = " + "0.0" + "dB/m") - # self.label_alphaS.setFont(QFont("Ubuntu", 14, QFont.Normal)) - # self.gridLayout_groupbox_fit_regression.addWidget(self.label_alphaS, 2, 3, 1, 1) - # - # # self.verticalLayout_groupbox_fit_regression - # - # # -------------------------------------------------------------------------------------------------------------- - # ### --- Layout of groupbox in the Right vertical layout box - # - # # Plot Profiles - # # ------------------------- - # # Plot averaged profile - # # ------------------------- - # # Plot FCB profiles - # - # self.groupbox_plot_profile = QGroupBox() - # self.verticalLayout_Right.addWidget(self.groupbox_plot_profile) - # - # self.groupbox_plot_averaged_profile = QGroupBox() - # self.verticalLayout_Right.addWidget(self.groupbox_plot_averaged_profile) - # - # self.groupbox_FCB_profile = QGroupBox() - # self.verticalLayout_Right.addWidget(self.groupbox_FCB_profile) - # - # # +++++++++++++++++++++++++++++++++++++ - # # +++ --- GroupBox Plot profile --- +++ - # # +++++++++++++++++++++++++++++++++++++ - # - # self.verticalLayout_groupbox_plot_profile = QVBoxLayout(self.groupbox_plot_profile) - # - # self.canvas_profile = None - # self.scroll_profile = None - # - # # # self.data_test_slider = np.array([[0, 1, 2, 3, 4, 5], - # # # [0, 1, 4, 9, 16, 25], - # # # [0, 1, 8, 27, 64, 125]]) - # # - # # - # # - # # self.verticalLayout_plotprofiles = QVBoxLayout(self.groupbox_plot_profile) - # # self.figure_profile, self.axis_profile = plt.subplots(nrows=1, ncols=4, layout='constrained') - # # self.canvas_profile = FigureCanvas(self.figure_profile) - # # # self.toolbar_profile =import NavigationToolBar(self.canvas_profile, self) - # # # self.addToolBar(Qt.RightToolBarArea, self.toolbar_profile) - # # # self.linear(self.figure_profile, self.axis_profile) - # # for i in range(4): - # # self.axis_profile[i].plot(self.model.BS_raw_cross_section.V[:, i, 0], self.model.r, c='k') - # # # self.axis_profile.plot(self.data_test_slider[0, :], self.data_test_slider[0, :]) - # # - # # self.toolbar_post_processing_tab = NavigationToolBar(self.canvas_profile, self) - # # # self.addToolBar(Qt.RightToolBarArea, self.toolbar_post_processing_tab) - # # - # # # self.label_icon = QLabel() - # # # self.label_icon.setPixmap(QPixmap("../icons/smiley1.jpg")) - # # - # # # self.verticalLayout_plotprofiles.addWidget(self.toolbar_profile) - # # self.verticalLayout_plotprofiles.addWidget(self.canvas_profile) - # # # self.verticalLayout_plotprofiles.addLayout(self.horizontalLayout_slider_plotprofil) - # # - # # # # self.verticalLayout_plotprofiles.addWidget(self.label_icon) - # # # self.verticalLayout_plotprofiles.addWidget(self.slider_plotprofile) - # # - # # # self.slider_plotprofile.valueChanged.connect(self.changePlot) - # # - # # # self.horizontalLayoutTop_signalProcessing.addLayout(self.verticalLayout_plotprofiles, 7) - # # # self.horizontalLayoutTop_signalProcessing.addWidget(self.groupbox_plot_profile, 7) - # # # self.verticalLayout_right_SignalProcessingTab.addWidget(self.toolbar_profile) - # - # # ++++++++++++++++++++++++++++++++++++++++++++++ - # # +++ --- GroupBox Plot averaged profile --- +++ - # # ++++++++++++++++++++++++++++++++++++++++++++++ - # - # self.verticalLayout_groupbox_plot_averaged_profile = QVBoxLayout(self.groupbox_plot_averaged_profile) - # - # self.canvas_averaged_profile = None - # self.scroll_averaged_profile = None - # - # # self.verticalLayout_averagedprofile = QVBoxLayout(self.groupbox_plot_averaged_profile) - # # self.figure_averagedprofile, self.axis_averagedprofile = plt.subplots(nrows=1, ncols=4, layout='constrained') - # # self.canvas_averagedprofile = FigureCanvas(self.figure_averagedprofile) - # # # self.toolbar_averagedprofile = NavigationToolBar(self.canvas_averagedprofile, self) - # # # self.addToolBar(Qt.RightToolBarArea, self.toolbar_averagedprofile) - # # # self.toolbar_profile = NavigationToolBar(self.canvas_averagedprofile, self) - # # # self.polynome(self.figure_averagedprofile, self.axis_averagedprofile) - # # for i in range(4): - # # self.axis_averagedprofile[i].plot(self.model.BS_averaged_cross_section.V[:, i, 0], self.model.r, c='b') - # # - # # self.toolbar_post_processing_tab = NavigationToolBar(self.canvas_averagedprofile, self) - # # - # # # self.horizontalLayout_slider_averagedprofile = QHBoxLayout() - # # # - # # # self.pushButton_slider_averagedprofile_right = QPushButton() - # # # self.pushButton_slider_averagedprofile_right.setIcon(icon_triangle_right) - # # # - # # # self.pushButton_slider_averagedprofile_left = QPushButton() - # # # self.pushButton_slider_averagedprofile_left.setIcon(icon_triangle_left) - # # # - # # # self.horizontalLayout_slider_averagedprofile.addWidget(self.pushButton_slider_averagedprofile_left) - # # # self.horizontalLayout_slider_averagedprofile.addWidget(self.pushButton_slider_averagedprofile_right) - # # # - # # # self.lineEdit_slider_averaged_profile = QLineEdit() - # # # self.lineEdit_slider_averaged_profile.setFixedWidth(50) - # # # self.lineEdit_slider_averaged_profile.setText("1") - # # # self.horizontalLayout_slider_averagedprofile.addWidget(self.lineEdit_slider_averaged_profile) - # # # - # # # self.slider_averagedprofile = QSlider() - # # # self.slider_averagedprofile.setOrientation(Qt.Horizontal) - # # # self.slider_averagedprofile.setTickPosition(QSlider.TicksBelow) - # # # self.slider_averagedprofile.setCursor(Qt.OpenHandCursor) - # # # self.slider_averagedprofile.setMinimum(0) - # # # self.slider_averagedprofile.setMaximum(1) - # # # self.slider_averagedprofile.setTickInterval(1) - # # # self.slider_averagedprofile.setValue(0) - # # # # self.slider_plotprofile.valueChanged.connect(self.changePlot) - # # # - # # # self.horizontalLayout_slider_averagedprofile.addWidget(self.slider_averagedprofile) - # # - # # # self.verticalLayout_averagedprofile.addWidget(self.toolbar_averagedprofile) - # # self.verticalLayout_averagedprofile.addWidget(self.canvas_averagedprofile) - # # # self.verticalLayout_averagedprofile.addLayout(self.horizontalLayout_slider_averagedprofile) - # # - # # # self.horizontalLayoutMid_signalProcessing.addLayout(self.verticalLayout_averagedprofile, 7) - # # # self.horizontalLayoutMid_signalProcessing.addWidget(self.groupbox_plot_averaged_profile, 7) - # - # # ++++++++++++++++++++++++++++++++++++++++++++++ - # # +++ --- GroupBox Plot FCB profile --- +++ - # # ++++++++++++++++++++++++++++++++++++++++++++++ - # - # self.verticalLayout_groupbox_plot_FCB_profile = QVBoxLayout(self.groupbox_FCB_profile) - # - # self.canvas_FCB_profile = None - # self.scroll_FCB_profile = None - # - # # self.verticalLayout_FCBoptions = QVBoxLayout(self.groupbox_FCB_profile) - # # self.figure_FCBoptions, self.axis_FCBoptions = plt.subplots(nrows=1, ncols=4, layout="constrained") - # # self.canvas_FCBoptions = FigureCanvas(self.figure_FCBoptions) - # # self.toolbar_FCBoptions = NavigationToolBar(self.canvas_FCBoptions, self) - # # # self.addToolBar(Qt.LeftToolBarArea, self.toolbar_FCBoptions) - # # # self.toolbar_profile = NavigationToolBar(self.canvas_FCBoptions, self) - # # # self.cubique(self.figure_FCBoptions, self.axis_FCBoptions) - # # for i in range(4): - # # self.axis_FCBoptions[i].plot(self.model.FCB[:, i, 0], self.model.r, c='r') - # # - # # self.toolbar_post_processing_tab = NavigationToolBar(self.canvas_FCBoptions, self) - # # - # # # self.horizontalLayout_slider_FCBoptions = QHBoxLayout() - # # # - # # # self.pushButton_slider_FCBoptions_right = QPushButton() - # # # self.pushButton_slider_FCBoptions_right.setIcon(icon_triangle_right) - # # # - # # # self.pushButton_slider_FCBoptions_left = QPushButton() - # # # self.pushButton_slider_FCBoptions_left.setIcon(icon_triangle_left) - # # # - # # # self.horizontalLayout_slider_FCBoptions.addWidget(self.pushButton_slider_FCBoptions_left) - # # # self.horizontalLayout_slider_FCBoptions.addWidget(self.pushButton_slider_FCBoptions_right) - # # # - # # # self.lineEdit_slider_FCBplot = QLineEdit() - # # # self.lineEdit_slider_FCBplot.setFixedWidth(50) - # # # self.lineEdit_slider_FCBplot.setText("1") - # # # self.horizontalLayout_slider_FCBoptions.addWidget(self.lineEdit_slider_FCBplot) - # # # - # # # self.slider_FCBoptions = QSlider() - # # # self.slider_FCBoptions.setOrientation(Qt.Horizontal) - # # # self.slider_FCBoptions.setTickPosition(QSlider.TicksBelow) - # # # self.slider_FCBoptions.setCursor(Qt.OpenHandCursor) - # # # self.slider_FCBoptions.setMinimum(0) - # # # self.slider_FCBoptions.setMaximum(1) - # # # self.slider_FCBoptions.setTickInterval(1) - # # # self.slider_FCBoptions.setValue(0) - # # # # self.slider_plotprofile.valueChanged.connect(self.changePlot) - # # # - # # # self.horizontalLayout_slider_FCBoptions.addWidget(self.slider_FCBoptions) - # # - # # # self.verticalLayout_FCBoptions.addWidget(self.toolbar_FCBoptions) - # # self.verticalLayout_FCBoptions.addWidget(self.canvas_FCBoptions) - # # # self.verticalLayout_FCBoptions.addLayout(self.horizontalLayout_slider_FCBoptions) - # # - # # # self.horizontalLayoutBottom_signalProcessing.addLayout(self.verticalLayout_FCBoptions, 7) - # # # self.horizontalLayoutBottom_signalProcessing.addWidget(self.groupbox_FCB_profile, 7) - # # - # - # - # # --- Slider ---- - # - # self.horizontalLayout_slider = QHBoxLayout() - # self.verticalLayout_Right.addLayout(self.horizontalLayout_slider) - # - # self.pushbutton_slider_left = QPushButton() - # self.pushbutton_slider_left.setIcon(icon_triangle_left) - # self.horizontalLayout_slider.addWidget(self.pushbutton_slider_left) - # - # self.pushbutton_slider_right = QPushButton() - # self.pushbutton_slider_right.setIcon(icon_triangle_right) - # self.horizontalLayout_slider.addWidget(self.pushbutton_slider_right) - # - # self.pushbutton_slider_right.clicked.connect(self.slide_profile_number_to_right) - # - # self.pushbutton_slider_left.clicked.connect(self.slide_profile_number_to_left) - # - # # self.horizontalLayout_slider_plotprofil.addWidget(self.pushButton_slider_plotprofile_left) - # # self.horizontalLayout_slider_plotprofil.addWidget(self.pushButton_slider_plotprofile_right) - # # - # self.lineEdit_slider = QLineEdit() - # self.lineEdit_slider.setText("1") - # # # self.lineEdit_slider_acoustic_profile.setFixedWidth(self.pushButton_slider_plotprofile_left.size().width()) - # self.lineEdit_slider.setFixedWidth(50) - # self.horizontalLayout_slider.addWidget(self.lineEdit_slider) - # - # self.lineEdit_slider.returnPressed.connect(self.profile_number_on_lineEdit) - # - # self.slider = QSlider() - # self.horizontalLayout_slider.addWidget(self.slider, 9) - # - # self.slider.setOrientation(Qt.Horizontal) - # # # self.slider_plotprofile.setTickPosition(QSlider.TicksBelow) - # self.slider.setCursor(Qt.OpenHandCursor) - # self.slider.setMinimum(1) - # # self.slider.setMaximum(stg.nb_profiles)#self.model.BS_averaged_cross_section_corr.V.shape[2]) - # self.slider.setTickInterval(1) - # self.slider.setValue(1) - # - # self.slider.valueChanged.connect(self.update_lineEdit_by_moving_slider) - # self.slider.valueChanged.connect(self.update_plot_profile_position_on_transect) - # self.slider.valueChanged.connect(self.update_plot_profile) - # # self.slider.valueChanged.connect(self.update_plot_averaged_profile) - # self.slider.valueChanged.connect(self.update_plot_FCB) - - # .... UP TO HERE. END OF COMMENT OF OLD LINE CODE - - self.retranslate_signal_processing_tab() - - # # -------------------- Functions for Signal processing Tab -------------------- - - # def retranslate_signal_processing_tab(self): - # self.pushbutton_load_data.setText(_translate("CONSTANT_STRING", cs.LOAD_DATA_FROM_ACOUSTIC_DATA_TAB)) - # - # self.groupbox_display_profile_position.setTitle(_translate("CONSTANT_STRING", cs.DISPLAY_PROFILE_POSITION)) - # # self.label_profile_number.setText(_translate("CONSTANT_STRING", cs.PROFILE_NUMBER) + " " + - # # str(self.string_profile_number) + " / " + str(self.string_profile_number_max)) - # - # self.groupbox_post_processing.setTitle(_translate("CONSTANT_STRING", cs.POST_PROCESSING)) - # - # self.groupbox_acoustic_profile.setTitle(_translate("CONSTANT_STRING", cs.ACOUSTIC_PROFILE)) - # # self.checkbox_substract_noise.setText(_translate("CONSTANT_STRING", cs.SUBTRACT_THE_NOISE)) - # self.label_SNR_criterion.setText(_translate("CONSTANT_STRING", cs.SNR_CRITERION)) - # - # self.groupbox_window_size.setTitle(_translate("CONSTANT_STRING", cs.WINDOW_SIZE)) - # # self.label_averageH.setText(_translate("CONSTANT_STRING", cs.HORIZONTAL) + ": +/-") - # # self.label_cells.setText(_translate("CONSTANT_STRING", cs.CELLS) + " = +/- ? sec") - # - # self.groupbox_rayleigh_criterion.setTitle(_translate("CONSTANT_STRING", cs.RAYLEIGH_CRITERION)) - # # self.checkbox_despiked_acoustic_signal.setText(_translate("CONSTANT_STRING", cs.DESPIKING)) - # - # self.groupbox_FCBoption.setTitle(_translate("CONSTANT_STRING", cs.FCB_OPTIONS)) - # - # self.groupbox_water_attenuation.setTitle(_translate("CONSTANT_STRING", cs.COMPUTING_WATER_ATTENUATION)) - # self.label_temperature_water_attenation.setText(_translate("CONSTANT_STRING", cs.TEMPERATURE) + ":") - # - # self.groupbox_fit_regression_line.setTitle(_translate("CONSTANT_STRING", cs.FIT_REGRESSION_LINE)) - # self.label_alphaS_expression.setText( - # _translate("CONSTANT_STRING", cs.FOR_HOMOGENEOUS_SUSPENSION) + ": dFCB/dr = -2\u03B1s<\sub>") - # # self.label_alphaS_computation_from.setText(_translate("CONSTANT_STRING", cs.FROM)) - # # self.label_alphaS_computation_to.setText(_translate("CONSTANT_STRING", cs.TO)) - # - # self.groupbox_plot_profile.setTitle(_translate("CONSTANT_STRING", cs.PROFILE)) - # self.groupbox_plot_averaged_profile.setTitle(_translate("CONSTANT_STRING", cs.AVERAGED_PROFILE)) - # self.groupbox_FCB_profile.setTitle(_translate("CONSTANT_STRING", cs.FCB_PROFILE)) - - def retranslate_signal_processing_tab(self): - - self.groupbox_study_data.setTitle("Study data") - self.groupbox_download_noise_file.setTitle("Download noise file") - self.groupbox_compute_noise_from_profile_tail.setTitle("Compute Noise from profile tail") - self.groupbox_compute_noise_from_value.setTitle("Compute Noise from value") - # self.groupbox_plot_noise_data.setTitle("Plot noise data") - - # self.label_date_groupbox_noise_file.setText(_translate("CONSTANT_STRING", cs.DATE) + ": ") - # self.label_hour_groupbox_noise_file.setText(_translate("CONSTANT_STRING", cs.HOUR) + ": ") - - # self.groupbox_plot_Noise_SNR.setTitle("Plot Noise and SNR 2D fields") - # self.pushbutton_plot_SNR.setText("Plot SNR") - - self.pushbutton_Apply_SNR_filter.setText("Apply SNR") - # self.groupbox_plot_BS_signal_filtered_with_SNR.setTitle("Plot BS signal filtered with SNR") - - self.groupbox_pre_processing_option.setTitle("Pre-processing options") - self.groupbox_Rayleigh_criterion.setTitle("Rayleigh criterion") - self.groupbox_window_size.setTitle("Window size") - - self.groupbox_plot_pre_processed_data_2D_field.setTitle("Display pre-processed data 2D fields") - - self.groupbox_plot_pre_processed_data_profile.setTitle("Display pre-processed data profile") - - self.groupbox_list_pre_processed_data.setTitle("List pre-processed data") - - def event_combobobx_fileListWidget(self): - print("self.combobox_fileListWidget.maxCount()", self.combobox_fileListWidget.maxCount()) - print("self.combobox_fileListWidget.count()", self.combobox_fileListWidget.count()) - print("len(stg.filename_BS_noise_data ", len(stg.filename_BS_noise_data)) - - self.combobox_fileListWidget.clear() - # self.combobox_fileListWidget.addItem("") - for i in range(len(stg.filename_BS_raw_data)): - self.combobox_fileListWidget.addItem(stg.filename_BS_raw_data[i]) - - # print("len stg.BS_noise_raw_data : ", len(stg.BS_noise_raw_data)) - # if len(stg.BS_noise_raw_data) == 0: - # stg.BS_noise_raw_data = [np.array([]) for _ in range(self.combobox_fileListWidget.count() - 1)] - # print("stg.BS_noise_raw_data : ", stg.BS_noise_raw_data) - # print("len stg.BS_noise_raw_data : ", len(stg.BS_noise_raw_data)) - # stg.BS_noise_averaged_data = [np.array([]) for _ in range(self.combobox_fileListWidget.count() - 1)] - # stg.SNR_raw_data = [np.array([]) for _ in range(self.combobox_fileListWidget.count() - 1)] - # stg.SNR_cross_section = [np.array([]) for _ in range(self.combobox_fileListWidget.count() - 1)] - # stg.SNR_stream_bed = [np.array([]) for _ in range(self.combobox_fileListWidget.count() - 1)] - # stg.time_noise = [np.array([]) for _ in range(self.combobox_fileListWidget.count() - 1)] - # stg.noise_method = [0]*(self.combobox_fileListWidget.count() - 1) - # elif len(stg.BS_noise_raw_data) < (self.combobox_fileListWidget.count() - 1): - # stg.BS_noise_raw_data.append(np.array([])) - # stg.BS_noise_averaged_data.append(np.array([])) - # stg.SNR_raw_data.append(np.array([])) - # stg.SNR_cross_section.append(np.array([])) - # stg.SNR_stream_bed.append(np.array([])) - # stg.time_noise.append(np.array([])) - # stg.noise_method.append(0) - - # if (stg.noise_method == 1) or (stg.noise_method == 0): - # self.radiobutton_file.setChecked(True) - # if stg.filename_BS_noise_data[self.combobox_fileListWidget.currentIndex()] != "": - # self.lineEdit_noise_file.setText(stg.filename_BS_noise_data[self.combobox_fileListWidget.currentIndex()]) - # self.radiobutton_profile_tail.setChecked(False) - # self.radiobutton_value.setChecked(False) - # elif stg.noise_method == 2: - # self.radiobutton_file.setChecked(False) - # self.radiobutton_profile_tail.setChecked(True) - # self.radiobutton_value.setChecked(False) - # elif stg.noise_method == 3: - # self.radiobutton_file.setChecked(False) - # self.radiobutton_profile_tail.setChecked(False) - # self.radiobutton_value.setChecked(True) - # self.spinbox_compute_noise_from_value.setValue(stg.noise_value[self.combobox_fileListWidget.currentIndex()]) - - # self.combobox_fileListWidget.currentIndexChanged.connect(self.combobox_fileListWidget_change_index) - - # def fill_combobox_fileListWidget(self): - # self.combobox_fileListWidget.addItems([stg.filename_BS_raw_data]) + # -------------------------------------------------------------------------------------------------------------- + # -------------------------------------------------------------------------------------------------------------- + # +++++++++ FUNCTION +++++++++ + # -------------------------------------------------------------------------------------------------------------- + # -------------------------------------------------------------------------------------------------------------- def update_SignalPreprocessingTab(self): @@ -1216,116 +552,47 @@ class SignalProcessingTab(QWidget): - the user change the limits of one or all the records in the first tab (Acoustic data) """ print("filename BS_raw_data before clear ", stg.filename_BS_raw_data) - self.combobox_fileListWidget.clear() + self.combobox_acoustic_data_choice.clear() print("filename BS_raw_data after clear ", stg.filename_BS_raw_data) - self.combobox_fileListWidget.addItems(stg.filename_BS_raw_data) - # self.combobox_fileListWidget.setCurrentIndex(0) - # self.combobox_fileListWidget.currentIndexChanged.connect(self.combobox_fileListWidget_change_index) + self.combobox_acoustic_data_choice.addItems(stg.filename_BS_raw_data) - # for t in range(self.combobox_fileListWidget.count()): - # eval("self.lineEdit_list_pre_processed_data_" + str(t) + ".clear()") - # eval("self.lineEdit_list_pre_processed_data_" + str(t) + ".setText(stg.filename_BS_raw_data[t])") - # - # if self.combobox_fileListWidget.count() > 0: - # - # for i in range(self.combobox_fileListWidget.count()): - # eval("self.lineEdit_list_pre_processed_data_" + str(i) + ".setDisabled(True)") - # # - # eval("self.lineEdit_list_pre_processed_data_" + str( - # self.combobox_fileListWidget.currentIndex()) + ".setEnabled(True)") - # eval("self.lineEdit_list_pre_processed_data_" + str( - # self.combobox_fileListWidget.currentIndex()) + ".returnPressed.connect(self.rename_preprocessed_data)") + print("stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] ", + stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()]) - self.combobox_fileListWidget.currentIndexChanged.connect(self.combobox_fileListWidget_change_index) + if stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 0: - # if self.combobox_fileListWidget.count() > 0: - # for c in range(self.combobox_frequency_profile.count()): - # - # if (stg.SNR_stream_bed[c].shape != (0,)) and (stg.SNR_stream_bed[c] != stg.BS_stream_bed[c]): - # - # # --- Case where the user change limits of BS_stream_bed or BS_cross_section in Acoustic data tab --- - # stg.SNR_stream_bed[c] = ( - # stg.SNR_stream_bed[c][:, :stg.BS_stream_bed[c].shape[1], :stg.BS_stream_bed[c].shape[2]]) - # - # # --- Case where user change limits of BS_raw_data so that BS_cross_section is computed --- - # # else: - # # - # # if stg.noise_method[c] == 1: - # # self.load_noise_data_and_compute_SNR() - # # elif stg.noise_method[c] == 2: - # # pass - # # elif stg.noise_method[c] == 3: - # # self.compute_noise_from_value() - # - # # continuer ici en calculant SNR_stream_bed si on a travailler avec raw data et qu'on revient sur le 1er onglet - # # pour couper ou rajouter la detection du fond. Du coup, il faudra recalculer le SNR stream bed ou cross section - # - # stg.BS_stream_bed_pre_process_SNR[c] = ( - # stg.SNR_stream_bed[c][:, :stg.BS_stream_bed[c].shape[1], :stg.BS_stream_bed[c].shape[2]]) - # - # if stg.BS_stream_bed_pre_process_SNR_average[c].shape != (0,): - # stg.BS_stream_bed_pre_process_SNR_average[c] = ( - # stg.BS_stream_bed_pre_process_SNR_average[c][:, :stg.BS_stream_bed[c].shape[1], :stg.BS_stream_bed[c].shape[2]]) - # - # elif stg.BS_stream_bed_pre_process_average[c].shape != (0,): - # stg.BS_stream_bed_pre_process_average[c] = ( - # stg.BS_stream_bed_pre_process_average[c][:, :stg.BS_stream_bed[c].shape[1], :stg.BS_stream_bed[c].shape[2]]) - # - # elif (stg.BS_cross_section[c].shape != (0,)) and (stg.SNR_cross_section[c] != stg.BS_cross_section[c]): - # - # # if stg.SNR_cross_section[c] != stg.BS_cross_section[c]: - # - # stg.SNR_cross_section[c] = ( - # stg.SNR_cross_section[c][:, stg.BS_cross_section[c].shape[1], stg.BS_cross_section[c].shape[2]]) - # - # stg.BS_cross_section_pre_process_SNR[c] = ( - # stg.SNR_cross_section[c][:, stg.BS_cross_section[c].shape[1], stg.BS_cross_section[c].shape[2]]) - # - # if stg.BS_cross_section_pre_process_SNR_average[c].shape != (0,): - # stg.BS_cross_section_pre_process_SNR_average[c] = ( - # stg.BS_cross_section_pre_process_SNR_average[c][:, stg.BS_cross_section[c].shape[1],stg.BS_cross_section[c].shape[2]]) - # - # elif stg.BS_cross_section_pre_process_average[c].shape != (0,): - # stg.BS_cross_section_pre_process_average[c] = ( - # stg.BS_cross_section_pre_process_average[c][:, stg.BS_cross_section[c].shape[1],stg.BS_cross_section[c].shape[2]]) - # - # self.plot_transect_with_SNR_data() + self.groupbox_download_noise_file.setChecked(True) + self.groupbox_compute_noise_from_profile_tail.setChecked(False) + self.groupbox_download_noise_file_toggle() - # else: - # - # if stg.SNR_cross_section[c] != stg.BS_cross_section[c]: - # - # stg.SNR_cross_section[c] = ( - # stg.SNR_cross_section[c][:, stg.BS_cross_section[c].shape[1], stg.BS_cross_section[c].shape[2]]) - # - # stg.BS_cross_section_pre_process_SNR[c] = ( - # stg.SNR_cross_section[c][:, stg.BS_cross_section[c].shape[1], stg.BS_cross_section[c].shape[2]]) - # - # if stg.BS_cross_section_pre_process_SNR_average[c].shape != (0,): - # stg.BS_cross_section_pre_process_SNR_average[c] = ( - # stg.BS_cross_section_pre_process_SNR_average[c][:, stg.BS_cross_section[c].shape[1],stg.BS_cross_section[c].shape[2]]) - # - # elif stg.BS_cross_section_pre_process_average[c].shape != (0,): - # stg.BS_cross_section_pre_process_average[c] = ( - # stg.BS_cross_section_pre_process_average[c][:, stg.BS_cross_section[c].shape[1],stg.BS_cross_section[c].shape[2]]) + elif stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 1: + + self.groupbox_download_noise_file.setChecked(False) + self.groupbox_compute_noise_from_profile_tail.setChecked(True) + self.groupbox_option_profile_tail_toggle() + + self.combobox_freq_noise_from_profile_tail.clear() + self.combobox_freq_noise_from_profile_tail.addItems(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) + + self.combobox_acoustic_data_choice.currentIndexChanged.connect(self.combobox_acoustic_data_choice_change_index) def activate_list_of_pre_processed_data(self): - for i in range(self.combobox_fileListWidget.count()): + for i in range(self.combobox_acoustic_data_choice.count()): eval("self.lineEdit_list_pre_processed_data_" + str(i) + ".setDisabled(True)") eval("self.lineEdit_list_pre_processed_data_" + str( - self.combobox_fileListWidget.currentIndex()) + ".setEnabled(True)") + self.combobox_acoustic_data_choice.currentIndex()) + ".setEnabled(True)") eval("self.lineEdit_list_pre_processed_data_" + str( - self.combobox_fileListWidget.currentIndex()) + ".returnPressed.connect(self.rename_preprocessed_data)") + self.combobox_acoustic_data_choice.currentIndex()) + ".returnPressed.connect(self.rename_preprocessed_data)") - # for t in range(self.combobox_fileListWidget.count()): + # for t in range(self.combobox_acoustic_data_choice.count()): # eval("self.lineEdit_list_pre_processed_data_" + str(t) + ".clear()") - eval("self.lineEdit_list_pre_processed_data_" + str(self.combobox_fileListWidget.currentIndex()) + - ".setText(stg.filename_BS_raw_data[self.combobox_fileListWidget.currentIndex()])") + eval("self.lineEdit_list_pre_processed_data_" + str(self.combobox_acoustic_data_choice.currentIndex()) + + ".setText(stg.filename_BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()])") def rename_preprocessed_data(self): print("Before : stg.data_preprocessed ", stg.data_preprocessed) - exec("stg.data_preprocessed[self.combobox_fileListWidget.currentIndex()] = " - "self.lineEdit_list_pre_processed_data_" + str(self.combobox_fileListWidget.currentIndex()) + ".text()") + exec("stg.data_preprocessed[self.combobox_acoustic_data_choice.currentIndex()] = " + "self.lineEdit_list_pre_processed_data_" + str(self.combobox_acoustic_data_choice.currentIndex()) + ".text()") print("After : stg.data_preprocessed ", stg.data_preprocessed) # print("QPlainTextEdit.textCursor().blockNumber() ", QPlainTextEdit.textCursor(self.plaintextedit_list_pre_processed_data).blockNumber()) # line_number = int(QPlainTextEdit.textCursor(self.plaintextedit_list_pre_processed_data).blockNumber()/2) @@ -1337,98 +604,271 @@ class SignalProcessingTab(QWidget): # # textCursor().currentList().itemText(line) # stg.data_preprocessed - def combobox_fileListWidget_change_index(self): + # ------------------------------------------------------ - if (stg.noise_method[self.combobox_fileListWidget.currentIndex()] == 1)\ - or (stg.noise_method[self.combobox_fileListWidget.currentIndex()] == 0): - self.radiobutton_file.setChecked(True) - self.lineEdit_noise_file.setText(stg.filename_BS_noise_data[self.combobox_fileListWidget.currentIndex()]) - self.radiobutton_profile_tail.setChecked(False) - self.radiobutton_value.setChecked(False) - elif stg.noise_method[self.combobox_fileListWidget.currentIndex()] == 2: - self.radiobutton_file.setChecked(False) - self.radiobutton_profile_tail.setChecked(True) - self.radiobutton_value.setChecked(False) - elif stg.noise_method[self.combobox_fileListWidget.currentIndex()] == 3: - self.radiobutton_file.setChecked(False) - self.radiobutton_profile_tail.setChecked(False) - self.radiobutton_value.setChecked(True) - self.spinbox_compute_noise_from_value.setValue(stg.noise_value[self.combobox_fileListWidget.currentIndex()]) + def groupbox_download_noise_file_toggle(self): + if self.groupbox_download_noise_file.isChecked() == True: + self.groupbox_compute_noise_from_profile_tail.setChecked(False) + elif self.groupbox_download_noise_file.isChecked() == False: + self.groupbox_compute_noise_from_profile_tail.setChecked(True) + + + def groupbox_download_noise_file_size_change(self): + duration = 500 + self.animation_groupbox_download_noise_file = QPropertyAnimation(self.groupbox_download_noise_file, b"size") + self.animation_groupbox_download_noise_file.setDuration(duration) + + self.animation_groupbox_download_noise_file.setStartValue(QSize(self.groupbox_download_noise_file.width(), + self.groupbox_download_noise_file.height())) + + if self.groupbox_download_noise_file.isChecked(): + self.animation_groupbox_download_noise_file.setEndValue( + QSize(self.groupbox_download_noise_file.width(), + self.groupbox_download_noise_file.sizeHint().height())) + else: + self.animation_groupbox_download_noise_file.setEndValue(QSize(self.groupbox_download_noise_file.width(), 25)) + + self.animation_groupbox_download_noise_file.start() + + def groupbox_option_profile_tail_toggle(self): + if self.groupbox_compute_noise_from_profile_tail.isChecked() == True: + self.groupbox_download_noise_file.setChecked(False) + elif self.groupbox_compute_noise_from_profile_tail.isChecked() == False: + self.groupbox_download_noise_file.setChecked(True) + + def groupbox_option_profile_tail_size_change(self): + duration = 500 + self.animation_groupbox_option_profile_tail = QPropertyAnimation(self.groupbox_option_profile_tail, b"size") + self.animation_groupbox_option_profile_tail.setDuration(duration) + + self.animation_groupbox_option_profile_tail.setStartValue(QSize(self.groupbox_option_profile_tail.width(), + self.groupbox_option_profile_tail.height())) + + if self.groupbox_option_profile_tail.isChecked(): + self.animation_groupbox_option_profile_tail.setEndValue( + QSize(self.groupbox_option_profile_tail.width(), + self.groupbox_option_profile_tail.sizeHint().height())) + else: + self.animation_groupbox_option_profile_tail.setEndValue(QSize(self.groupbox_option_profile_tail.width(), 25)) + + self.animation_groupbox_option_profile_tail.start() + + # ------------------------------------------------------ + def compute_average_profile_tail(self): + + if (float(self.lineEdit_val1.text()) == 0) and (float(self.lineEdit_val2.text()) == 0): + if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + self.lineEdit_val1.setText(str( + '%.3f' % np.nanmin(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()]))) + self.lineEdit_val2.setText(str( + '%.3f' % np.nanmax(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()]))) + + elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + self.lineEdit_val1.setText(str( + '%.3f' % np.nanmin(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()]))) + self.lineEdit_val2.setText(str( + '%.3f' % np.nanmax(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()]))) + + # --- Find index of line edit value --- + if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + + val1 = np.where(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()] - + float(self.lineEdit_val1.text().replace(",", "."))) + == + np.nanmin(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()] - + float(self.lineEdit_val1.text().replace(",", ".")))) + )[0][0] + val2 = np.where(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()] - + float(self.lineEdit_val2.text().replace(",", "."))) + == + np.nanmin(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()] - + float(self.lineEdit_val2.text().replace(",", ".")))) + )[0][0] + + elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + + val1 = np.where(np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()] - + float(self.lineEdit_val1.text().replace(",", "."))) + == + np.nanmin(np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()] - + float(self.lineEdit_val1.text().replace(",", ".")))) + )[0][0] + val2 = np.where(np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()] - + float(self.lineEdit_val2.text().replace(",", "."))) + == + np.nanmin(np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()] - + float(self.lineEdit_val2.text().replace(",", ".")))) + )[0][0] + + print("val1 ", val1) + print("val2 ", val2) + + # --- Compute averaged signal --- + if stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()] = ( + np.nanmean(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][:, :, val1:val2], axis=2)) + elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()] = ( + np.nanmean(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][:, :, val1:val2], axis=2)) + elif stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()] = ( + np.nanmean(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][:, :, val1:val2], axis=2)) + + # for i in range(self.combobox_freq_noise_from_profile_tail.count()): + # print("BS_mean shape ", stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()][i].shape) + # print("BS_mean ", stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()][i]) + + def plot_averaged_profile_tail(self): + + # --- Plot averaged signal --- + + if stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + + self.verticalLayout_groupbox_plot_profile_tail.removeWidget(self.canvas_profile_tail) + + self.fig_profile_tail, self.axis_profile_tail = plt.subplots(nrows=1, ncols=1, layout='constrained') + self.canvas_profile_tail = FigureCanvas(self.fig_profile_tail) + + self.verticalLayout_groupbox_plot_profile_tail.addWidget(self.canvas_profile_tail) + + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + + self.axis_profile_tail.plot( + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq_noise_from_profile_tail.currentIndex()], + stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq_noise_from_profile_tail.currentIndex()], + color="blue", linewidth=1) + self.axis_profile_tail.plot( + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()], + float(self.lineEdit_profile_tail_value.text().replace(",", ".")) * + np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()].shape[0]), + linestyle='dashed', linewidth=2, color='red') + + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + + print(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()].shape) + self.axis_profile_tail.plot( + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq_noise_from_profile_tail.currentIndex()], + stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq_noise_from_profile_tail.currentIndex()], + color="blue", linewidth=1) + self.axis_profile_tail.plot( + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()], + float(self.lineEdit_profile_tail_value.text().replace(",", ".")) * + np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()].shape[0]), + linestyle='dashed', linewidth=2, color='red') + + self.axis_profile_tail.set_yscale('log') + self.axis_profile_tail.tick_params(axis='both', labelsize=8) + # self.axis_profile_tail.set_yticklabels(fontsize=8) + self.axis_profile_tail.text(.98, .03, "Depth", + fontsize=8, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.9, + horizontalalignment='right', verticalalignment='bottom', rotation='horizontal', + transform=self.axis_profile_tail.transAxes) + self.axis_profile_tail.text(.1, .50, "BS signal", + fontsize=8, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.9, + horizontalalignment='right', verticalalignment='bottom', rotation='vertical', + transform=self.axis_profile_tail.transAxes) + self.axis_profile_tail.text(.98, .85, + stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()], + fontsize=10, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, + horizontalalignment='right', verticalalignment='bottom', + transform=self.axis_profile_tail.transAxes) + + self.fig_profile_tail.canvas.draw_idle() + + # ------------------------------------------------------ + + def combobox_acoustic_data_choice_change_index(self): + + # self.combobox_freq_noise_from_profile_tail.currentIndexChanged.connect(self.compute_average_profile_tail) + # self.combobox_freq_noise_from_profile_tail.currentIndexChanged.connect(self.plot_averaged_profile_tail) + + self.compute_average_profile_tail() + self.plot_averaged_profile_tail() + + self.lineEdit_SNR_criterion.setText(str(stg.SNR_filter_value[self.combobox_acoustic_data_choice.currentIndex()])) - self.spinbox_SNR_criterion.setValue(stg.SNR_filter_value[self.combobox_fileListWidget.currentIndex()]) self.plot_transect_with_SNR_data() # self.plot_BS_signal_filtered_with_SNR() self.plot_pre_processed_BS_signal() - self.spinbox_average_horizontal.setValue(stg.Nb_cells_to_average_BS_signal[self.combobox_fileListWidget.currentIndex()]) + # self.spinbox_average_horizontal.setValue(stg.Nb_cells_to_average_BS_signal[self.combobox_acoustic_data_choice.currentIndex()]) + self.lineEdit_horizontal_average.setText(str(stg.Nb_cells_to_average_BS_signal[self.combobox_acoustic_data_choice.currentIndex()])) # self.plot_profile_and_position_on_transect_with_slider() self.combobox_frequency_profile.clear() self.combobox_frequency_profile.addItems( - [f for f in stg.freq_text[self.combobox_fileListWidget.currentIndex()]]) + [f for f in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]]) self.plot_pre_processed_profile() - if self.combobox_fileListWidget.count() > 0: + if self.combobox_acoustic_data_choice.count() > 0: - for i in range(self.combobox_fileListWidget.count()): + for i in range(self.combobox_acoustic_data_choice.count()): eval("self.lineEdit_list_pre_processed_data_" + str(i) + ".setDisabled(True)") # eval("self.lineEdit_list_pre_processed_data_" + str( - self.combobox_fileListWidget.currentIndex()) + ".setEnabled(True)") - - def onClicked_radiobutton_noise_data(self): - # radiobutton = self.sender() - # if radiobutton.isChecked(): - if self.radiobutton_file.isChecked(): - self.groupbox_download_noise_file.setVisible(True) - self.groupbox_compute_noise_from_profile_tail.setVisible(False) - self.groupbox_compute_noise_from_value.setVisible(False) - - elif self.radiobutton_profile_tail.isChecked(): - self.groupbox_download_noise_file.setVisible(False) - self.groupbox_compute_noise_from_profile_tail.setVisible(True) - self.groupbox_compute_noise_from_value.setVisible(False) - - elif self.radiobutton_value.isChecked(): - self.groupbox_download_noise_file.setVisible(False) - self.groupbox_compute_noise_from_profile_tail.setVisible(False) - self.groupbox_compute_noise_from_value.setVisible(True) + self.combobox_acoustic_data_choice.currentIndex()) + ".setEnabled(True)") def clear_noise_data(self): - stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()] = np.array([]) - stg.BS_noise_averaged_data[self.combobox_fileListWidget.currentIndex()] = np.array([]) - stg.SNR_raw_data[self.combobox_fileListWidget.currentIndex()] = np.array([]) - stg.SNR_cross_section[self.combobox_fileListWidget.currentIndex()] = np.array([]) - stg.SNR_stream_bed[self.combobox_fileListWidget.currentIndex()] = np.array([]) - stg.time_noise[self.combobox_fileListWidget.currentIndex()] = np.array([]) - stg.noise_method[self.combobox_fileListWidget.currentIndex()] = 0 - stg.SNR_filter_value[self.combobox_fileListWidget.currentIndex()] = 0 + stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) + stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) + stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) + stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) + stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) + stg.time_noise[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) + stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] = 0 + stg.SNR_filter_value[self.combobox_acoustic_data_choice.currentIndex()] = 0 - stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()] = np.array([]) - stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()] = np.array([]) - # stg.BS_raw_data_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()] = np.array([]) + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) + # stg.BS_raw_data_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) - stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()] = np.array([]) - stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()] = np.array([]) - # stg.BS_cross_section_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()] = np.array([]) + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) + # stg.BS_cross_section_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) - stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()] = np.array([]) - stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()] = np.array([]) - # stg.BS_stream_bed_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()] = np.array([]) + stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) + # stg.BS_stream_bed_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) print("All is clear") - if self.radiobutton_file.isChecked(): + if stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 0: self.lineEdit_noise_file.clear() - elif self.radiobutton_profile_tail.isChecked(): - pass + elif stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 1: + self.lineEdit_val1.clear() + self.lineEdit_val1.setText("0.00") - elif self.radiobutton_value.isChecked(): - self.spinbox_compute_noise_from_value.setValue(0) + self.lineEdit_val2.clear() + self.lineEdit_val2.setText("0.00") - self.spinbox_SNR_criterion.setValue(0) - self.spinbox_average_horizontal.setValue(0) + self.lineEdit_profile_tail_value.clear() + self.lineEdit_profile_tail_value.setText("0.0000") + + self.verticalLayout_groupbox_plot_profile_tail.removeWidget(self.canvas_profile_tail) + self.canvas_profile_tail = FigureCanvas() + self.verticalLayout_groupbox_plot_profile_tail.addWidget(self.canvas_profile_tail) + + self.lineEdit_SNR_criterion.setText("0.00") + self.lineEdit_horizontal_average.setText("0.00") # self.label_profile_number.clear() # self.label_profile_number.setText("Profile ") @@ -1477,17 +917,17 @@ class SignalProcessingTab(QWidget): def open_dialog_box(self): - if self.sender().objectName() == "pushbutton_noise_file": + if self.combobox_acoustic_data_choice.count() > 0: filename = QFileDialog.getOpenFileNames(self, "AQUAscat Noise file", - [stg.path_BS_raw_data[-1] if self.combobox_fileListWidget.count() > 0 else ""][0], + [stg.path_BS_raw_data[-1] if self.combobox_acoustic_data_choice.count() > 0 else ""][0], "Aquascat file (*.aqa)", options=QFileDialog.DontUseNativeDialog) - dir_name = path.dirname(filename[0]) - name = path.basename(filename[0]) + dir_name = path.dirname(filename[0][0]) + name = path.basename(filename[0][0]) try: - stg.path_BS_noise_data[self.combobox_fileListWidget.currentIndex()] = dir_name - stg.filename_BS_noise_data[self.combobox_fileListWidget.currentIndex()] = name + stg.path_BS_noise_data[self.combobox_acoustic_data_choice.currentIndex()] = dir_name + stg.filename_BS_noise_data[self.combobox_acoustic_data_choice.currentIndex()] = name print("stg.path_BS_noise_data : ", stg.path_BS_noise_data) print("stg.filename_BS_noise_data : ", stg.filename_BS_noise_data) self.load_noise_data_and_compute_SNR() @@ -1502,8 +942,8 @@ class SignalProcessingTab(QWidget): msgBox.exec() else: - self.lineEdit_noise_file.setText(stg.filename_BS_noise_data[self.combobox_fileListWidget.currentIndex()]) - self.lineEdit_noise_file.setToolTip(stg.path_BS_noise_data[self.combobox_fileListWidget.currentIndex()]) + self.lineEdit_noise_file.setText(stg.filename_BS_noise_data[self.combobox_acoustic_data_choice.currentIndex()]) + self.lineEdit_noise_file.setToolTip(stg.path_BS_noise_data[self.combobox_acoustic_data_choice.currentIndex()]) # self.plot_noise() self.plot_transect_with_SNR_data() # self.combobox_freq_noise.addItems([f for f in stg.freq_text]) @@ -1514,30 +954,30 @@ class SignalProcessingTab(QWidget): # self.remove_point_with_snr_filter() self.combobox_frequency_profile.clear() - self.combobox_frequency_profile.addItems([f for f in stg.freq_text[self.combobox_fileListWidget.currentIndex()]]) + self.combobox_frequency_profile.addItems([f for f in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]]) self.combobox_frequency_profile.currentIndexChanged.connect(self.plot_pre_processed_BS_signal) self.combobox_frequency_profile.currentIndexChanged.connect(self.update_plot_pre_processed_profile) - if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - self.slider.setMaximum(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape[1]) + self.slider.setMaximum(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1]) else: - self.slider.setMaximum(stg.time[self.combobox_fileListWidget.currentIndex()].shape[1]) + self.slider.setMaximum(stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1]) - # if len(stg.BS_stream_bed) and stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()].shape: + # if len(stg.BS_stream_bed) and stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape: # - # self.slider.setMaximum(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape[1]) + # self.slider.setMaximum(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1]) # - # elif (stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()].shape[2] - # < stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()].shape[2]): + # elif (stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[2] + # < stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape[2]): # - # self.slider.setMaximum(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape[1]) + # self.slider.setMaximum(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1]) # # else: # - # self.slider.setMaximum(stg.time[self.combobox_fileListWidget.currentIndex()].shape[1]) + # self.slider.setMaximum(stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1]) # !!!!! A DECOCHER !!!!!!!! # self.compute_averaged_BS_data() @@ -1548,67 +988,67 @@ class SignalProcessingTab(QWidget): self.plot_pre_processed_BS_signal() self.plot_pre_processed_profile() - stg.noise_method[self.combobox_fileListWidget.currentIndex()] = 1 + stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] = 0 self.activate_list_of_pre_processed_data() def load_noise_data_and_compute_SNR(self): - stg.noise_method[self.combobox_fileListWidget.currentIndex()] = 1 + stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] = 0 - noise_data = AcousticDataLoader(stg.path_BS_noise_data[self.combobox_fileListWidget.currentIndex()] + + noise_data = AcousticDataLoader(stg.path_BS_noise_data[self.combobox_acoustic_data_choice.currentIndex()] + "/" + - stg.filename_BS_noise_data[self.combobox_fileListWidget.currentIndex()]) - stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()] = noise_data._BS_raw_data + stg.filename_BS_noise_data[self.combobox_acoustic_data_choice.currentIndex()]) + stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = noise_data._BS_raw_data # stg.date_noise = noise_data._date # stg.hour_noise = noise_data._hour - stg.time_noise[self.combobox_fileListWidget.currentIndex()] = noise_data._time - stg.depth_noise[self.combobox_fileListWidget.currentIndex()] = noise_data._r + stg.time_noise[self.combobox_acoustic_data_choice.currentIndex()] = noise_data._time + stg.depth_noise[self.combobox_acoustic_data_choice.currentIndex()] = noise_data._r # stg.time_snr_reshape = stg.time_reshape # print("len(stg.BS_cross_section) : ", len(stg.BS_cross_section)) # print("stg.BS_cross_section[0] : ", stg.BS_cross_section[0].shape) # print("len(stg.BS_stream_bed) : ", len(stg.BS_stream_bed)) - if stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): print("Je suis dans stream bed") - noise = np.zeros(stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()].shape) + noise = np.zeros(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape) for f, _ in enumerate(noise_data._freq): noise[f, :, :] = np.mean( - stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()][f, :, :], axis=(0, 1)) - stg.BS_noise_averaged_data[self.combobox_fileListWidget.currentIndex()] = noise - stg.SNR_stream_bed[self.combobox_fileListWidget.currentIndex()] = ( - np.divide((stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()] - - stg.BS_noise_averaged_data[self.combobox_fileListWidget.currentIndex()]) ** 2, - stg.BS_noise_averaged_data[self.combobox_fileListWidget.currentIndex()] ** 2)) + stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, :], axis=(0, 1)) + stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = noise + stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()] = ( + np.divide((stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()] - + stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()]) ** 2, + stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] ** 2)) - elif stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): print("Je suis dans cross section") - noise = np.zeros(stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()].shape) + noise = np.zeros(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape) for f, _ in enumerate(noise_data._freq): noise[f, :, :] = np.mean( - stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()][f, :, :], axis=(0, 1)) - stg.BS_noise_averaged_data[self.combobox_fileListWidget.currentIndex()] = noise - stg.SNR_cross_section[self.combobox_fileListWidget.currentIndex()] = ( - np.divide((stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()] - - stg.BS_noise_averaged_data[self.combobox_fileListWidget.currentIndex()]) ** 2, - stg.BS_noise_averaged_data[self.combobox_fileListWidget.currentIndex()] ** 2)) + stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, :], axis=(0, 1)) + stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = noise + stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()] = ( + np.divide((stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()] - + stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()]) ** 2, + stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] ** 2)) # stg.SNR_reshape = np.reshape(stg.SNR_cross_section, (stg.r.shape[1] * stg.t.shape[1], stg.freq.shape[0]), order="F") else: print("Je suis dans raw") - noise = np.zeros(stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()].shape) + noise = np.zeros(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape) for f, _ in enumerate(noise_data._freq): noise[f, :, :] = np.mean( - stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()][f, :, :], axis=(0, 1)) - stg.BS_noise_averaged_data[self.combobox_fileListWidget.currentIndex()] = noise - stg.SNR_raw_data[self.combobox_fileListWidget.currentIndex()] = ( - np.divide((stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()] - - stg.BS_noise_averaged_data[self.combobox_fileListWidget.currentIndex()]) ** 2, - stg.BS_noise_averaged_data[self.combobox_fileListWidget.currentIndex()] ** 2)) + stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, :], axis=(0, 1)) + stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = noise + stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = ( + np.divide((stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()] - + stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()]) ** 2, + stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] ** 2)) @@ -1675,69 +1115,70 @@ class SignalProcessingTab(QWidget): # self.compute_averaged_BS_data() # self.plot_profile_and_position_on_transect_with_slider() - def compute_noise_from_value(self): + def compute_noise_from_profile_tail_value(self): - stg.noise_method[self.combobox_fileListWidget.currentIndex()] = 3 + stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] = 1 - stg.noise_value[self.combobox_fileListWidget.currentIndex()] = self.spinbox_compute_noise_from_value.value() + stg.noise_value[self.combobox_acoustic_data_choice.currentIndex()] = ( + float(self.lineEdit_profile_tail_value.text().replace(",", "."))) - # stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()] = ( - # np.full(stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()].shape, + # stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = ( + # np.full(stg.BS_raw_data[self.combobox_acoustic_data_choice.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,): + if stg.BS_stream_bed[self.combobox_acoustic_data_choice.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_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = ( + np.full(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape, + float(self.lineEdit_profile_tail_value.text().replace(",", ".")))) - 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]]) - stg.SNR_stream_bed[self.combobox_fileListWidget.currentIndex()] = ( - np.divide((stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()] - - stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()]) ** 2, - stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()] ** 2)) + stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = ( + stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()][:, :, + :stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape[2]]) + stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()] = ( + np.divide((stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()] + - stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()]) ** 2, + stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] ** 2)) - stg.time_noise[self.combobox_fileListWidget.currentIndex()] = ( - stg.time_cross_section[self.combobox_fileListWidget.currentIndex()]) + stg.time_noise[self.combobox_acoustic_data_choice.currentIndex()] = ( + stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()]) - elif stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_cross_section[self.combobox_acoustic_data_choice.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_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = ( + np.full(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape, + float(self.lineEdit_profile_tail_value.text().replace(",", ".")))) - 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]]) - stg.SNR_cross_section[self.combobox_fileListWidget.currentIndex()] = ( - np.divide((stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()] - - stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()]) ** 2, - stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()] ** 2)) + stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = ( + stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()][:, :, + :stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[2]]) + stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()] = ( + np.divide((stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()] + - stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()]) ** 2, + stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] ** 2)) - stg.time_noise[self.combobox_fileListWidget.currentIndex()] = ( - stg.time_cross_section[self.combobox_fileListWidget.currentIndex()]) + stg.time_noise[self.combobox_acoustic_data_choice.currentIndex()] = ( + stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()]) 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_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = ( + np.full(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape, + float(self.lineEdit_profile_tail_value.text().replace(",", ".")))) - 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()] = ( - np.divide((stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()] - - stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()]) ** 2, - stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()] ** 2)) + stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = ( + stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()]) + stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = ( + np.divide((stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()] + - stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()]) ** 2, + stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] ** 2)) - stg.time_noise[self.combobox_fileListWidget.currentIndex()] = ( - stg.time[self.combobox_fileListWidget.currentIndex()]) + stg.time_noise[self.combobox_acoustic_data_choice.currentIndex()] = ( + stg.time[self.combobox_acoustic_data_choice.currentIndex()]) - print("stg.BS_noise_averaged_data ", stg.BS_noise_averaged_data) + # print("stg.BS_noise_averaged_data ", stg.BS_noise_averaged_data) # if len(stg.BS_stream_bed) == 0: # @@ -1772,26 +1213,26 @@ class SignalProcessingTab(QWidget): self.combobox_frequency_profile.clear() self.combobox_frequency_profile.addItems( - [f for f in stg.freq_text[self.combobox_fileListWidget.currentIndex()]]) + [f for f in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]]) # --- Trigger graphic widgets --- - if stg.SNR_filter_value[self.combobox_fileListWidget.currentIndex()] == 0: - self.spinbox_SNR_criterion.setValue(0) + if stg.SNR_filter_value[self.combobox_acoustic_data_choice.currentIndex()] == 0: + self.lineEdit_SNR_criterion.setText("0.00") else: - self.spinbox_SNR_criterion.setValue(stg.SNR_filter_value[self.combobox_fileListWidget.currentIndex()]) + self.lineEdit_SNR_criterion.setText(str(stg.SNR_filter_value[self.combobox_acoustic_data_choice.currentIndex()])) # self.remove_point_with_snr_filter() # self.combobox_frequency_profile.addItems( - # [f for f in stg.freq_text[self.combobox_fileListWidget.currentIndex()]]) + # [f for f in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]]) # self.combobox_frequency_profile.currentIndexChanged.connect( # self.update_plot_pre_processed_profile) - if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): - self.slider.setMaximum(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape[1]) + if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + self.slider.setMaximum(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1]) else: - self.slider.setMaximum(stg.time[self.combobox_fileListWidget.currentIndex()].shape[1]) + self.slider.setMaximum(stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1]) self.plot_transect_with_SNR_data() # self.compute_averaged_BS_data() @@ -1855,13 +1296,13 @@ class SignalProcessingTab(QWidget): # elif self.canvas_SNR == None: else: - if ((self.combobox_fileListWidget.currentIndex() != -1) - and (stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()].shape != (0,))): + if ((self.combobox_acoustic_data_choice.currentIndex() != -1) + and (stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))): self.verticalLayout_groupbox_plot_SNR.removeWidget(self.toolbar_SNR) self.verticalLayout_groupbox_plot_SNR.removeWidget(self.scroll_SNR) - self.fig_SNR, self.axis_SNR = plt.subplots(nrows=stg.freq[self.combobox_fileListWidget.currentIndex()].shape[0], ncols=1, sharex=True, sharey=False, layout='constrained') + self.fig_SNR, self.axis_SNR = plt.subplots(nrows=stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], ncols=1, sharex=True, sharey=False, layout='constrained') self.canvas_SNR = FigureCanvas(self.fig_SNR) # self.verticalLayout_groupbox_plot_Noise_SNR.addWidget(self.canvas_SNR) self.toolbar_SNR = NavigationToolBar(self.canvas_SNR, self) @@ -1880,41 +1321,41 @@ class SignalProcessingTab(QWidget): self.verticalLayout_groupbox_plot_SNR.addWidget(self.toolbar_SNR) self.verticalLayout_groupbox_plot_SNR.addWidget(self.scroll_SNR) - for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): + for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): - if stg.SNR_stream_bed[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.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, :]) + stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :], + stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :]) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): x, y = np.meshgrid( - stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], - stg.depth[self.combobox_fileListWidget.currentIndex()][f, :]) + stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :], + stg.depth[self.combobox_acoustic_data_choice.currentIndex()][f, :]) else: - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): x, y = np.meshgrid( - stg.time[self.combobox_fileListWidget.currentIndex()][f, :], - stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][f, :]) + stg.time[self.combobox_acoustic_data_choice.currentIndex()][f, :], + stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :]) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): x, y = np.meshgrid( - stg.time[self.combobox_fileListWidget.currentIndex()][f, :], - stg.depth[self.combobox_fileListWidget.currentIndex()][f, :]) + stg.time[self.combobox_acoustic_data_choice.currentIndex()][f, :], + stg.depth[self.combobox_acoustic_data_choice.currentIndex()][f, :]) print("0 plot SNR with SNR_stream_bed") - val_min = np.nanmin(stg.SNR_stream_bed[self.combobox_fileListWidget.currentIndex()][f, :, :]) - val_max = np.nanmax(stg.SNR_stream_bed[self.combobox_fileListWidget.currentIndex()][f, :, :]) + val_min = np.nanmin(stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) + val_max = np.nanmax(stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) if val_min == val_max: levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) @@ -1930,43 +1371,43 @@ class SignalProcessingTab(QWidget): norm = BoundaryNorm(boundaries=bounds, ncolors=300) cf = (self.axis_SNR[f].contourf(x, -y, - stg.SNR_stream_bed[self.combobox_fileListWidget.currentIndex()][f, :, :], + stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, :, :], levels, cmap='gist_rainbow', norm=norm)) - elif stg.SNR_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.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, :]) + stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :], + stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :]) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): x, y = np.meshgrid( - stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][f, :], - stg.depth[self.combobox_fileListWidget.currentIndex()][f, :]) + stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :], + stg.depth[self.combobox_acoustic_data_choice.currentIndex()][f, :]) else: - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): x, y = np.meshgrid( - stg.time[self.combobox_fileListWidget.currentIndex()][f, :], - stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][f, :]) + stg.time[self.combobox_acoustic_data_choice.currentIndex()][f, :], + stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :]) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): x, y = np.meshgrid( - stg.time[self.combobox_fileListWidget.currentIndex()][f, :], - stg.depth[self.combobox_fileListWidget.currentIndex()][f, :]) + stg.time[self.combobox_acoustic_data_choice.currentIndex()][f, :], + stg.depth[self.combobox_acoustic_data_choice.currentIndex()][f, :]) print("1 plot SNR with SNR_cross_section") - val_min = np.nanmin(stg.SNR_cross_section[self.combobox_fileListWidget.currentIndex()][f, :, :]) - val_max = np.nanmax(stg.SNR_cross_section[self.combobox_fileListWidget.currentIndex()][f, :, :]) + val_min = np.nanmin(stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) + val_max = np.nanmax(stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) if val_min == val_max: levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) else: @@ -1982,17 +1423,17 @@ class SignalProcessingTab(QWidget): cf = (self.axis_SNR[f].contourf(x, -y, stg.SNR_cross_section[ - self.combobox_fileListWidget.currentIndex()][f, :, :], + self.combobox_acoustic_data_choice.currentIndex()][f, :, :], levels, cmap='gist_rainbow', norm=norm)) else: - x, y = np.meshgrid(stg.time[self.combobox_fileListWidget.currentIndex()][0, :], - stg.depth[self.combobox_fileListWidget.currentIndex()][0, :]) + x, y = np.meshgrid(stg.time[self.combobox_acoustic_data_choice.currentIndex()][0, :], + stg.depth[self.combobox_acoustic_data_choice.currentIndex()][0, :]) print("0 plot SNR with SNR_raw_data") - val_min = np.nanmin(stg.SNR_raw_data[self.combobox_fileListWidget.currentIndex()][f, :, :]) - val_max = np.nanmax(stg.SNR_raw_data[self.combobox_fileListWidget.currentIndex()][f, :, :]) + val_min = np.nanmin(stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) + val_max = np.nanmax(stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) if val_min == val_max: levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) else: @@ -2000,24 +1441,29 @@ class SignalProcessingTab(QWidget): val_min = 1e-5 if val_max > 1000: levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) + print("levels = ", levels) + bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] + print("bounds = ", bounds) + norm = BoundaryNorm(boundaries=bounds, ncolors=300) else: levels = np.array([00.1, 1, 2, 10, 100, val_max]) + print("levels = ", levels) + bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1000] + print("bounds = ", bounds) + norm = BoundaryNorm(boundaries=bounds, ncolors=300) - bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] - norm = BoundaryNorm(boundaries=bounds, ncolors=300) - - print("self.combobox_fileListWidget.currentIndex() ", self.combobox_fileListWidget.currentIndex()) + print("self.combobox_acoustic_data_choice.currentIndex() ", self.combobox_acoustic_data_choice.currentIndex()) print("x ", x.shape) print("y ", y.shape) - print("stg.SNR_raw_data", stg.SNR_raw_data[self.combobox_fileListWidget.currentIndex()].shape) + print("stg.SNR_raw_data", stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape) cf = (self.axis_SNR[f].contourf(x, -y, stg.SNR_raw_data[ - self.combobox_fileListWidget.currentIndex()][f, :, :], + self.combobox_acoustic_data_choice.currentIndex()][f, :, :], levels, cmap='gist_rainbow', norm=norm)) - self.axis_SNR[f].text(1, .70, stg.freq_text[self.combobox_fileListWidget.currentIndex()][f], + self.axis_SNR[f].text(1, .70, stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][f], fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, horizontalalignment='right', verticalalignment='bottom', transform=self.axis_SNR[f].transAxes) @@ -2060,49 +1506,52 @@ class SignalProcessingTab(QWidget): else: - stg.SNR_filter_value[self.combobox_fileListWidget.currentIndex()] = self.spinbox_SNR_criterion.value() + stg.SNR_filter_value[self.combobox_acoustic_data_choice.currentIndex()] = ( + float(self.lineEdit_SNR_criterion.text().replace(",", "."))) - if stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): stg.BS_stream_bed_pre_process_SNR = deepcopy(stg.BS_stream_bed) # stg.Noise_data = deepcopy(stg.BS_noise_averaged_data[:, :, :stg.t.shape[1]]) # stg.SNR_data_average = np.divide( # (stg.BS_stream_bed_pre_process_SNR - stg.Noise_data) ** 2, stg.Noise_data ** 2) - for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ + for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ f, - np.where(stg.SNR_stream_bed[self.combobox_fileListWidget.currentIndex()][f, :, :] < self.spinbox_SNR_criterion.value())[0], - np.where(stg.SNR_stream_bed[self.combobox_fileListWidget.currentIndex()][f, :, :] < self.spinbox_SNR_criterion.value())[1]] \ + np.where(stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] < + float(self.lineEdit_SNR_criterion.text().replace(",", ".")))[0], + np.where(stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] < + float(self.lineEdit_SNR_criterion.text().replace(",", ".")))[1]] \ = np.nan - elif stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): stg.BS_cross_section_pre_process_SNR = deepcopy(stg.BS_cross_section) # stg.Noise_data = deepcopy(stg.BS_noise_averaged_data[:, :, :stg.t.shape[1]]) # stg.SNR_data_average = np.divide( # (stg.BS_stream_bed_pre_process_SNR - stg.Noise_data) ** 2, stg.Noise_data ** 2) - for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ + for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ f, - np.where(stg.SNR_cross_section[self.combobox_fileListWidget.currentIndex()][f, :, - :] < self.spinbox_SNR_criterion.value())[0], - np.where(stg.SNR_cross_section[self.combobox_fileListWidget.currentIndex()][f, :, - :] < self.spinbox_SNR_criterion.value())[1]] \ + np.where(stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :, + :] < float(self.lineEdit_SNR_criterion.text().replace(",", ".")))[0], + np.where(stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :, + :] < float(self.lineEdit_SNR_criterion.text().replace(",", ".")))[1]] \ = np.nan else: stg.BS_raw_data_pre_process_SNR = deepcopy(stg.BS_raw_data) - for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ + for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ f, - np.where(stg.SNR_raw_data[self.combobox_fileListWidget.currentIndex()][f, :, - :] < self.spinbox_SNR_criterion.value())[0], - np.where(stg.SNR_raw_data[self.combobox_fileListWidget.currentIndex()][f, :, - :] < self.spinbox_SNR_criterion.value())[1]] \ + np.where(stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, + :] < float(self.lineEdit_SNR_criterion.text().replace(",", ".")))[0], + np.where(stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, + :] < float(self.lineEdit_SNR_criterion.text().replace(",", ".")))[1]] \ = np.nan @@ -2145,16 +1594,17 @@ class SignalProcessingTab(QWidget): def plot_pre_processed_BS_signal(self): - self.spinbox_average_horizontal.setValue( - stg.Nb_cells_to_average_BS_signal[self.combobox_fileListWidget.currentIndex()]) + # self.spinbox_average_horizontal.setValue( + # stg.Nb_cells_to_average_BS_signal[self.combobox_acoustic_data_choice.currentIndex()]) + self.lineEdit_horizontal_average.setText(str(stg.Nb_cells_to_average_BS_signal[self.combobox_acoustic_data_choice.currentIndex()])) - if ((self.combobox_fileListWidget.currentIndex() != -1) - and (stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()].shape != (0,))): + if ((self.combobox_acoustic_data_choice.currentIndex() != -1) + and (stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))): self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.removeWidget(self.toolbar_BS) self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.removeWidget(self.scroll_BS) - self.fig_BS, self.axis_BS = plt.subplots(nrows=stg.freq[self.combobox_fileListWidget.currentIndex()].shape[0], ncols=1, sharex=True, sharey=False, layout="constrained") + self.fig_BS, self.axis_BS = plt.subplots(nrows=stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], ncols=1, sharex=True, sharey=False, layout="constrained") self.canvas_BS = FigureCanvas(self.fig_BS) self.toolbar_BS = NavigationToolBar(self.canvas_BS, self) # self.verticalLayout_groupbox_plot_SNR.addWidget(self.canvas_SNR) @@ -2170,170 +1620,170 @@ 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.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - x_time = stg.time_cross_section[self.combobox_fileListWidget.currentIndex()] - y_depth = stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()] + x_time = stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()] + y_depth = stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()] - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - x_time = stg.time_cross_section[self.combobox_fileListWidget.currentIndex()] - y_depth = stg.depth[self.combobox_fileListWidget.currentIndex()] + x_time = stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()] + y_depth = stg.depth[self.combobox_acoustic_data_choice.currentIndex()] else: - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - x_time = stg.time[self.combobox_fileListWidget.currentIndex()] - y_depth = stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()] + x_time = stg.time[self.combobox_acoustic_data_choice.currentIndex()] + y_depth = stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()] - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - x_time = stg.time[self.combobox_fileListWidget.currentIndex()] - y_depth = stg.depth[self.combobox_fileListWidget.currentIndex()] + x_time = stg.time[self.combobox_acoustic_data_choice.currentIndex()] + y_depth = stg.depth[self.combobox_acoustic_data_choice.currentIndex()] - for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): + for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): - if stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - val_min = np.nanmin(stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, :, :]) - val_max = np.nanmax(stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, :, :]) + val_min = np.nanmin(stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) + val_max = np.nanmax(stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) if val_min == 0: val_min = 1e-5 pcm = self.axis_BS[f].pcolormesh(x_time[f, :], -y_depth[f, :], - stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, :, :], + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - self.axis_BS[f].plot(x_time[f, :], -stg.depth_bottom[self.combobox_fileListWidget.currentIndex()], + self.axis_BS[f].plot(x_time[f, :], -stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()], color='black', linewidth=1, linestyle="solid") - elif stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): val_min = np.nanmin( - stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, :, :]) + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) val_max = np.nanmax( - stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, :, :]) + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) if val_min == 0: val_min = 1e-5 pcm = self.axis_BS[f].pcolormesh( x_time[f, :], -y_depth[f, :], - stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, :, :], + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - elif stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): val_min = np.nanmin( - stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, :, :]) + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) val_max = np.nanmax( - stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, :, :]) + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) if val_min == 0: val_min = 1e-5 pcm = self.axis_BS[f].pcolormesh(x_time[f, :], -y_depth[f, :], stg.BS_raw_data_pre_process_average[ - self.combobox_fileListWidget.currentIndex()][f, :, :], + self.combobox_acoustic_data_choice.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - elif stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - val_min = np.nanmin(stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, :, :]) - val_max = np.nanmax(stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, :, :]) + val_min = np.nanmin(stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) + val_max = np.nanmax(stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) if val_min == 0: val_min = 1e-5 pcm = self.axis_BS[f].pcolormesh(x_time[f, :], -y_depth[f, :], - stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, :, :], + stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) self.axis_BS[f].plot(x_time[f, :], - -stg.depth_bottom[self.combobox_fileListWidget.currentIndex()], + -stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()], color='black', linewidth=1, linestyle="solid") - elif stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): val_min = np.nanmin( - stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, :, :]) + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) val_max = np.nanmax( - stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, :, :]) + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) if val_min == 0: val_min = 1e-5 pcm = self.axis_BS[f].pcolormesh( x_time[f, :], -y_depth[f, :], - stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, :, :], + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - elif stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): val_min = np.nanmin( - stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, :, :]) + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) val_max = np.nanmax( - stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, :, :]) + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) if val_min == 0: val_min = 1e-5 pcm = self.axis_BS[f].pcolormesh(x_time[f, :], -y_depth[f, :], stg.BS_raw_data_pre_process_SNR[ - self.combobox_fileListWidget.currentIndex()][f, :, :], + self.combobox_acoustic_data_choice.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - elif stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): val_min = np.nanmin( - stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()][f, :, :]) + stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) val_max = np.nanmax( - stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()][f, :, :]) + stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) if val_min == 0: val_min = 1e-5 pcm = self.axis_BS[f].pcolormesh(x_time[f, :], -y_depth[f, :], stg.BS_stream_bed[ - self.combobox_fileListWidget.currentIndex()][f, :, :], + self.combobox_acoustic_data_choice.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - elif stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): val_min = np.nanmin( - stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()][f, :, :]) + stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) val_max = np.nanmax( - stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()][f, :, :]) + stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) if val_min == 0: val_min = 1e-5 pcm = self.axis_BS[f].pcolormesh(x_time[f, :], -y_depth[f, :], stg.BS_cross_section[ - self.combobox_fileListWidget.currentIndex()][f, :, :], + self.combobox_acoustic_data_choice.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - elif stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): val_min = np.nanmin( - stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()][f, :, :]) + stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) val_max = np.nanmax( - stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()][f, :, :]) + stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) if val_min == 0: val_min = 1e-5 pcm = self.axis_BS[f].pcolormesh(x_time[f, :], -y_depth[f, :], stg.BS_raw_data[ - self.combobox_fileListWidget.currentIndex()][f, :, :], + self.combobox_acoustic_data_choice.currentIndex()][f, :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - self.axis_BS[f].text(1, .70, stg.freq_text[self.combobox_fileListWidget.currentIndex()][f], + self.axis_BS[f].text(1, .70, stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][f], fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, horizontalalignment='right', verticalalignment='bottom', transform=self.axis_BS[f].transAxes) @@ -2347,47 +1797,47 @@ class SignalProcessingTab(QWidget): 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.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): # - # if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): # # self.red_line_return, = self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( - # stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][ + # stg.time_cross_section[self.combobox_acoustic_data_choice.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()][ + # np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1]), + # -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], # linestyle="solid", linewidth=2, color="red") # - # elif stg.time[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): # # self.red_line_return, = self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( - # stg.time[self.combobox_fileListWidget.currentIndex()][ + # stg.time[self.combobox_acoustic_data_choice.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()][ + # np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1]), + # -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], # linestyle="solid", linewidth=2, color="red") # - # elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): # - # if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): # # self.red_line_return, = self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( - # stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][ + # stg.time_cross_section[self.combobox_acoustic_data_choice.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()][ + # np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1]), + # -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], # linestyle="solid", linewidth=2, color="red") # - # elif stg.time[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): # # self.red_line_return, = self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( - # stg.time[self.combobox_fileListWidget.currentIndex()][ + # stg.time[self.combobox_acoustic_data_choice.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()][ + # np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1]), + # -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], # linestyle="solid", linewidth=2, color="red") @@ -2413,138 +1863,138 @@ class SignalProcessingTab(QWidget): print("Je change la valeur du moyennage") print(stg.nb_profiles_per_sec) - print(stg.nb_profiles_per_sec[self.combobox_fileListWidget.currentIndex()][0]) - print(self.combobox_fileListWidget.currentIndex()) + print(stg.nb_profiles_per_sec[self.combobox_acoustic_data_choice.currentIndex()][0]) + print(self.combobox_acoustic_data_choice.currentIndex()) self.label_cells_horizontal.clear() self.label_cells_horizontal.setText( "cells = +/- " + - str((self.spinbox_average_horizontal.value() // 2) * - (1 / stg.nb_profiles_per_sec[self.combobox_fileListWidget.currentIndex()][0])) + + str((float(self.lineEdit_horizontal_average.text().replace(",", ".")) // 2) * + (1 / stg.nb_profiles_per_sec[self.combobox_acoustic_data_choice.currentIndex()][0])) + " sec") def compute_averaged_BS_data(self): - kernel_avg = np.ones(2 * self.spinbox_average_horizontal.value() + 1) + kernel_avg = np.ones(2 * int(self.lineEdit_horizontal_average.text().replace(",", ".")) + 1) print(kernel_avg) - stg.Nb_cells_to_average_BS_signal[self.combobox_fileListWidget.currentIndex()] = ( - self.spinbox_average_horizontal.value()) + stg.Nb_cells_to_average_BS_signal[self.combobox_acoustic_data_choice.currentIndex()] = ( + float(self.lineEdit_horizontal_average.text().replace(",", "."))) - if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - x_time = stg.time_cross_section[self.combobox_fileListWidget.currentIndex()] - y_depth = stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()] + x_time = stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()] + y_depth = stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()] - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - x_time = stg.time_cross_section[self.combobox_fileListWidget.currentIndex()] - y_depth = stg.depth[self.combobox_fileListWidget.currentIndex()] + x_time = stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()] + y_depth = stg.depth[self.combobox_acoustic_data_choice.currentIndex()] else: - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - x_time = stg.time[self.combobox_fileListWidget.currentIndex()] - y_depth = stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()] + x_time = stg.time[self.combobox_acoustic_data_choice.currentIndex()] + y_depth = stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()] - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - x_time = stg.time[self.combobox_fileListWidget.currentIndex()] - y_depth = stg.depth[self.combobox_fileListWidget.currentIndex()] + x_time = stg.time[self.combobox_acoustic_data_choice.currentIndex()] + y_depth = stg.depth[self.combobox_acoustic_data_choice.currentIndex()] - if stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.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()])) + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( + stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()])) - for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): + for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): 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()][ + # stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i,:] = ( + # convolve1d(stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ # f, i, :], weights=kernel_avg) / len(kernel_avg)) - stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, i, :] = ( - convolve(stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, i, :], + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( + convolve(stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], kernel_avg)) print("1 - Je suis dans stg.BS_stream_bed_pre_process_SNR") - elif stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()] = (deepcopy( - stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()])) + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()])) - for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): + for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): 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()][ + # stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( + # convolve1d(stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ # f, i, :], weights=kernel_avg) / len(kernel_avg)) - stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, i, :] = ( - convolve(stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, i, :], + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( + convolve(stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], kernel_avg)) print("2 - Je suis dans stg.BS_cross_section_pre_process_SNR") - elif stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()] = (deepcopy( - stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()])) + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()])) - for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): + for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): 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()][ + # stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( + # convolve1d(stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ # f, i, :], weights=kernel_avg) / len(kernel_avg)) - stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, i, :] = ( - convolve(stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, i, :], + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( + convolve(stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], kernel_avg)) print("3 - Je suis dans stg.BS_raw_data_pre_process_SNR") - elif stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()] = (deepcopy( - stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()])) + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( + stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()])) - for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): + for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): 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()][ + # stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( + # convolve1d(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][ # f, i, :], weights=kernel_avg) / len(kernel_avg)) - stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, i, :] = ( - convolve(stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()][f, i, :], kernel_avg)) + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( + convolve(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], kernel_avg)) print("4 - Je suis dans stg.BS_stream_bed") - elif stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()] = (deepcopy( - stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()])) + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( + stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()])) - for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): + for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): 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()][ + # stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( + # convolve1d(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # f, i, :], weights=kernel_avg) / len(kernel_avg)) - stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, i, :] = ( - convolve(stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()][f, i, :], + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( + convolve(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], kernel_avg)) print("5 - Je suis dans stg.BS_cross_section") - elif stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()] = (deepcopy( - stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()])) + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( + stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()])) - for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): + for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): 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()][ + # stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( + # convolve1d(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][ # f, i, :], weights=kernel_avg) / len(kernel_avg)) - stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, i, :] = ( - convolve(stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()][f, i, :], kernel_avg)) + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( + convolve(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], kernel_avg)) print("6 - Je suis dans stg.BS_raw_data") @@ -2564,80 +2014,80 @@ class SignalProcessingTab(QWidget): # kernel = np.ones(2*self.spinbox_average_horizontal.value()+1) # print(kernel) # - # if stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # if stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): # # # --- Données pré-traitées avec SNR : BS stream bed pre process SNR -> BS stream bed pre process SNR average --- # - # if stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape != (0,): - # # ((stg.BS_stream_bed_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()].shape) or - # # (stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape))): + # if stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + # # ((stg.BS_stream_bed_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()].shape) or + # # (stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape))): # # stg.BS_stream_bed_pre_process_SNR_average = deepcopy(stg.BS_stream_bed_pre_process_SNR) # - # for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - # for i in range(stg.depth[self.combobox_fileListWidget.currentIndex()].shape[1]): - # stg.BS_stream_bed_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()][f, i,:] \ - # = convolve1d(stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, i, :], weights=kernel) / len(kernel) + # for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + # for i in range(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1]): + # stg.BS_stream_bed_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()][f, i,:] \ + # = convolve1d(stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], weights=kernel) / len(kernel) # print("1 - Je suis dans stg.BS_stream_bed_pre_process_SNR_average") # # # --- Données BS stream bed : BS stream bed -> BS stream bed pre process average --- # # else: - # # elif ((stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape) or - # # (stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()].shape)): + # # elif ((stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape) or + # # (stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape)): # # stg.BS_stream_bed_pre_process_average = deepcopy(stg.BS_stream_bed) # - # for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - # for i in range(stg.depth[self.combobox_fileListWidget.currentIndex()].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) / len(kernel) + # for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + # for i in range(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1]): + # stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] \ + # = convolve1d(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], weights=kernel) / len(kernel) # print("2 - Je suis dans stg.BS_stream_bed_pre_process_average") # - # elif stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): # # # --- Données pré-traitées avec SNR : BS cross section pre process SNR -> BS cross section pre process SNR average --- # - # if stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape != (0,): - # # if ((stg.BS_cross_section_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()].shape) or - # # (stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape)): + # if stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + # # if ((stg.BS_cross_section_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()].shape) or + # # (stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape)): # # stg.BS_cross_section_pre_process_SNR_average = deepcopy(stg.BS_cross_section_pre_process_SNR) # - # for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - # for i in range(stg.depth[self.combobox_fileListWidget.currentIndex()].shape[1]): - # stg.BS_cross_section_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()][f, i, :] \ - # = convolve1d(stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, i, :], weights=kernel) / len(kernel) + # for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + # for i in range(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1]): + # stg.BS_cross_section_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] \ + # = convolve1d(stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], weights=kernel) / len(kernel) # print("3 - Je suis dans stg.BS_cross_section_pre_process_SNR_average") # # # --- Données BS section : BS cross section -> BS cross section pre process average --- # # else: - # # elif ((stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape) or - # # (stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()].shape)): + # # elif ((stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape) or + # # (stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape)): # # stg.BS_cross_section_pre_process_average = deepcopy(stg.BS_cross_section) # - # for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - # for i in range(stg.depth[self.combobox_fileListWidget.currentIndex()].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) / len(kernel) + # for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + # for i in range(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1]): + # stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] \ + # = convolve1d(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], weights=kernel) / len(kernel) # print("4 - Je suis dans stg.BS_cross_section_pre_process_average") # # else: # # # --- Données pré-traitées avec SNR : BS raw data pre process SNR -> BS raw data pre process SNR average --- # - # if stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape != (0,): - # # if ((stg.BS_raw_data_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()].shape) or - # # (stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape)): + # if stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + # # if ((stg.BS_raw_data_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()].shape) or + # # (stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape)): # # stg.BS_raw_data_pre_process_SNR_average = deepcopy(stg.BS_raw_data_pre_process_SNR) # - # for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - # for i in range(stg.depth[self.combobox_fileListWidget.currentIndex()].shape[1]): - # stg.BS_raw_data_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()][f, i, :] \ - # = convolve1d(stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][f, i, :], weights=kernel) / len(kernel) + # for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + # for i in range(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1]): + # stg.BS_raw_data_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] \ + # = convolve1d(stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], weights=kernel) / len(kernel) # print("5 - Je suis dans stg.BS_raw_data_pre_process_SNR_average") # # # --- Données BS brutes : BS raw data -> BS raw data pre process average --- @@ -2646,20 +2096,20 @@ class SignalProcessingTab(QWidget): # # stg.BS_raw_data_pre_process_average = deepcopy(stg.BS_raw_data) # - # for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - # for i in range(stg.depth[self.combobox_fileListWidget.currentIndex()].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) / len(kernel) + # for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + # for i in range(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1]): + # stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i,:] \ + # = convolve1d(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], weights=kernel) / len(kernel) # print("6 - Je suis dans stg.BS_raw_data_pre_process_average") - # if (stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()].shape == - # stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()].shape): + # if (stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape == + # stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape): # # stg.BS_raw_data_pre_process_average = deepcopy(stg.BS_raw_data) # - # for f, _ in enumerate(stg.freq[self.combobox_fileListWidget.currentIndex()]): - # for i in range(stg.depth[self.combobox_fileListWidget.currentIndex()].shape[1]): - # stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()][f, i, :] \ + # for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + # for i in range(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1]): + # stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] \ # = convolve1d(stg.BS_stream_bed_pre_process_SNR[f, i, :], weights=kernel) / len(kernel) # # stg.BS_stream_bed_pre_process_SNR_average = deepcopy(stg.BS_stream_bed_pre_process_SNR) @@ -2721,8 +2171,8 @@ class SignalProcessingTab(QWidget): def plot_pre_processed_profile(self): - if ((self.combobox_fileListWidget.currentIndex() != -1) and - (stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()].shape != (0,))): + if ((self.combobox_acoustic_data_choice.currentIndex() != -1) and + (stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))): self.verticalLayout_groupbox_plot_profile.removeWidget(self.toolbar_profile) self.verticalLayout_groupbox_plot_profile.removeWidget(self.canvas_profile) @@ -2737,188 +2187,188 @@ class SignalProcessingTab(QWidget): # --- PLot profile --- - if stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()][ + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()][ + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) elif stg.BS_cross_section_pre_process_average[self.combobox_frequency_profile.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()][ + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()][ + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()][ + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()][ + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ + stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ + stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) elif stg.BS_cross_section_pre_process_SNR[self.combobox_frequency_profile.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()][ + stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()][ + stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()][ + stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()][ + stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()][ + stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()][ + stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) self.axis_profile.text( - .95, .05, stg.freq_text[self.combobox_fileListWidget.currentIndex()][ + .95, .05, stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex()], fontsize=10, fontweight='bold', fontname="Ubuntu", fontstyle="normal", c="black", alpha=0.2, @@ -2948,195 +2398,195 @@ class SignalProcessingTab(QWidget): def update_plot_pre_processed_profile(self): - if ((self.combobox_fileListWidget.currentIndex() != -1) and - (stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()].shape != (0,))): + if ((self.combobox_acoustic_data_choice.currentIndex() != -1) and + (stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))): self.axis_profile.cla() # --- PLot profile --- - if stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()][ + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()][ + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()][ + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()][ + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()][ + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()][ + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ + stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ + stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex()][ + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()][ + stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex()][ + stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()][ + stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section[self.combobox_fileListWidget.currentIndex()][ + stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()][ + stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data[self.combobox_fileListWidget.currentIndex()][ + stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_fileListWidget.currentIndex()][ + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) self.axis_profile.text( - .95, .05, stg.freq_text[self.combobox_fileListWidget.currentIndex()][ + .95, .05, stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex()], fontsize=10, fontweight='bold', fontname="Ubuntu", fontstyle="normal", c="black", alpha=0.2, @@ -3149,44 +2599,44 @@ class SignalProcessingTab(QWidget): self.figure_profile.canvas.draw_idle() # --- Update red line position on transect --- - if stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.red_line_return.set_data( - stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][ + stg.time_cross_section[self.combobox_acoustic_data_choice.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()][ + np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1]), + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :]) - elif stg.time[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.red_line_return.set_data( - stg.time[self.combobox_fileListWidget.currentIndex()][ + stg.time[self.combobox_acoustic_data_choice.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()][ + np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1]), + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :]) - elif stg.depth[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): + if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.red_line_return.set_data( - stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][ + stg.time_cross_section[self.combobox_acoustic_data_choice.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()][ + np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1]), + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :]) - elif stg.time[self.combobox_fileListWidget.currentIndex()].shape != (0,): + elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): self.red_line_return.set_data( - stg.time[self.combobox_fileListWidget.currentIndex()][ + stg.time[self.combobox_acoustic_data_choice.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()][ + np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1]), + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_profile.currentIndex(), :]) self.fig_BS.canvas.draw_idle() @@ -3198,8 +2648,8 @@ class SignalProcessingTab(QWidget): # # self.label_profile_number.clear() # # self.label_profile_number.setText("Profile " + str(self.slider.value()) + " / " + str(self.slider.maximum())) # - # if ((self.combobox_fileListWidget.currentIndex() != -1) and - # (stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex()].shape != (0,))): + # if ((self.combobox_acoustic_data_choice.currentIndex() != -1) and + # (stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))): # # self.verticalLayout_groupbox_plot_profile.removeWidget(self.toolbar_profile) # self.verticalLayout_groupbox_plot_profile.removeWidget(self.canvas_profile) @@ -3212,15 +2662,15 @@ class SignalProcessingTab(QWidget): # self.verticalLayout_groupbox_plot_profile.addWidget(self.toolbar_profile) # self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_profile) # - # if stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): # # # --- Plot profile --- # self.axis_profile.plot( - # stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - # -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][self.combobox_frequency_profile.currentIndex(), :], + # -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_frequency_profile.currentIndex(), :], # linestyle='solid', color='k', linewidth=1) - # self.axis_profile[0].text(.95, .05, stg.freq_text[self.combobox_fileListWidget.currentIndex()][self.combobox_frequency_profile.currentIndex()], + # self.axis_profile[0].text(.95, .05, stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_frequency_profile.currentIndex()], # fontsize=10, fontweight='bold', fontname="Ubuntu", # fontstyle="normal", c="black", alpha=0.2, # horizontalalignment='right', verticalalignment='bottom', @@ -3229,29 +2679,29 @@ class SignalProcessingTab(QWidget): # # --- Plot transect with profile position --- # self.axis_profile[1].cla() # val_min = np.nanmin( - # stg.BS_stream_bed_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_stream_bed_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :]) # val_max = np.nanmax( - # stg.BS_stream_bed_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_stream_bed_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :]) # if val_min == 0: # val_min = 1e-5 - # self.axis_profile[1].pcolormesh(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][self.combobox_frequency_profile.currentIndex(), :], - # -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][self.combobox_frequency_profile.currentIndex(), :], - # stg.BS_stream_bed_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()] + # self.axis_profile[1].pcolormesh(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_frequency_profile.currentIndex(), :], + # -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_frequency_profile.currentIndex(), :], + # stg.BS_stream_bed_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :], # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) # - # elif stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # elif stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): # # # --- Plot profile --- # self.axis_profile[0].plot( - # stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - # -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + # -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], # linestyle='solid', color='k', linewidth=1) - # self.axis_profile[0].text(.95, .05, stg.freq_text[self.combobox_fileListWidget.currentIndex()][ + # self.axis_profile[0].text(.95, .05, stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex()], # fontsize=10, fontweight='bold', fontname="Ubuntu", # fontstyle="normal", c="black", alpha=0.2, @@ -3261,32 +2711,32 @@ class SignalProcessingTab(QWidget): # # --- Plot transect with profile position --- # self.axis_profile[1].cla() # val_min = np.nanmin( - # stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :]) # val_max = np.nanmax( - # stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :]) # if val_min == 0: # val_min = 1e-5 - # self.axis_profile[1].pcolormesh(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][ + # self.axis_profile[1].pcolormesh(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], - # -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + # -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], # stg.BS_stream_bed_pre_process_average[ - # self.combobox_fileListWidget.currentIndex()] + # self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :], # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) # - # elif stg.BS_cross_section_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # elif stg.BS_cross_section_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): # # # --- Plot profile --- # self.axis_profile[0].plot( - # stg.BS_cross_section_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_cross_section_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - # -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + # -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], # linestyle='solid', color='k', linewidth=1) - # self.axis_profile[0].text(.95, .05, stg.freq_text[self.combobox_fileListWidget.currentIndex()][ + # self.axis_profile[0].text(.95, .05, stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex()], # fontsize=10, fontweight='bold', fontname="Ubuntu", # fontstyle="normal", c="black", alpha=0.2, @@ -3296,32 +2746,32 @@ class SignalProcessingTab(QWidget): # # --- Plot transect with profile position --- # self.axis_profile[1].cla() # val_min = np.nanmin( - # stg.BS_cross_section_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_cross_section_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :]) # val_max = np.nanmax( - # stg.BS_cross_section_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_cross_section_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :]) # if val_min == 0: # val_min = 1e-5 - # self.axis_profile[1].pcolormesh(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][ + # self.axis_profile[1].pcolormesh(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], - # -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + # -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], # stg.BS_cross_section_pre_process_SNR_average[ - # self.combobox_fileListWidget.currentIndex()] + # self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :], # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) # - # elif stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # elif stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): # # # --- Plot profile --- # self.axis_profile[0].plot( - # stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - # -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + # -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], # linestyle='solid', color='k', linewidth=1) - # self.axis_profile[0].text(.95, .05, stg.freq_text[self.combobox_fileListWidget.currentIndex()][ + # self.axis_profile[0].text(.95, .05, stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex()], # fontsize=10, fontweight='bold', fontname="Ubuntu", # fontstyle="normal", c="black", alpha=0.2, @@ -3331,32 +2781,32 @@ class SignalProcessingTab(QWidget): # # --- Plot transect with profile position --- # self.axis_profile[1].cla() # val_min = np.nanmin( - # stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :]) # val_max = np.nanmax( - # stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :]) # if val_min == 0: # val_min = 1e-5 - # self.axis_profile[1].pcolormesh(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][ + # self.axis_profile[1].pcolormesh(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], - # -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + # -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], # stg.BS_cross_section_pre_process_average[ - # self.combobox_fileListWidget.currentIndex()] + # self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :], # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) # - # elif stg.BS_raw_data_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # elif stg.BS_raw_data_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): # # # --- Plot profile --- # self.axis_profile[0].plot( - # stg.BS_raw_data_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_raw_data_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - # -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + # -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], # linestyle='solid', color='k', linewidth=1) - # self.axis_profile[0].text(.95, .05, stg.freq_text[self.combobox_fileListWidget.currentIndex()][ + # self.axis_profile[0].text(.95, .05, stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex()], # fontsize=10, fontweight='bold', fontname="Ubuntu", # fontstyle="normal", c="black", alpha=0.2, @@ -3366,32 +2816,32 @@ class SignalProcessingTab(QWidget): # # --- Plot transect with profile position --- # self.axis_profile[1].cla() # val_min = np.nanmin( - # stg.BS_raw_data_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_raw_data_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :]) # val_max = np.nanmax( - # stg.BS_raw_data_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_raw_data_pre_process_SNR_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :]) # if val_min == 0: # val_min = 1e-5 - # self.axis_profile[1].pcolormesh(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][ + # self.axis_profile[1].pcolormesh(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], - # -stg.depth_cross_section[self.combobox_fileListWidget.currentIndex()][ + # -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], # stg.BS_raw_data_pre_process_SNR_average[ - # self.combobox_fileListWidget.currentIndex()] + # self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :], # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) # - # elif stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()].shape != (0,): + # elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): # # # --- Plot profile --- # self.axis_profile[0].plot( - # stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - # -stg.depth[self.combobox_fileListWidget.currentIndex()][ + # -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], # linestyle='solid', color='k', linewidth=1) - # self.axis_profile[0].text(.95, .05, stg.freq_text[self.combobox_fileListWidget.currentIndex()][ + # self.axis_profile[0].text(.95, .05, stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex()], # fontsize=10, fontweight='bold', fontname="Ubuntu", # fontstyle="normal", c="black", alpha=0.2, @@ -3401,42 +2851,42 @@ class SignalProcessingTab(QWidget): # # --- Plot transect with profile position --- # self.axis_profile[1].cla() # val_min = np.nanmin( - # stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :]) # val_max = np.nanmax( - # stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex()] + # stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :]) # if val_min == 0: # val_min = 1e-5 - # self.axis_profile[1].pcolormesh(stg.time[self.combobox_fileListWidget.currentIndex()][ + # self.axis_profile[1].pcolormesh(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], - # -stg.depth[self.combobox_fileListWidget.currentIndex()][ + # -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ # self.combobox_frequency_profile.currentIndex(), :], # stg.BS_raw_data_pre_process_average[ - # self.combobox_fileListWidget.currentIndex()] + # self.combobox_acoustic_data_choice.currentIndex()] # [self.combobox_frequency_profile.currentIndex(), :, :], # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) # # # self.axis_profile[1].plot( - # stg.time[self.combobox_fileListWidget.currentIndex()] + # stg.time[self.combobox_acoustic_data_choice.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(), :], + # np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1]), + # -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_frequency_profile.currentIndex(), :], # color='red', linestyle="solid", linewidth=2) # # self.axis_profile[0].set_xlabel("Acoustic Backscatter Signal (V)") # self.axis_profile[0].set_ylabel("Depth (m)") # - # if len(stg.depth_bottom[self.combobox_fileListWidget.currentIndex()]) != 0: - # if stg.time_cross_section[self.combobox_fileListWidget.currentIndex()].shape != (0,): - # self.axis_profile[1].plot(stg.time_cross_section[self.combobox_fileListWidget.currentIndex()][self.combobox_frequency_profile.currentIndex(), :], - # -stg.depth_bottom[self.combobox_fileListWidget.currentIndex()], + # if len(stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()]) != 0: + # if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + # self.axis_profile[1].plot(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_frequency_profile.currentIndex(), :], + # -stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()], # color='black', linewidth=1, linestyle="solid") # else: - # self.axis_profile[1].plot(stg.time[self.combobox_fileListWidget - 1][ + # self.axis_profile[1].plot(stg.time[self.combobox_acoustic_data_choice - 1][ # self.combobox_frequency_profile.currentIndex(), :], - # -stg.depth_bottom[self.combobox_fileListWidget.currentIndex()], + # -stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()], # color='black', linewidth=1, linestyle="solid") # # self.axis_profile[1].set_xticks([]) @@ -3575,620 +3025,3 @@ class SignalProcessingTab(QWidget): def update_lineEdit_by_moving_slider(self): self.lineEdit_slider.setText(str(self.slider.value())) - - - - # ______ _______ - # | | | | \ - # | | | | \ - # | | | | | - # | | | | / - # |______| |________ |________/ - - # COMMENT OLD CODE LINE FROM HERE .... - - - # def compute_BS_data_section(self): - # if stg.BS_cross_section.size == 0: - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Load data Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Please check acoustic data Tab") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() - # else: - # # if stg.r_bottom.size == 0: - # # stg.BS_stream_bed = deepcopy(stg.BS_cross_section) - # if stg.r_bottom.size != 0: - # stg.BS_stream_bed = deepcopy(stg.BS_cross_section) - # for f, _ in enumerate(stg.freq): - # for k, _ in enumerate(stg.r_bottom): - # # print(k, np.where(stg.r >= stg.r_bottom[k])[0]) - # stg.BS_stream_bed[f, np.where(stg.r[self.combobox_frequency.currentIndex(), :] >= stg.r_bottom[k])[0], k] = np.nan - # - # # --- Choose frequency (Combo box) to plot transect with profile position --- - # self.combobox_frequency.addItems(stg.freq_text) - # self.combobox_frequency.currentTextChanged.connect(self.update_plot_profile_position_on_transect) - # - # # --- Choose frequency (Combo box) to compute water attenuation --- - # self.combobox_freq_for_water_attenuation.addItems(stg.freq_text) - # - # # --- Choose frequency (Combo box) to compute sediment attenuation --- - # self.combobox_frequency_compute_alphaS.addItems(stg.freq_text) - # - # # --- Fix maximum value of slider + Edit Label Profile number --- - # self.slider.setMaximum(stg.t.shape[1]) - # self.label_profile_number.clear() - # self.label_profile_number.setText("Vertical " + str(self.slider.value()) + " / " + str(self.slider.maximum())) - # - # self.plot_profile_position_on_transect() - # self.plot_profile() - # - # # ---------------------------------------- Connect Groupbox filter with SNR ---------------------------------------- - # - # - # - # # ----------------------------------------- Connect Groupbox average data ----------------------------------------- - # - # def compute_averaged_profile(self): - # - # if stg.BS_cross_section.size == 0: - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Average Backscatter signal Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Load data from acoustic data tab before averaging backscatter signal") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() - # else: - # if self.spinbox_average_horizontal.value() % 2 == 0: - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Average Backscatter signal Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Please enter an odd number") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() - # else: - # - # filter_convolve = np.ones(self.spinbox_average_horizontal.value()) - # print(filter_convolve) - # - # if stg.BS_stream_bed_pre_process_SNR.size != 0: - # - # # stg.BS_stream_bed_pre_process_average = np.zeros((stg.r.shape[0], stg.freq.shape[0], stg.t.shape[0])) - # # stg.BS_stream_bed_pre_process_average = np.zeros((stg.freq.shape[0], stg.r.shape[1], stg.t.shape[1])) - # stg.BS_stream_bed_pre_process_average = deepcopy(stg.BS_stream_bed_pre_process_SNR) - # print(f"1/ stg.BS_stream_bed_pre_process_average : {stg.BS_stream_bed_pre_process_average}") - # for f, _ in enumerate(stg.freq): - # for i in range(stg.r.shape[1]): - # stg.BS_stream_bed_pre_process_average[f, i, :] \ - # = convolve1d(stg.BS_stream_bed_pre_process_SNR[f, i, :], weights=filter_convolve) / len(filter_convolve) - # # stg.BS_stream_bed_pre_process_average[i, f, :] \ - # # = convolve1d(stg.BS_cross_section[i, f, :], weights=filter_convolve) / filter_convolve.shape[0] - # - # elif stg.BS_cross_section_pre_process_SNR.size != 0: - # - # stg.BS_cross_section_averaged = deepcopy(stg.BS_cross_section_pre_process_SNR) - # print(f"2/ stg.BS_cross_section_averaged : {stg.BS_cross_section_averaged}") - # for f, _ in enumerate(stg.freq): - # for i in range(stg.r.shape[1]): - # stg.BS_stream_bed_pre_process_average[f, i, :] \ - # = convolve1d(stg.BS_cross_section_pre_process_SNR[f, i, :], - # weights=filter_convolve) / len(filter_convolve) - # - # elif stg.BS_stream_bed.size != 0: - # - # stg.BS_stream_bed_pre_process_average = deepcopy(stg.BS_stream_bed) - # print(f"3/ stg.BS_stream_bed_pre_process_average : {stg.BS_stream_bed_pre_process_average.shape}") - # print(stg.BS_stream_bed_pre_process_average[0, 10, :50]) - # for f, _ in enumerate(stg.freq): - # for i in range(stg.r.shape[1]): - # stg.BS_stream_bed_pre_process_average[f, i, :] \ - # = convolve1d(stg.BS_stream_bed[f, i, :], - # weights=filter_convolve) / len(filter_convolve) - # print(stg.BS_stream_bed_pre_process_average[0, 10, :50]) - # - # elif stg.BS_cross_section.size != 0: - # - # stg.BS_cross_section_averaged = deepcopy(stg.BS_cross_section) - # print(f"4/ stg.BS_cross_section_averaged : {stg.BS_cross_section_averaged.shape}") - # for f, _ in enumerate(stg.freq): - # for i in range(stg.r.shape[1]): - # stg.BS_cross_section_averaged[f, i, :] \ - # = convolve1d(stg.BS_cross_section[f, i, :], - # weights=filter_convolve) / len(filter_convolve) - # - # if stg.ABS_name == "Aquascat 1000R": - # self.label_cells_horizontal.clear() - # self.label_cells_horizontal.setText( - # "cells = +/- " + str((self.spinbox_average_horizontal.value() // 2)*(1/stg.nb_profiles_per_sec)) + " sec") - # - # # self.label_cells_vertical.clear() - # # self.label_cells_vertical.setText( - # # "cells = +/- " + str((self.spinbox_average_vertical.value() // 2) * (1 / stg.nb_profiles_per_sec)) + " sec") - # - # self.plot_averaged_profile() - # self.update_plot_profile_position_on_transect() - # - # self.slider.valueChanged.connect(self.update_plot_averaged_profile) - # - # # fig, ax = plt.subplots(nrows=1, ncols=1) - # # val_min = np.nanmin(stg.BS_stream_bed_pre_process_average[self.combobox_frequency.currentIndex(), :, :]) - # # val_max = np.nanmax(stg.BS_stream_bed_pre_process_average[self.combobox_frequency.currentIndex(), :, :]) - # # if val_min == 0: - # # val_min = 1e-5 - # # - # # ax.pcolormesh(stg.t[self.combobox_frequency.currentIndex(), :], - # # -stg.r[self.combobox_frequency.currentIndex(), :], - # # stg.BS_stream_bed_pre_process_average[self.combobox_frequency.currentIndex(), :, :], - # # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - # # - # # plt.show() - # - # def compute_water_attenuation(self): - # if (stg.freq.size == 0) or (self.spinbox_temperature_water_attenuation.value() == 0): - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Water attenuation Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Load Backscatter data from acoustic data tab and enter a value of temperature") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() - # - # else: - # - # if self.combobox_water_attenuation_model.currentIndex() == 0: - # self.Francois_and_Garrison_1982() - # - # else: - # pass - # - # print(f"{stg.water_attenuation:.2f}") - # self.label_water_attenuation.clear() - # self.label_water_attenuation.setText("\u03B1w = " + f"{stg.water_attenuation:.4f}" + " dB/m") - # - # def Francois_and_Garrison_1982(self): - # if self.spinbox_temperature_water_attenuation.value() > 20: - # stg.water_attenuation = ((3.964 * 1e-4 - 1.146 * 1e-5 * self.spinbox_temperature_water_attenuation.value() + - # 1.45 * 1e-7 * self.spinbox_temperature_water_attenuation.value() ** 2 - - # 6.5 * 1e-10 * self.spinbox_temperature_water_attenuation.value() ** 3) * 1e-3 * - # (np.log(10) / 20) * - # (stg.freq[self.combobox_freq_for_water_attenuation.currentIndex()] * 1e-3) ** 2) - # else: - # stg.water_attenuation = ((4.937 * 1e-4 - 2.59 * 1e-5 * self.spinbox_temperature_water_attenuation.value() + - # 9.11 * 1e-7 * self.spinbox_temperature_water_attenuation.value() ** 2 - - # 1.5 * 1e-8 * self.spinbox_temperature_water_attenuation.value() ** 3) * 1e-3 * - # (np.log(10) / 20) * - # (stg.freq[self.combobox_freq_for_water_attenuation.currentIndex()] * 1e-3) ** 2) - # - - # - # # ---------------------------------------- PLOT PROFILE POSITION ON TRANSECT --------------------------------------- - # - # def plot_profile_position_on_transect(self): - # - # # --- Create Matplotlib canvas (with figure and axis) to plot transect --- - # self.canvas_plot_profile_position_on_transect = FigureCanvas() - # self.figure_plot_profile_position_on_transect, self.axis_plot_profile_position_on_transect = \ - # plt.subplots(nrows=1, ncols=1, layout="constrained") - # self.canvas_plot_profile_position_on_transect = FigureCanvas(self.figure_plot_profile_position_on_transect) - # self.verticalLayout_groupbox_display_profile_position.addWidget(self.canvas_plot_profile_position_on_transect) - # - # # --- Plot transect with profile position --- - # - # if stg.ABS_name == "Aquascat 1000R": - # if stg.BS_stream_bed.size != 0: - # - # val_min = np.nanmin(stg.BS_stream_bed[stg.freq_bottom_detection, :, :]) - # val_max = np.nanmax(stg.BS_stream_bed[stg.freq_bottom_detection, :, :]) - # if val_min == 0: - # val_min = 1e-5 - # - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[stg.freq_bottom_detection, :], -stg.r[stg.freq_bottom_detection, :], - # stg.BS_stream_bed[stg.freq_bottom_detection, :, :], - # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - # else: - # - # val_min = np.nanmin(stg.BS_cross_section[stg.freq_bottom_detection, :, :]) - # val_max = np.nanmax(stg.BS_cross_section[stg.freq_bottom_detection, :, :]) - # if val_min == 0: - # val_min = 1e-5 - # - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[stg.freq_bottom_detection, :], -stg.r[stg.freq_bottom_detection, :], - # stg.BS_cross_section[stg.freq_bottom_detection, :, :], - # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - # - # elif stg.ABS_name == "UB-SediFlow": - # - # if stg.BS_stream_bed.size != 0: - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[stg.freq_bottom_detection, :], -stg.r[stg.freq_bottom_detection, :], - # np.log(stg.BS_stream_bed[stg.freq_bottom_detection, :, :]), - # cmap='Blues') - # else: - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[stg.freq_bottom_detection, :], -stg.r[stg.freq_bottom_detection, :], - # np.log(stg.BS_cross_section[stg.freq_bottom_detection, :, :]), - # cmap='Blues') - # - # if stg.r_bottom.size != 0: - # self.axis_plot_profile_position_on_transect.plot( - # stg.t[stg.freq_bottom_detection, :], -stg.r_bottom, color='black', linewidth=1, linestyle="solid") - # - # self.axis_plot_profile_position_on_transect.plot( - # stg.t[stg.freq_bottom_detection, self.slider.value() - 1] * np.ones(stg.r.shape[1]), -stg.r[stg.freq_bottom_detection, :], - # color='red', linestyle="solid", linewidth=2) - # - # self.axis_plot_profile_position_on_transect.set_xticks([]) - # self.axis_plot_profile_position_on_transect.set_yticks([]) - # - # self.figure_plot_profile_position_on_transect.canvas.draw_idle() - # - # def update_plot_profile_position_on_transect(self): - # - # # --- Update label "Profile N / max(N)" --- - # self.label_profile_number.clear() - # self.label_profile_number.setText("Vertical " + str(self.slider.value()) + " / " + str(self.slider.maximum())) - # - # # --- Update transect plot --- - # - # if self.canvas_plot_profile_position_on_transect is None: - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Plot Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Load and post-process data before plotting transect with profile position") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() - # - # else: - # - # if stg.BS_stream_bed.size != 0: - # - # if (stg.BS_stream_bed_pre_process_average.size == 0) and (stg.BS_stream_bed_pre_process_SNR.size == 0): - # - # self.axis_plot_profile_position_on_transect.cla() - # - # val_min = np.nanmin(stg.BS_stream_bed[self.combobox_frequency.currentIndex(), :, :]) - # val_max = np.nanmax(stg.BS_stream_bed[self.combobox_frequency.currentIndex(), :, :]) - # if val_min == 0: - # val_min = 1e-5 - # - # if stg.ABS_name == "Aquascat 1000R": - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[self.combobox_frequency.currentIndex(), :], - # -stg.r[self.combobox_frequency.currentIndex(), :], - # stg.BS_stream_bed[self.combobox_frequency.currentIndex(), :, :], - # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - # elif stg.ABS_name == "UB-SediFlow": - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[self.combobox_frequency.currentIndex(), :], - # -stg.r[self.combobox_frequency.currentIndex(), :], - # np.log(stg.BS_stream_bed[self.combobox_frequency.currentIndex(), :, :]), - # cmap='Blues') - # - # elif (stg.BS_stream_bed_pre_process_average.size != 0) and (stg.BS_stream_bed_pre_process_SNR.size == 0): - # - # self.axis_plot_profile_position_on_transect.cla() - # - # val_min = np.nanmin(stg.BS_stream_bed_pre_process_average[self.combobox_frequency.currentIndex(), :, :]) - # val_max = np.nanmax(stg.BS_stream_bed_pre_process_average[self.combobox_frequency.currentIndex(), :, :]) - # if val_min == 0: - # val_min = 1e-5 - # - # if stg.ABS_name == "Aquascat 1000R": - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[self.combobox_frequency.currentIndex(), :], - # -stg.r[self.combobox_frequency.currentIndex(), :], - # stg.BS_stream_bed_pre_process_average[self.combobox_frequency.currentIndex(), :, :], - # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - # elif stg.ABS_name == "UB-SediFlow": - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[self.combobox_frequency.currentIndex(), :], - # -stg.r[self.combobox_frequency.currentIndex(), :], - # np.log(stg.BS_stream_bed_pre_process_average[self.combobox_frequency.currentIndex(), :, :]), - # cmap='Blues') - # - # elif stg.BS_stream_bed_pre_process_SNR.size != 0: - # - # self.axis_plot_profile_position_on_transect.cla() - # - # val_min = np.nanmin(stg.BS_stream_bed_pre_process_SNR[self.combobox_frequency.currentIndex(), :, :]) - # val_max = np.nanmax(stg.BS_stream_bed_pre_process_SNR[self.combobox_frequency.currentIndex(), :, :]) - # if val_min == 0: - # val_min = 1e-5 - # - # if stg.ABS_name == "Aquascat 1000R": - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[self.combobox_frequency.currentIndex(), :], - # -stg.r[self.combobox_frequency.currentIndex(), :], - # stg.BS_stream_bed_pre_process_SNR[self.combobox_frequency.currentIndex(), :, :], - # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - # elif stg.ABS_name == "UB-SediFlow": - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[self.combobox_frequency.currentIndex(), :], - # -stg.r[self.combobox_frequency.currentIndex(), :], - # np.log(stg.BS_stream_bed_pre_process_SNR[self.combobox_frequency.currentIndex(), :, :]), - # cmap='Blues') - # - # else: - # - # if (stg.BS_cross_section_averaged.size == 0) and (stg.BS_cross_section_pre_process_SNR.size == 0): - # - # self.axis_plot_profile_position_on_transect.cla() - # - # val_min = np.nanmin(stg.BS_cross_section[self.combobox_frequency.currentIndex(), :, :]) - # val_max = np.nanmax(stg.BS_cross_section[self.combobox_frequency.currentIndex(), :, :]) - # if val_min == 0: - # val_min = 1e-5 - # - # if stg.ABS_name == "Aquascat 1000R": - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[self.combobox_frequency.currentIndex(), :], - # -stg.r[self.combobox_frequency.currentIndex(), :], - # stg.BS_cross_section[self.combobox_frequency.currentIndex(), :, :], - # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - # elif stg.ABS_name == "UB-SediFlow": - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[self.combobox_frequency.currentIndex(), :], - # -stg.r[self.combobox_frequency.currentIndex(), :], - # np.log(stg.BS_cross_section[self.combobox_frequency.currentIndex(), :, :]), - # cmap='Blues') - # - # elif (stg.BS_cross_section_averaged.size != 0) and (stg.BS_cross_section_pre_process_SNR.size == 0): - # - # self.axis_plot_profile_position_on_transect.cla() - # - # val_min = np.nanmin(stg.BS_cross_section_averaged[self.combobox_frequency.currentIndex(), :, :]) - # val_max = np.nanmax(stg.BS_cross_section_averaged[self.combobox_frequency.currentIndex(), :, :]) - # if val_min == 0: - # val_min = 1e-5 - # - # if stg.ABS_name == "Aquascat 1000R": - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[self.combobox_frequency.currentIndex(), :], - # -stg.r[self.combobox_frequency.currentIndex(), :], - # stg.BS_cross_section_averaged[self.combobox_frequency.currentIndex(), :, :], - # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - # elif stg.ABS_name == "UB-SediFlow": - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[self.combobox_frequency.currentIndex(), :], - # -stg.r[self.combobox_frequency.currentIndex(), :], - # np.log(stg.BS_cross_section_averaged[self.combobox_frequency.currentIndex(), :, :]), - # cmap='Blues') - # - # elif stg.BS_cross_section_pre_process_SNR.size != 0: - # - # self.axis_plot_profile_position_on_transect.cla() - # - # val_min = np.nanmin(stg.BS_cross_section_pre_process_SNR[self.combobox_frequency.currentIndex(), :, :]) - # val_max = np.nanmax(stg.BS_cross_section_pre_process_SNR[self.combobox_frequency.currentIndex(), :, :]) - # if val_min == 0: - # val_min = 1e-5 - # - # if stg.ABS_name == "Aquascat 1000R": - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[self.combobox_frequency.currentIndex(), :], - # -stg.r[self.combobox_frequency.currentIndex(), :], - # stg.BS_cross_section_pre_process_SNR[self.combobox_frequency.currentIndex(), :, :], - # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - # elif stg.ABS_name == "UB-SediFlow": - # self.axis_plot_profile_position_on_transect.pcolormesh( - # stg.t[self.combobox_frequency.currentIndex(), :], - # -stg.r[self.combobox_frequency.currentIndex(), :], - # np.log(stg.BS_cross_section_pre_process_SNR[self.combobox_frequency.currentIndex(), :, :]), - # cmap='Blues') - # - # if stg.r_bottom.size != 0: - # self.axis_plot_profile_position_on_transect.plot(stg.t[self.combobox_frequency.currentIndex(), :], - # -stg.r_bottom, - # color='black', linewidth=1, linestyle="solid") - # - # self.axis_plot_profile_position_on_transect.plot( - # stg.t[self.combobox_frequency.currentIndex(), self.slider.value() - 1] * np.ones(stg.r.shape[1]), - # -stg.r[self.combobox_frequency.currentIndex(), :], - # color='red', linestyle="solid", linewidth=2) - # - # self.axis_plot_profile_position_on_transect.set_xticks([]) - # self.axis_plot_profile_position_on_transect.set_yticks([]) - # - # self.figure_plot_profile_position_on_transect.canvas.draw_idle() - # - # # -------------------------------------------------- PLOT PROFILE ------------------------------------------------- - # - # def plot_profile(self): - # - # # --- Raw profile --- - # - # self.figure_profile, self.axis_profile \ - # = plt.subplots(nrows=1, ncols=stg.freq.shape[0], sharex=True, sharey=True, layout='constrained') - # self.canvas_profile = FigureCanvas(self.figure_profile) - # self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_profile) - # # self.scroll_profile = QScrollArea() - # # self.scroll_profile.setWidget(self.canvas_profile) - # # self.scroll_profile.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) - # # self.scroll_profile.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) - # # self.scroll_profile.setAlignment(Qt.AlignCenter) - # # self.verticalLayout_groupbox_plot_profile.addWidget(self.scroll_profile) - # - # if stg.BS_stream_bed.size == 0: - # - # for f, _ in enumerate(stg.freq): - # self.axis_profile[f].cla() - # self.axis_profile[f].plot(stg.BS_cross_section[f, :, self.slider.value() - 1], -stg.r[f, :], - # linestyle='solid', color='k', linewidth=1) - # self.axis_profile[f].text(.95, .05, stg.freq_text[f], - # fontsize=10, fontweight='bold', fontname="Ubuntu", - # fontstyle="normal", c="black", alpha=0.2, - # horizontalalignment='right', verticalalignment='bottom', - # transform=self.axis_profile[f].transAxes) - # - # else: - # - # for f, _ in enumerate(stg.freq): - # self.axis_profile[f].cla() - # self.axis_profile[f].plot(stg.BS_stream_bed[f, :, self.slider.value() - 1], -stg.r[f, :], - # linestyle='solid', color='k', linewidth=1) - # self.axis_profile[f].text(.95, .05, stg.freq_text[f], - # fontsize=10, fontweight='bold', fontname="Ubuntu", - # fontstyle="normal", c="black", alpha=0.2, - # horizontalalignment='right', verticalalignment='bottom', - # transform=self.axis_profile[f].transAxes) - # - # self.figure_profile.supxlabel("Acoustic Backscatter Signal (V)") - # self.figure_profile.supylabel("Depth (m)") - # - # # --- Raw averaged profile --- - # - # self.figure_averaged_profile, self.axis_averaged_profile \ - # = plt.subplots(nrows=1, ncols=stg.freq.shape[0], sharex=True, sharey=True, layout='constrained') - # self.canvas_averaged_profile = FigureCanvas(self.figure_averaged_profile) - # self.verticalLayout_groupbox_plot_averaged_profile.addWidget(self.canvas_averaged_profile) - # # self.scroll_averaged_profile = QScrollArea() - # # self.scroll_averaged_profile.setWidget(self.canvas_averaged_profile) - # # self.scroll_averaged_profile.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) - # # self.scroll_averaged_profile.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - # # self.scroll_averaged_profile.setAlignment(Qt.AlignCenter) - # # self.verticalLayout_groupbox_plot_averaged_profile.addWidget(self.scroll_averaged_profile) - # - # # self.axis_averaged_profile[f].text(.95, .05, stg.freq_text[f], - # # fontsize=10, fontweight='bold', fontname="Ubuntu", - # # fontstyle="normal", c="black", alpha=0.2, - # # horizontalalignment='right', verticalalignment='bottom', - # # transform=self.axis_averaged_profile[f].transAxes) - # - # # --- Raw FCB profile --- - # - # self.figure_FCB_profile, self.axis_FCB_profile \ - # = plt.subplots(nrows=1, ncols=stg.freq.shape[0], sharex=True, sharey=True, layout='constrained') - # self.canvas_FCB_profile = FigureCanvas(self.figure_FCB_profile) - # self.verticalLayout_groupbox_plot_FCB_profile.addWidget(self.canvas_FCB_profile) - # # self.scroll_FCB_profile = QScrollArea() - # # self.scroll_FCB_profile.setWidget(self.canvas_FCB_profile) - # # self.scroll_FCB_profile.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) - # # self.scroll_FCB_profile.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - # # self.scroll_FCB_profile.setAlignment(Qt.AlignCenter) - # # self.verticalLayout_groupbox_plot_FCB_profile.addWidget(self.scroll_FCB_profile) - # - # # self.axis_FCB_profile[f].text(.95, .05, stg.freq_text[f], - # # fontsize=10, fontweight='bold', fontname="Ubuntu", - # # fontstyle="normal", c="black", alpha=0.2, - # # horizontalalignment='right', verticalalignment='bottom', - # # transform=self.axis_FCB_profile[f].transAxes) - # - # def update_plot_profile(self): - # if self.canvas_profile is None: - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Plot Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Load and post-process data before plotting profiles") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() - # - # else: - # - # if stg.BS_stream_bed.size == 0: - # - # for f, _ in enumerate(stg.freq): - # self.axis_profile[f].cla() - # self.axis_profile[f].plot(stg.BS_cross_section[f, :, self.slider.value() - 1], -stg.r[f, :], - # linestyle='solid', color='k', linewidth=1) - # self.axis_profile[f].text(.95, .05, stg.freq_text[f], - # fontsize=10, fontweight='bold', fontname="Ubuntu", - # fontstyle="normal", c="black", alpha=0.2, - # horizontalalignment='right', verticalalignment='bottom', - # transform=self.axis_profile[f].transAxes) - # - # else: - # - # for f, _ in enumerate(stg.freq): - # self.axis_profile[f].cla() - # self.axis_profile[f].plot(stg.BS_stream_bed[f, :, self.slider.value() - 1], -stg.r[f, :], - # linestyle='solid', color='k', linewidth=1) - # self.axis_profile[f].text(.95, .05, stg.freq_text[f], - # fontsize=10, fontweight='bold', fontname="Ubuntu", - # fontstyle="normal", c="black", alpha=0.2, - # horizontalalignment='right', verticalalignment='bottom', - # transform=self.axis_profile[f].transAxes) - # - # self.figure_profile.supxlabel("Acoustic Backscatter Signal (V)") - # self.figure_profile.supylabel("Depth (m)") - # self.figure_profile.canvas.draw_idle() - # - # # --------------------------------- PLOT AVERAGED PROFILE FILTERED OR NOT WITH SNR --------------------------------- - # - # def plot_averaged_profile(self): - # - # if stg.BS_stream_bed_pre_process_average.size == 0: - # - # for f, _ in enumerate(stg.freq): - # self.axis_averaged_profile[f].cla() - # self.axis_averaged_profile[f].plot(stg.BS_cross_section_averaged[f, :, self.slider.value()-1], -stg.r[f, :], - # linestyle='solid', color='k', linewidth=1) - # # self.axis_averaged_profile[f].set_ylim(-np.max(stg.r[f, :]), np.min(stg.r[f, :])) - # self.axis_averaged_profile[f].text(.95, .05, stg.freq_text[f], - # fontsize=10, fontweight='bold', fontname="Ubuntu", - # fontstyle="normal", c="black", alpha=0.2, - # horizontalalignment='right', verticalalignment='bottom', - # transform=self.axis_averaged_profile[f].transAxes) - # - # else: - # - # for f, _ in enumerate(stg.freq): - # self.axis_averaged_profile[f].cla() - # self.axis_averaged_profile[f].plot(stg.BS_stream_bed_pre_process_average[f, :, self.slider.value()-1], -stg.r[f, :], - # linestyle='solid', color='k', linewidth=1) - # # self.axis_averaged_profile[f].set_ylim(-np.max(stg.r[f, :]), np.min(stg.r[f, :])) - # self.axis_averaged_profile[f].text(.95, .05, stg.freq_text[f], - # fontsize=10, fontweight='bold', fontname="Ubuntu", - # fontstyle="normal", c="black", alpha=0.2, - # horizontalalignment='right', verticalalignment='bottom', - # transform=self.axis_averaged_profile[f].transAxes) - # - # self.figure_averaged_profile.supxlabel("Acoustic Backscatter Signal (V)") - # self.figure_averaged_profile.supylabel("Depth (m)") - # self.figure_averaged_profile.canvas.draw_idle() - # - # def update_plot_averaged_profile(self): - # if self.canvas_averaged_profile is None: - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Plot Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Load and post-process data before plotting averaged profiles") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() - # - # else: - # - # if stg.BS_stream_bed_pre_process_average.size == 0: - # - # for f, _ in enumerate(stg.freq): - # self.axis_averaged_profile[f].cla() - # self.axis_averaged_profile[f].plot(stg.BS_cross_section_averaged[f, :, self.slider.value() - 1], - # -stg.r[f, :], - # linestyle='solid', color='k', linewidth=1) - # # self.axis_averaged_profile[f].set_ylim(-np.max(stg.r[f, :]), np.min(stg.r[f, :])) - # self.axis_averaged_profile[f].text(.95, .05, stg.freq_text[f], - # fontsize=10, fontweight='bold', fontname="Ubuntu", - # fontstyle="normal", c="black", alpha=0.2, - # horizontalalignment='right', verticalalignment='bottom', - # transform=self.axis_averaged_profile[f].transAxes) - # - # else: - # - # for f, _ in enumerate(stg.freq): - # self.axis_averaged_profile[f].cla() - # self.axis_averaged_profile[f].plot(stg.BS_stream_bed_pre_process_average[f, :, self.slider.value() - 1], - # -stg.r[f, :], - # linestyle='solid', color='k', linewidth=1) - # # self.axis_averaged_profile[f].set_ylim(-np.max(stg.r[f, :]), np.min(stg.r[f, :])) - # self.axis_averaged_profile[f].text(.95, .05, stg.freq_text[f], - # fontsize=10, fontweight='bold', fontname="Ubuntu", - # fontstyle="normal", c="black", alpha=0.2, - # horizontalalignment='right', verticalalignment='bottom', - # transform=self.axis_averaged_profile[f].transAxes) - # - # self.figure_averaged_profile.supxlabel("Acoustic Backscatter Signal (V)") - # self.figure_averaged_profile.supylabel("Depth (m)") - # self.figure_averaged_profile.canvas.draw_idle() - # - # # ---------------------------------------------------- PLOT FCB ---------------------------------------------------- diff --git a/settings.py b/settings.py index 43b8c67..b18249f 100644 --- a/settings.py +++ b/settings.py @@ -92,6 +92,8 @@ filename_BS_noise_data = [] BS_noise_raw_data = [] # BS noise raw data : BS signal listen BS_noise_averaged_data = [] # BS noise raw data averaged (array has the same shape than BS_raw_data shape) +BS_mean = [] + date_noise = [] hour_noise = []