diff --git a/View/acoustic_data_tab.py b/View/acoustic_data_tab.py index ee2b48a..6a6061e 100644 --- a/View/acoustic_data_tab.py +++ b/View/acoustic_data_tab.py @@ -21,15 +21,11 @@ # -*- coding: utf-8 -*- -import sys - from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout, QGroupBox, QPushButton, QComboBox, QLineEdit, QLabel, - QGridLayout, QSpinBox, QDoubleSpinBox, QTableView, QTableWidget, QSpacerItem, QSizePolicy, - QAbstractScrollArea, QFileDialog, QTableWidgetItem, QMessageBox, QScrollBar, QScrollArea, - QProgressBar, QRadioButton, QFormLayout, QSlider, QAbstractItemView, QMenu, QItemDelegate, - QCheckBox, QAbstractSpinBox, QTabWidget) -from PyQt5.QtGui import QPixmap, QIcon, QFont, QMouseEvent, QIntValidator, QDoubleValidator -from PyQt5.QtCore import Qt, QCoreApplication, pyqtSignal, pyqtSlot, QEvent, QSize, QPropertyAnimation + QGridLayout, QTableView, QSpacerItem, QSizePolicy, QFileDialog, QMessageBox, QScrollArea, + QSlider, QMenu, QCheckBox) +from PyQt5.QtGui import QPixmap, QIcon +from PyQt5.QtCore import Qt, QCoreApplication, pyqtSignal, QEvent, QSize, QPropertyAnimation import numpy as np import pandas as pd @@ -43,20 +39,14 @@ from os import path from copy import deepcopy import locale -from settings import depth_cross_section, kt_read - locale.setlocale(locale.LC_ALL, '') from scipy.signal import savgol_filter from re import findall -# from pyqt_svg_button import SvgButton from pyqt_file_list_widget.fileListWidget import FileListWidget -from qtrangeslider import QLabeledDoubleRangeSlider - -# import Translation.biblio_string as bs import Translation.constant_string as cs from Model.TableModel import TableModel @@ -79,21 +69,8 @@ class AcousticDataTab(QWidget): fileRemoved = pyqtSignal(list) newValueChanged = pyqtSignal(float) - # path_icon = "./icons/" - # icon_triangle_left_to_begin = path_icon + "triangle_left_to_begin.png" - def __init__(self, tab_widget): super().__init__() - self.numero = AcousticDataTab.COMPTEUR - AcousticDataTab.COMPTEUR += 1 - # Utiliser os.path.split() OU os.path.join() - - # if name == 'posix': - # self.path_icon = "./icons/" - # print("os.name = ", self.path_icon) - # else: - # self.path_icon = r".\\icons\\" - # print("os.name = ", self.path_icon) self.path_icon = "./icons/" self.icon_folder = QIcon(self.path_icon + "folder.png") @@ -107,16 +84,11 @@ class AcousticDataTab(QWidget): self.icon_clear = QIcon(self.path_icon + "clear.png") self.icon_between = QPixmap(self.path_icon + "between.png") self.icon_refresh = QIcon(self.path_icon + "update.png") - print("CONSTRUCTEUR ", self.numero) self.calib_kt = CalibrationConstantKt() ### --- General layout of widgets --- self.verticalLayoutMain = QVBoxLayout(tab_widget) - # tab_widget = QTabWidget() - # self.verticalLayoutMain = QVBoxLayout() - # tab_widget.addLayout(self.verticalLayoutMain) - # self.setLayout(self.verticalLayoutMain) self.horizontalLayoutTop = QHBoxLayout() self.verticalLayoutMain.addLayout(self.horizontalLayoutTop, 5) # 1O units is 100% , 1 units is 10% @@ -135,17 +107,6 @@ class AcousticDataTab(QWidget): self.groupbox_table = QGroupBox() self.horizontalLayoutTop.addWidget(self.groupbox_table, 3) - # self.verticalLayout_goupbox_info_groupbox_table = QVBoxLayout() - # self.horizontalLayoutTop.addLayout(self.verticalLayout_goupbox_info_groupbox_table, 3) - # - # self.groupbox_info = QGroupBox() - # # self.verticalLayout_goupbox_info_groupbox_table.addWidget(self.groupbox_info, 5) - # self.scrollbar_measurement_information = QScrollArea() - # self.verticalLayout_goupbox_info_groupbox_table.addWidget(self.scrollbar_measurement_information, 4) - # - # self.groupbox_table = QGroupBox() - # self.verticalLayout_goupbox_info_groupbox_table.addWidget(self.groupbox_table, 6) - self.groupbox_display_option = QGroupBox() self.horizontalLayoutTop.addWidget(self.groupbox_display_option, 4) @@ -159,9 +120,6 @@ class AcousticDataTab(QWidget): self.groupbox_plot_the_vertical_profile_for_a_frequency = QGroupBox() self.horizontalLayoutBottom.addWidget(self.groupbox_plot_the_vertical_profile_for_a_frequency, 4) - # self.groupbox_transect_2Dplot_snr_data = QGroupBox() - # self.horizontalLayoutBottom.addWidget(self.groupbox_transect_2Dplot_snr_data) - # ===================================================== # TOP HORIZONTAL BOX LAYOUT # ===================================================== @@ -181,47 +139,22 @@ class AcousticDataTab(QWidget): # | Group box Download file | # +++++++++++++++++++++++++++ - # --- Group box Download multiple file --- - - # self.groupbox_multiple_acoustic_file = QGroupBox() - # self.verticalLayout_groupbox_download_multiple_file = QVBoxLayout(self.groupbox_multiple_acoustic_file) - # - # self.groupbox_multiple_acoustic_file.setTitle("Multiple files") - - # self.topLeftRightFileListWidget = TopLeftRightFileListWidget() - # # self.topLeftRightFileListWidget.show() - # # self.verticalLayout_groupbox_download_multiple_file.addWidget(self.topLeftRightFileListWidget) - # self.topLeftRightFileListWidget.setLayout(self.verticalLayout_groupbox_download_multiple_file) - - # --- Group box acoustic file --- - - self.gridLayout_groupbox_acoustic_file = QGridLayout(self.groupbox_acoustic_file) self.combobox_ABS_system_choice = QComboBox() - print("tab1 combobox_ABS_system_choice ", self.combobox_ABS_system_choice) self.combobox_ABS_system_choice.addItems([" ", "AQUAscat", "UBSediFlow"]) self.gridLayout_groupbox_acoustic_file.addWidget(self.combobox_ABS_system_choice, 0, 0, 1, 1) self.spacerItem_FileList = QSpacerItem(5, 10, QSizePolicy.Expanding, QSizePolicy.Minimum) self.gridLayout_groupbox_acoustic_file.addItem(self.spacerItem_FileList, 0, 1, 1, 1) - # self.addBtn = SvgButton() - # self.addBtn.setIcon("../icons/add.svg") self.addBtn = QPushButton() - # self.addBtn.setText("Add") self.addBtn.setIcon(self.icon_add) - # self.delBtn = SvgButton() - # self.delBtn.setIcon("../icons/delete.svg") self.delBtn = QPushButton() - # self.delBtn.setText("Del") self.delBtn.setIcon(self.icon_delete) - # self.clearBtn = SvgButton() - # self.clearBtn.setIcon("../icons/clear.svg") self.clearBtn = QPushButton() - # self.clearBtn.setText("Clear") self.clearBtn.setIcon(self.icon_clear) self.gridLayout_groupbox_acoustic_file.addWidget(self.addBtn, 0, 2, 1, 1) @@ -231,16 +164,6 @@ class AcousticDataTab(QWidget): self.fileListWidget = FileListWidget() self.gridLayout_groupbox_acoustic_file.addWidget(self.fileListWidget, 1, 0, 1, 5) - # self.pushbutton_acoustic_file = QPushButton() - # self.pushbutton_acoustic_file.setObjectName("pushbutton_acoustic_file") - # self.pushbutton_acoustic_file.setIcon(self.icon_folder) - # self.gridLayout_groupbox_acoustic_file.addWidget(self.pushbutton_acoustic_file, 0, 1, 1, 1) - # self.lineEdit_acoustic_file = QLineEdit() - # self.gridLayout_groupbox_acoustic_file.addWidget(self.lineEdit_acoustic_file, 0, 2, 1, 1) - - # Download Push Button event : connect button clicked signal to open file slot - # self.pushbutton_acoustic_file.clicked.connect(self.open_dialog_box) - # ++++++++++++++++++++++++++++++++++++++ # | Group Box Measurements information | # ++++++++++++++++++++++++++++++++++++++ @@ -277,40 +200,26 @@ class AcousticDataTab(QWidget): self.label_temperature = QLabel("Temperature : ") - # self.spinbox_temperature = QDoubleSpinBox() - # self.spinbox_temperature.setSuffix("°C") - # self.spinbox_temperature.setKeyboardTracking(False) - self.lineEdit_temperature = QLineEdit() self.lineEdit_temperature.setText("0.00") self.lineEdit_temperature.setMaximumWidth(100) - # self.lineEdit_temperature.setValidator(QDoubleValidator) self.label_temperature_unit = QLabel() self.label_temperature_unit.setText("°C") self.label_speed_of_sound = QLabel("Speed of sound : ") - # self.spinbox_speed_of_sound = QDoubleSpinBox() - # self.spinbox_speed_of_sound.setSuffix("m/s") - # self.spinbox_speed_of_sound.setMaximum(1e5) - self.lineEdit_speed_of_sound = QLineEdit() self.lineEdit_speed_of_sound.setMaximumWidth(100) self.label_speed_of_sound_unit = QLabel() self.label_speed_of_sound_unit.setText("m/s") - - self.label_freq = QLabel() self.combobox_frequency_information = QComboBox() self.combobox_frequency_information.setMaximumWidth(100) self.label_kt = QLabel() - # self.spinbox_kt = QDoubleSpinBox() - # self.spinbox_kt.setDecimals(2) - # self.spinbox_kt.setMaximum(1e6) self.lineEdit_kt = QLineEdit() self.lineEdit_kt.setMaximumWidth(100) @@ -325,10 +234,6 @@ class AcousticDataTab(QWidget): self.label_sound_attenuation = QLabel("Sound attenuation : ") - # self.spinbox_sound_attenuation = QDoubleSpinBox() - # self.spinbox_sound_attenuation.setSuffix("/m") - # self.spinbox_sound_attenuation.setDecimals(5) - self.lineEdit_sound_attenuation = QLineEdit() self.lineEdit_sound_attenuation.setMaximumWidth(100) @@ -351,8 +256,6 @@ class AcousticDataTab(QWidget): self.label_pings_per_profile_value = QLabel() self.label_rx = QLabel() # a0 in UBSediFlow parameters - # self.spinbox_rx = QDoubleSpinBox() - # self.spinbox_rx.setMaximum(1e6) self.lineEdit_rx = QLineEdit() self.lineEdit_rx.setMaximumWidth(100) @@ -361,220 +264,11 @@ class AcousticDataTab(QWidget): self.label_tx = QLabel() # a1 in UBSediFlow parameters - # self.spinbox_tx = QDoubleSpinBox() - # self.spinbox_tx.setMaximum(1e6) - self.lineEdit_tx = QLineEdit() self.lineEdit_tx.setMaximumWidth(100) self.checkbox_tx = QCheckBox() - # --- Group box noise file --- (move to signal processing tab) - - # self.groupbox_noise_file = QGroupBox() - # self.gridLayout_groupbox_noise_file = QGridLayout(self.groupbox_noise_file) - # - # self.pushbutton_noise_level_with_tail_of_mean_profile = QPushButton() - # self.gridLayout_groupbox_noise_file.addWidget(self.pushbutton_noise_level_with_tail_of_mean_profile, 0, 0, 1, 1) - # self.pushbutton_noise_file = QPushButton() - # self.pushbutton_noise_file.setObjectName("pushbutton_noise_file") - # self.pushbutton_noise_file.setIcon(icon_folder) - # self.gridLayout_groupbox_noise_file.addWidget(self.pushbutton_noise_file, 0, 1, 1, 1) - # self.lineEdit_noise_file = QLineEdit() - # self.gridLayout_groupbox_noise_file.addWidget(self.lineEdit_noise_file, 0, 2, 1, 1) - # - # 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.pushbutton_noise_file.clicked.connect(self.open_dialog_box) - # - # self.verticalLayout_groupbox_download.addWidget(self.groupbox_noise_file) - - # # --- Group box GPS file --- - # - # self.groupbox_gps = QGroupBox() - # self.horizontal_gps_input_data = QVBoxLayout(self.groupbox_gps) - # - # self.verticalLayout_radiobutton_gps = QHBoxLayout() - # self.horizontal_gps_input_data.addLayout(self.verticalLayout_radiobutton_gps) - # - # self.radiobutton_value = QRadioButton("Value") - # self.radiobutton_value.setChecked(True) - # self.verticalLayout_radiobutton_gps.addWidget(self.radiobutton_value) - # - # self.radiobutton_file = QRadioButton("File") - # # self.radiobutton_file.setChecked(False) - # self.verticalLayout_radiobutton_gps.addWidget(self.radiobutton_file) - # - # self.groupbox_gps_value = QGroupBox() - # self.gridLayout_gps_value = QGridLayout(self.groupbox_gps_value) - # self.label_distance_value = QLabel() - # self.label_distance_value.setText("Distance : ") - # self.gridLayout_gps_value.addWidget(self.label_distance_value, 0, 0, 1, 1) - # self.lineEdit_gps_value = QLineEdit() - # self.gridLayout_gps_value.addWidget(self.lineEdit_gps_value, 0, 1, 1, 1) - # self.label_m_per_record = QLabel("m / record") - # self.gridLayout_gps_value.addWidget(self.label_m_per_record, 0, 2, 1, 1) - # - # self.horizontal_gps_input_data.addWidget(self.groupbox_gps_value) - # - # self.groupbox_gps_file = QGroupBox() - # self.groupbox_gps_file.setEnabled(False) - # - # self.gridLayout_groupbox_gps_file = QGridLayout(self.groupbox_gps_file) - # - # self.combobox_gps_system_choice = QComboBox() - # self.combobox_gps_system_choice.addItems([" ", "GPS1", "GPS2", "no GPS"]) - # self.gridLayout_groupbox_gps_file.addWidget(self.combobox_gps_system_choice, 0, 0, 1, 2) - # self.pushbutton_gps_file = QPushButton() - # self.pushbutton_gps_file.setIcon(self.icon_folder) - # self.gridLayout_groupbox_gps_file.addWidget(self.pushbutton_gps_file, 0, 2, 1, 1) - # self.lineEdit_gps_file = QLineEdit() - # self.gridLayout_groupbox_gps_file.addWidget(self.lineEdit_gps_file, 0, 3, 1, 2) - # - # self.label_date_groupbox_gps_file = QLabel() - # self.gridLayout_groupbox_gps_file.addWidget(self.label_date_groupbox_gps_file, 1, 0, 1, 2) - # self.label_hour_groupbox_gps_file = QLabel() - # self.gridLayout_groupbox_gps_file.addWidget(self.label_hour_groupbox_gps_file, 1, 2, 1, 2) - # - # # Download Push Button event : connect button clicked signal to open file slot - # # self.pushButton_gpsfile.clicked.connect(self.open_dialog_box) - # - # self.horizontal_gps_input_data.addWidget(self.groupbox_gps_file) - # - # self.verticalLayout_groupbox_download.addWidget(self.groupbox_gps) - # - # # # --- Time offset line between ABS system time and GPS time --- - # - # self.gridLayout_time_offset = QGridLayout() - # self.label_time_offset = QLabel() - # # self.gridLayout_time_offset.addWidget(self.label_time_offset, 0, 0, 1, 1) - # self.gridLayout_groupbox_gps_file.addWidget(self.label_time_offset, 2, 0, 1, 1) - # self.label_acoustic_gps_time = QLabel() - # self.label_acoustic_gps_time.setText( - # "Tacoustic =" + " Tgps") - # # self.gridLayout_time_offset.addWidget(self.label_acoustic_gps_time, 0, 1, 1, 1) - # self.gridLayout_groupbox_gps_file.addWidget(self.label_acoustic_gps_time, 2, 1, 1, 1) - # self.combobox_plus_minus = QComboBox() - # self.combobox_plus_minus.addItem("+") - # self.combobox_plus_minus.addItem("-") - # # self.gridLayout_time_offset.addWidget(self.combobox_plus_minus, 0, 2, 1, 1) - # self.gridLayout_groupbox_gps_file.addWidget(self.combobox_plus_minus, 2, 2, 1, 1) - # self.spinbox_time_offset_value = QSpinBox() - # # self.gridLayout_time_offset.addWidget(self.spinbox_time_offset_value, 0, 3, 1, 1) - # self.gridLayout_groupbox_gps_file.addWidget(self.spinbox_time_offset_value, 2, 3, 1, 1) - # self.label_seconds = QLabel() - # self.label_seconds.setText("sec") - # # self.gridLayout_time_offset.addWidget(self.label_seconds, 0, 4, 1, 1) - # self.gridLayout_groupbox_gps_file.addWidget(self.label_seconds, 2, 4, 1, 1) - # self.verticalLayout_groupbox_download.addLayout(self.gridLayout_time_offset) - - # # ++++++++++++++++++++++++++++++++++++++ - # # | Group Box Measurements information | - # # ++++++++++++++++++++++++++++++++++++++ - # - # # self.verticalLayout_groupbox_info = QVBoxLayout(self.groupbox_info) - # # - # # self.formLayout_temperature = QFormLayout() - # # self.label_temperature = QLabel("Temperature : ") - # # self.lineEdit_temperature = QLineEdit() - # # self.formLayout_temperature.addRow(self.label_temperature, self.lineEdit_temperature) - # # self.verticalLayout_groupbox_info.addLayout(self.formLayout_temperature) - # # - # # self.gridLayout_groupbox_info = QGridLayout() - # # self.verticalLayout_groupbox_info.addLayout(self.gridLayout_groupbox_info) - # - # # --- Information for Aquascat --- - # # self.verticalLayout_goupbox_info = QGridLayout(self.groupbox_info) - # - # self.gridLayout_groupbox_info = QGridLayout() - # self.groupbox_info.setLayout(self.gridLayout_groupbox_info) - # - # self.scrollbar_measurement_information.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) - # self.scrollbar_measurement_information.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - # self.scrollbar_measurement_information.setWidgetResizable(True) - # - # self.scrollbar_measurement_information.setWidget(self.groupbox_info) - # # self.self.gridLayout_groupbox_info = QGridLayout() - # # self.scrollbar_measurement_information.setLayout(self.gridLayout_groupbox_info) - # # self.verticalLayout_goupbox_info.addWidget(self.scrollbar_measurement_information) - # - # # scroll = QtWidgets.QScrollArea() - # # scroll.setWidget(mygroupbox) - # # scroll.setWidgetResizable(True) - # # scroll.setFixedHeight(200) - # # layout = QtWidgets.QVBoxLayout(self) - # # layout.addWidget(scroll) - # - # self.label_temperature = QLabel("Temperature : ") - # # self.gridLayout_groupbox_info.addWidget(self.label_temperature, 0, 0, 1, 1) - # # self.label_temperature.setAlignment(Qt.AlignLeft | Qt.AlignTop) - # self.spinbox_temperature = QDoubleSpinBox() - # self.spinbox_temperature.setSuffix("°C") - # # self.gridLayout_groupbox_info.addWidget(self.spinbox_temperature, 0, 1, 1, 1) - # # self.label_degreCelsius = QLabel("°C") - # # self.gridLayout_groupbox_info.addWidget(self.label_degreCelsius, 0, 2, 1, 1) - # - # # self.label_date_acoustic_file = QLabel() - # # self.gridLayout_groupbox_info.addWidget(self.label_date_acoustic_file, 1, 0, 1, 2) - # # self.label_hour_acoustic_file = QLabel() - # # self.gridLayout_groupbox_info.addWidget(self.label_hour_acoustic_file, 1, 1, 1, 1) - # - # self.label_ABS_name = QLabel() - # - # self.label_date_acoustic_file = QLabel() - # self.label_hour_acoustic_file = QLabel() - # - # self.label_freq = QLabel() - # self.combobox_frequency_information = QComboBox() - # - # self.label_profiles = QLabel() - # self.label_profiles_value = QLabel() - # self.label_profiles_per_sec = QLabel() - # self.label_profiles_per_sec_value = QLabel() - # self.label_cells = QLabel() # n_cell in UBSediFlow parameters - # self.label_cells_value = QLabel() - # self.label_cell_size = QLabel() # r_em in UBSediFlow parameters - # self.label_cell_size_value = QLabel() - # self.label_pulse_length = QLabel() # n_p / PRF with n_p = n_ech, nb of pulses to calculate one instantaneous profile - # self.label_pulse_length_value = QLabel() - # self.label_pings_per_sec = QLabel() # PRF in UBSediFlow parameters - # self.label_pings_per_sec_value = QLabel() - # self.label_pings_per_profile = QLabel() # n_profile/n_avg in UBSediFlow parameters - # self.label_pings_per_profile_value = QLabel() - # - # self.label_kt = QLabel() - # self.spinbox_kt = QDoubleSpinBox() - # self.spinbox_kt.setMaximum(1e6) - # self.checkbox_kt = QCheckBox() - # - # self.label_rx = QLabel() # a0 in UBSediFlow parameters - # self.spinbox_rx = QDoubleSpinBox() - # self.spinbox_rx.setMaximum(1e6) - # self.checkbox_rx = QCheckBox() - # - # self.label_tx = QLabel() # a1 in UBSediFlow parameters - # self.spinbox_tx = QDoubleSpinBox() - # self.spinbox_tx.setMaximum(1e6) - # self.checkbox_tx = QCheckBox() - # - # # # --- Parameters for UBSediFlow --- - # # self.label_config = QLabel() - # # self.combobox_config = QComboBox() - # # self.label_transducer = QLabel() - # # - # # # --- Information for UBSediFlow --- - # # self.label_tr_out = QLabel() - # # self.label_tr_out.setText("Channel : ") - # # self.label_r_cell1 = QLabel() - # # self.label_r_cell1.setText("1st cell size : ") - # # self.label_r_dcell = QLabel() - # # self.label_r_dcell.setText("Inter-cell distance : ") - # - # # self.groupbox_measurement_information_Aquascat() # +++++++++++++++++++++++++++++ # | Group Box Table of values | @@ -583,89 +277,12 @@ class AcousticDataTab(QWidget): self.groupbox_table.setTitle("Table of values") self.verticalLayout_groupbox_table = QVBoxLayout(self.groupbox_table) - # self.horizontalLayout_pushbutton_fill_export_table = QHBoxLayout() - # self.pushbutton_fill_table = QPushButton() - # self.horizontalLayout_pushbutton_fill_export_table.addWidget(self.pushbutton_fill_table) - # - # self.pushbutton_fill_table.clicked.connect(self.fill_table) - # - # self.horizontalSpacerItem_between_pushbutton_fill_export_table = QSpacerItem(50, 10, - # QSizePolicy.Expanding, QSizePolicy.Minimum) - # self.horizontalLayout_pushbutton_fill_export_table.addItem( - # self.horizontalSpacerItem_between_pushbutton_fill_export_table) - # - # self.pushbutton_export_table = QPushButton() - # self.horizontalLayout_pushbutton_fill_export_table.addWidget(self.pushbutton_export_table) - # - # self.pushbutton_export_table.clicked.connect(self.export_table) - # - # self.verticalLayout_groupbox_table.addLayout(self.horizontalLayout_pushbutton_fill_export_table) - - # self.tableWidget = QTableWidget() - # self.tableWidget.setRowCount(10) - # self.tableWidget.setColumnCount(10) - # self.verticalLayout_groupbox_table.addWidget(self.tableWidget) - self.tableView = QTableView() data = pd.DataFrame(np.zeros((10, 10))) self.tableModel = TableModel(data) self.tableView.setModel(self.tableModel) self.verticalLayout_groupbox_table.addWidget(self.tableView) - # #------------------------------------ - # # self.tableView = QTableView() - # # self.tableView.setSizeAdjustPolicy(QAbstractScrollArea.AdjustToContentsOnFirstShow) - # # self.tableView.horizontalHeader().setStretchLastSection(True) - # # - # # df, tension, freq, depth = self._model.acoustic_data() - # # print(np.zeros(len(tension), dtype=int)) - # # print("dimension", list(tension)) - # # self.data = pd.DataFrame({'Time (sec)': np.zeros(10, dtype=int), - # # 'y (m)': np.zeros(10, dtype=int), - # # 'z (m)': np.zeros(10, dtype=int), - # # 'Frequency (MHz)': np.zeros(10, dtype=int), - # # 'Voltage (V)': np.zeros(10, dtype=int), - # # 'SNR': np.zeros(10, dtype=int)}) - # # self.data = pd.DataFrame({'Time (sec)': np.zeros(len(tension), dtype=int), - # # 'y (m)': np.zeros(len(tension), dtype=int), - # # 'z (m)': np.zeros(len(tension), dtype=int), - # # 'Frequency (Hz)': df['freq'], - # # 'Voltage (V)': df['tension'], - # # 'SNR': np.zeros(len(tension), dtype=int)}) - # # self.data.reset_index(drop=True, inplace=True) - # # self.data = self._model.acoustic_data_table - # # - # # self.tableModel = TableModel(self.data) - # # self.tableView.setModel(self.tableModel) - # # self.verticalLayout_groupboxtable.addWidget(self.tableView) - # # ------------------------------------ - # - # self.tableWidget = QTableWidget() - # self.tableWidget.setRowCount(10) - # self.tableWidget.setColumnCount(10) - # # - # # print("tablewidget = ", self.tableWidget) - # # - # # self.tableWidget2 = TableWidget(3, 3) - # # print("tablewidget2 = ", self.tableWidget2) - # - # # for i in range(10): - # # for j in range(10): - # # item_v = QTableWidgetItem() - # # self.tableWidget.setVerticalHeaderItem(i, item_v) - # # item_h = QTableWidgetItem() - # # self.tableWidget.setHorizontalHeaderItem(j, item_h) - # - # # Fill table Push Button event - # # 1st : connect widgets to controllers = fill table - # self.pushbutton_fill_table_acousic.clicked.connect(self.fill_table) # self.on_pushButtonFillTable_clicked - # # 2nd : listen for model event signals = table is filled - # # self._model.BS_data_updated.connect(self.on_BS_data_updated) - # - # self.verticalLayout_groupboxtable.addWidget(self.tableWidget) - # # self.verticalLayout_groupboxtable.addWidget(self.tableView) - - # ++++++++++++++++++++++++++++ # | Group Box Display option | # ++++++++++++++++++++++++++++ @@ -780,10 +397,6 @@ class AcousticDataTab(QWidget): self.lineEdit_depth_min_limits.setMaximumWidth(80) self.gridLayout_groupbox_display_option_limits.addWidget(self.lineEdit_depth_min_limits, 1, 2, 1, 1, Qt.AlignCenter) - # self.between_depth = QLabel() - # self.between_depth.setPixmap(self.icon_between) - # self.gridLayout_groupbox_display_option_limits.addWidget(self.between_depth, 0, 3, 1, 1, Qt.AlignCenter) - self.lineEdit_depth_max_limits = QLineEdit() self.lineEdit_depth_max_limits.setText("0.00") self.lineEdit_depth_max_limits.setMaximumWidth(80) @@ -793,19 +406,6 @@ class AcousticDataTab(QWidget): self.label_depth_max.setText("0.00") self.gridLayout_groupbox_display_option_limits.addWidget(self.label_depth_max, 1, 4, 1, 1, Qt.AlignCenter) - # self.doubleRangeSlider_depth = QLabeledDoubleRangeSlider() - # self.doubleRangeSlider_depth.setOrientation(Qt.Horizontal) - # # self.doubleRangeSlider_depth.setMinimumWidth(350) - # self.doubleRangeSlider_depth.setRange(min=0, max=50) - # self.doubleRangeSlider_depth.setValue(value=(5, 40)) - # # print(self.doubleRangeSlider_depth.value()[0]) - # self.doubleRangeSlider_depth.setFont(QFont("Ubuntu", 5)) - # self.gridLayout_groupbox_display_option_limits.addWidget(self.doubleRangeSlider_depth, 0, 1, 1, 1) - - # self.spinbox_depth_max = QDoubleSpinBox() - # self.spinbox_depth_max.setRange(0, 100000) - # self.gridLayout_groupbox_display_option.addWidget(self.spinbox_depth_max, 0, 3, 1, 1) - self.label_depth_unit_meter = QLabel("meters") self.gridLayout_groupbox_display_option_limits.addWidget(self.label_depth_unit_meter, 1, 5, 1, 1, Qt.AlignCenter) @@ -818,10 +418,6 @@ class AcousticDataTab(QWidget): self.label_recording_time = QLabel("Recording time") self.gridLayout_groupbox_display_option_limits.addWidget(self.label_recording_time, 2, 0, 1, 1, Qt.AlignRight) - # self.spinbox_recording_time_min = QDoubleSpinBox() - # self.spinbox_recording_time_min.setRange(0, 100000) - # self.gridLayout_groupbox_display_option.addWidget(self.spinbox_recording_time_min, 1, 1, 1, 1) - self.label_time_min = QLabel() self.label_time_min.setText("0.00") self.gridLayout_groupbox_display_option_limits.addWidget(self.label_time_min, 2, 1, 1, 1, Qt.AlignCenter) @@ -832,10 +428,6 @@ class AcousticDataTab(QWidget): self.gridLayout_groupbox_display_option_limits.addWidget(self.lineEdit_time_min_limits, 2, 2, 1, 1, Qt.AlignCenter) - # self.between_time = QLabel() - # self.between_time.setPixmap(self.icon_between) - # self.gridLayout_groupbox_display_option_limits.addWidget(self.between_time, 1, 3, 1, 1, Qt.AlignCenter) - self.lineEdit_time_max_limits = QLineEdit() self.lineEdit_time_max_limits.setText("0.00") self.lineEdit_time_max_limits.setMaximumWidth(80) @@ -846,18 +438,6 @@ class AcousticDataTab(QWidget): self.label_time_max.setText("0.00") self.gridLayout_groupbox_display_option_limits.addWidget(self.label_time_max, 2, 4, 1, 1, Qt.AlignCenter) - # self.doubleRangeSlider_recording_time = QLabeledDoubleRangeSlider() - # self.doubleRangeSlider_recording_time.setOrientation(Qt.Horizontal) - # # self.doubleRangeSlider_recording_time.setStyleSheet() - # # self.doubleRangeSlider_recording_time.setMinimumWidth(350) - # # self.doubleRangeSlider_recording_time.setRange(min=0, max=50) - # # self.doubleRangeSlider_recording_time.setValue(value=(5, 40)) - # self.gridLayout_groupbox_display_option_limits.addWidget(self.doubleRangeSlider_recording_time, 1, 1, 1, 1) - - # self.spinbox_recording_time_max = QDoubleSpinBox() - # self.spinbox_recording_time_max.setRange(0, 100000) - # self.gridLayout_groupbox_display_option.addWidget(self.spinbox_recording_time_max, 1, 3, 1, 1) - self.label_recording_time_unit_meter = QLabel("seconds") self.gridLayout_groupbox_display_option_limits.addWidget(self.label_recording_time_unit_meter, 2, 5, 1, 1, Qt.AlignCenter) @@ -870,10 +450,6 @@ class AcousticDataTab(QWidget): self.label_distance_from_bank = QLabel("Distance from bank") self.gridLayout_groupbox_display_option_limits.addWidget(self.label_distance_from_bank, 3, 0, 1, 1, Qt.AlignRight) - # self.spinbox_distance_from_bank_min = QDoubleSpinBox() - # self.spinbox_distance_from_bank_min.setRange(0, 100000) - # self.gridLayout_groupbox_display_option.addWidget(self.spinbox_distance_from_bank_min, 2, 1, 1, 1) - self.label_distance_from_bank_min = QLabel() self.label_distance_from_bank_min.setText("0.00") self.gridLayout_groupbox_display_option_limits.addWidget(self.label_distance_from_bank_min, 3, 1, 1, 1, Qt.AlignCenter) @@ -884,10 +460,6 @@ class AcousticDataTab(QWidget): self.gridLayout_groupbox_display_option_limits.addWidget(self.lineEdit_distance_from_bank_min_limits, 3, 2, 1, 1, Qt.AlignCenter) - # self.between_distance_from_transducer = QLabel() - # self.between_distance_from_transducer.setPixmap(self.icon_between) - # self.gridLayout_groupbox_display_option_limits.addWidget(self.between_distance_from_transducer, 2, 3, 1, 1, Qt.AlignCenter) - self.lineEdit_distance_from_bank_max_limits = QLineEdit() self.lineEdit_distance_from_bank_max_limits.setText("0.00") self.lineEdit_distance_from_bank_max_limits.setMaximumWidth(80) @@ -898,17 +470,6 @@ class AcousticDataTab(QWidget): self.label_distance_from_bank_max.setText("0.00") self.gridLayout_groupbox_display_option_limits.addWidget(self.label_distance_from_bank_max, 3, 4, 1, 1, Qt.AlignCenter) - # self.doubleRangeSlider_distance_from_bank = QLabeledDoubleRangeSlider() - # self.doubleRangeSlider_distance_from_bank.setOrientation(Qt.Horizontal) - # # self.doubleRangeSlider_distance_from_bank.setMinimumWidth(350) - # self.doubleRangeSlider_distance_from_bank.setRange(min=0, max=50) - # self.doubleRangeSlider_distance_from_bank.setValue(value=(5, 40)) - # self.gridLayout_groupbox_display_option_limits.addWidget(self.doubleRangeSlider_distance_from_bank, 2, 1, 1, 1) - - # self.spinbox_distance_from_bank_max = QDoubleSpinBox() - # self.spinbox_distance_from_bank_max.setRange(0, 100000) - # self.gridLayout_groupbox_display_option.addWidget(self.spinbox_distance_from_bank_max, 2, 3, 1, 1) - self.label_distance_from_bank_unit_meter = QLabel("meters") self.gridLayout_groupbox_display_option_limits.addWidget(self.label_distance_from_bank_unit_meter, 3, 5, 1, 1, Qt.AlignCenter) @@ -928,30 +489,10 @@ class AcousticDataTab(QWidget): self.combobox_frequency_bathymetry.setMaximumWidth(150) self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.combobox_frequency_bathymetry, 0, 0, 1, 1, Qt.AlignCenter) - # self.label_1st_intg_area = QLabel("1st intg area") - # self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.label_1st_intg_area, 0, 1, 1, 1) - # - # self.doubleRangeSlider_intg_area = QLabeledDoubleRangeSlider() - # self.doubleRangeSlider_intg_area.setOrientation(Qt.Vertical) - # # self.doubleRangeSlider_distance_from_bank.setMinimumWidth(350) - # self.doubleRangeSlider_intg_area.setRange(min=0, max=50) - # self.doubleRangeSlider_intg_area.setValue(value=(5, 40)) - # self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.doubleRangeSlider_intg_area, 0, 2, 1, 1) - # - # self.label_offset = QLabel("Offset") - # self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.label_offset, 0, 3, 1, 1) - # - # self.spinbox_offset_next_cell = QDoubleSpinBox() - # self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.spinbox_offset_next_cell, 0, 4, 1, 1) - - self.label_from_bathy = QLabel() self.label_from_bathy.setText("From") self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.label_from_bathy, 0, 1, 1, 1, Qt.AlignCenter) - # self.spinbox_depth_min_bathy = QDoubleSpinBox() - # self.spinbox_depth_min_bathy.setRange(0, 9999) - # self.spinbox_depth_min_bathy.setDecimals(2) self.lineEdit_depth_min_bathy = QLineEdit() self.lineEdit_depth_min_bathy.setText("0.00") self.lineEdit_depth_min_bathy.setMaximumWidth(80) @@ -965,9 +506,6 @@ class AcousticDataTab(QWidget): self.label_to_bathy.setText("to") self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.label_to_bathy, 0, 4, 1, 1, Qt.AlignCenter) - # self.spinbox_depth_max_bathy = QDoubleSpinBox() - # self.spinbox_depth_max_bathy.setRange(0, 99999) - # self.spinbox_depth_max_bathy.setDecimals(2) self.lineEdit_depth_max_bathy = QLineEdit() self.lineEdit_depth_max_bathy.setText("0.00") self.lineEdit_depth_max_bathy.setMaximumWidth(80) @@ -981,9 +519,6 @@ class AcousticDataTab(QWidget): self.label_next_cell.setText("+/-") self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.label_next_cell, 0, 7, 1, 1, Qt.AlignCenter) - # self.doublespinbox_next_cell_bathy = QDoubleSpinBox() - # self.doublespinbox_next_cell_bathy.setRange(0, 99999) - # self.doublespinbox_next_cell_bathy.setDecimals(2) self.lineEdit_next_cell_bathy = QLineEdit() self.lineEdit_next_cell_bathy.setText("0.00") self.lineEdit_next_cell_bathy.setMaximumWidth(80) @@ -997,190 +532,6 @@ class AcousticDataTab(QWidget): self.pushbutton_apply_bathymetry.setIcon(self.icon_apply_limits) self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.pushbutton_apply_bathymetry, 0, 10, 1, 1) - # o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o - - # --- Push buttons to trigger plot of transect with Backscatter acoustic raw data and SNR --- - - # self.gridLayout_plot_transect_frequency_profile = QGridLayout() - # self.verticalLayout_display_option.addLayout(self.gridLayout_plot_transect_frequency_profile) - # # self.horizontalLayout_pushbutton_plot_BS_SNR_data = QHBoxLayout() - # # self.verticalLayout_display_option.addLayout(self.horizontalLayout_pushbutton_plot_BS_SNR_data) - # - # self.pushbutton_plot_transect_with_BS_raw_data = QPushButton() - # self.gridLayout_plot_transect_frequency_profile.addWidget(self.pushbutton_plot_transect_with_BS_raw_data, 0, 0, 1, 3) - # # self.horizontalLayout_pushbutton_plot_BS_SNR_data.addWidget(self.pushbutton_plot_transect_with_BS_raw_data) - # - # self.pushbutton_plot_transect_with_BS_raw_data.clicked.connect(self.plot_transect_with_BS_raw_data) - - # self.label_profile_frequency = QLabel() - # self.label_profile_frequency.setText("Profile frequency : ") - # self.gridLayout_plot_transect_frequency_profile.addWidget(self.label_profile_frequency, 0, 4, 1, 1) - - # self.combobox_frequency_profile = QComboBox() - # self.gridLayout_plot_transect_frequency_profile.addWidget(self.combobox_frequency_profile, 0, 5, 1, 1) - - # self.pushbutton_plot_transect_with_SNR_data = QPushButton() - # self.horizontalLayout_pushbutton_plot_BS_SNR_data.addWidget(self.pushbutton_plot_transect_with_SNR_data) - - # self.pushbutton_plot_transect_with_SNR_data.clicked.connect(self.plot_transect_with_SNR_data) - - # # --- Group Box Plot x-axis in time --- - # - # self.groupbox_xaxis_time = QGroupBox() - # # self.verticalLayout_groupbox_xaxis_time = QVBoxLayout(self.groupbox_xaxis_time) - # # self.groupbox_xaxis_time.setCheckable(True) - # # self.groupbox_xaxis_time.setChecked(True) - # # self.groupbox_xaxis_time.clicked.connect(self.transect_xaxis_choice) - # self.verticalLayout_display_option.addWidget(self.groupbox_xaxis_time) - # - # self.gridLayout_groupbox_xaxis_time = QGridLayout(self.groupbox_xaxis_time) - # self.label_from_time = QLabel() - # self.label_from_time.setText("From") - # # self.gridLayout_groupbox_xaxis_time.addWidget(self.label_from_time, 0, 0, 1, 1) - # # - # self.label_tmin = QLabel() - # self.label_tmin.setText("tmin = ") - # self.gridLayout_groupbox_xaxis_time.addWidget(self.label_tmin, 0, 1, 1, 1) - # - # self.spinbox_tmin = QDoubleSpinBox() - # self.spinbox_tmin.setRange(0, 9999) - # self.gridLayout_groupbox_xaxis_time.addWidget(self.spinbox_tmin, 0, 2, 1, 1) - # # self.spinbox_tmin.valueChanged.connect(self.update_xaxis_transect_with_BS_raw_data) - # # self.spinbox_tmin.valueChanged.connect(self.update_xaxis_transect_with_SNR_data) - # - # self.label_tmin_unit = QLabel() - # self.label_tmin_unit.setText("sec") - # self.gridLayout_groupbox_xaxis_time.addWidget(self.label_tmin_unit, 0, 3, 1, 1) - # - # self.label_to_time = QLabel() - # self.label_to_time.setText("to") - # self.gridLayout_groupbox_xaxis_time.addWidget(self.label_to_time, 0, 4, 1, 1) - # - # self.label_tmax = QLabel() - # self.label_tmax.setText("tmax = ") - # self.gridLayout_groupbox_xaxis_time.addWidget(self.label_tmax, 0, 5, 1, 1) - # - # self.spinbox_tmax = QDoubleSpinBox() - # self.spinbox_tmax.setRange(0, 9999) - # self.gridLayout_groupbox_xaxis_time.addWidget(self.spinbox_tmax, 0, 6, 1, 1) - # # self.spinbox_tmax.valueChanged.connect(self.update_xaxis_transect_with_BS_raw_data) - # # self.spinbox_tmax.valueChanged.connect(self.update_xaxis_transect_with_SNR_data) - # # self.spinbox_tmax.keyPressEvent.connect(self.onValueChanged) - # - # self.label_tmax_unit = QLabel() - # self.label_tmax_unit.setText("sec") - # self.gridLayout_groupbox_xaxis_time.addWidget(self.label_tmax_unit, 0, 7, 1, 1) - # - # self.pushbutton_apply_transect_boundaries_in_time = QPushButton() - # self.pushbutton_apply_transect_boundaries_in_time.setText("Apply") - # self.gridLayout_groupbox_xaxis_time.addWidget(self.pushbutton_apply_transect_boundaries_in_time, 0, 7, 1, 1) - # - # # --- Group Box Plot x-axis in space --- - # - # self.groupbox_xaxis_space = QGroupBox() - # # self.groupbox_xaxis_space.setCheckable(True) - # # self.groupbox_xaxis_space.setChecked(False) - # # self.groupbox_xaxis_space.clicked.connect(self.transect_xaxis_choice) - # self.verticalLayout_display_option.addWidget(self.groupbox_xaxis_space) - # - # self.gridLayout_groupbox_xaxis_space = QGridLayout(self.groupbox_xaxis_space) - # self.label_from_space = QLabel() - # self.label_from_space.setText("From ") - # self.gridLayout_groupbox_xaxis_space.addWidget(self.label_from_space, 0, 0, 1, 1) - # - # self.label_xmin = QLabel() - # self.label_xmin.setText("xmin = ") - # self.gridLayout_groupbox_xaxis_space.addWidget(self.label_xmin, 0, 1, 1, 1) - # - # self.spinbox_xmin = QSpinBox() - # self.spinbox_xmin.setRange(0, 9999) - # self.gridLayout_groupbox_xaxis_space.addWidget(self.spinbox_xmin, 0, 2, 1, 1) - # - # self.label_xmin_m = QLabel() - # self.label_xmin_m.setText("m") - # self.gridLayout_groupbox_xaxis_space.addWidget(self.label_xmin_m, 0, 3, 1, 1) - # - # self.label_to_space = QLabel() - # self.label_to_space.setText("to") - # self.gridLayout_groupbox_xaxis_space.addWidget(self.label_to_space, 0, 4, 1, 1) - # - # self.label_xmax = QLabel() - # self.label_xmax.setText("xmax = ") - # self.gridLayout_groupbox_xaxis_space.addWidget(self.label_xmax, 0, 5, 1, 1) - # - # self.spinbox_xmax = QSpinBox() - # self.spinbox_xmax.setRange(0, 9999) - # self.gridLayout_groupbox_xaxis_space.addWidget(self.spinbox_xmax, 0, 6, 1, 1) - # - # self.label_xmax_m = QLabel() - # self.label_xmax_m.setText("m") - # self.gridLayout_groupbox_xaxis_space.addWidget(self.label_xmax_m, 0, 7, 1, 1) - # - # self.pushbutton_apply_transect_boundaries_in_space = QPushButton() - # self.pushbutton_apply_transect_boundaries_in_space.setText("Apply") - # self.gridLayout_groupbox_xaxis_space.addWidget(self.pushbutton_apply_transect_boundaries_in_space, 0, 8, 1, 1) - # # self.pushbutton_apply_transect_boundaries_in_space.clicked.connect(self.update_xaxis_transect_with_BS_raw_data) - # # self.pushbutton_apply_transect_boundaries_in_space.clicked.connect(self.update_xaxis_transect_with_SNR_data) - # - # # --- Group Box bathymetry computation algorithm to detect and plot bottom of transect--- - # - # self.groupbox_compute_bathymetry = QGroupBox() - # # # self.groupbox_crosssectionbottom.setTitle("Plot bottom of cross section") - # # self.groupbox_crosssectionbottom.setCheckable(True) - # # self.groupbox_crosssectionbottom.setChecked(False) - # self.verticalLayout_display_option.addWidget(self.groupbox_compute_bathymetry) - # - # self.gridlayout_compute_bathymetry = QGridLayout(self.groupbox_compute_bathymetry) - # - # self.combobox_freq_choice = QComboBox() - # # self.combobox_freq_choice.addItems(['', '0.3 MHz', '0.5 Mhz', '1 MHz', '5 MHz']) - # self.gridlayout_compute_bathymetry.addWidget(self.combobox_freq_choice, 0, 0, 2, 1) - # - # self.label_from_bathy = QLabel() - # self.label_from_bathy.setText("From - ") - # self.gridlayout_compute_bathymetry.addWidget(self.label_from_bathy, 0, 1, 1, 1) - # - # # self.spinbox_depth_min = QSpinBox() - # self.spinbox_depth_min = QDoubleSpinBox() - # self.spinbox_depth_min.setRange(0, 9999) - # self.spinbox_depth_min.setDecimals(2) - # self.gridlayout_compute_bathymetry.addWidget(self.spinbox_depth_min, 0, 2, 1, 1) - # - # self.label_depth_min_unit = QLabel() - # self.label_depth_min_unit.setText("m") - # self.gridlayout_compute_bathymetry.addWidget(self.label_depth_min_unit, 0, 3, 1, 1) - # - # self.label_to_bathy = QLabel() - # self.label_to_bathy.setText("to - ") - # self.gridlayout_compute_bathymetry.addWidget(self.label_to_bathy, 0, 4, 1, 1) - # - # # self.spinbox_depth_max = QSpinBox() - # self.spinbox_depth_max = QDoubleSpinBox() - # self.spinbox_depth_max.setRange(0, 99999) - # self.spinbox_depth_max.setDecimals(2) - # self.gridlayout_compute_bathymetry.addWidget(self.spinbox_depth_max, 0, 5, 1, 1) - # - # self.label_depth_max_unit = QLabel() - # self.label_depth_max_unit.setText("m") - # self.gridlayout_compute_bathymetry.addWidget(self.label_depth_max_unit, 0, 6, 1, 1) - # - # self.label_next_cell = QLabel() - # self.label_next_cell.setText("Next cell : +/-") - # self.gridlayout_compute_bathymetry.addWidget(self.label_next_cell, 1, 1, 1, 1) - # - # self.doublespinbox_next_cell = QDoubleSpinBox() - # self.doublespinbox_next_cell.setRange(0, 99999) - # self.doublespinbox_next_cell.setDecimals(2) - # self.gridlayout_compute_bathymetry.addWidget(self.doublespinbox_next_cell, 1, 2, 1, 1) - # - # self.label_next_cell_unit = QLabel() - # self.label_next_cell_unit.setText("m") - # self.gridlayout_compute_bathymetry.addWidget(self.label_next_cell_unit, 1, 3, 1, 1) - # - # self.pushbutton_compute_bathymetry_algorithm = QPushButton() - # self.pushbutton_compute_bathymetry_algorithm.setText("Compute \n&& \nPlot") - # self.gridlayout_compute_bathymetry.addWidget(self.pushbutton_compute_bathymetry_algorithm, 0, 7, 2, 1) - # ===================================================== # BOTTOM HORIZONTAL BOX LAYOUT # ===================================================== @@ -1190,61 +541,19 @@ class AcousticDataTab(QWidget): # ++++++++++++++++++++++++++************++++++++++++++ self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data = QVBoxLayout(self.groupbox_transect_2Dplot_raw_BS_data) - # self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.setContentsMargins(0, 0, 0, 0) - # self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.setSpacing(0) - # self.canvas_BS = None - # self.scroll_BS = None - - - # self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.toolbar_BS) - - # self.fig_BS, self.axis_BS = plt.subplots(nrows=4, ncols=1, sharex=True, sharey=False, - # layout="constrained") - # self.canvas_BS = FigureCanvas(self.fig_BS) self.canvas_BS = FigureCanvas() self.toolbar_BS = NavigationToolBar(self.canvas_BS, self) self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.toolbar_BS) - # self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.scroll_BS) 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.setWidgetResizable(True) self.scroll_BS.setAlignment(Qt.AlignCenter) self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.scroll_BS) - # self.fig_BS, self.axis_BS = plt.subplots(nrows=4, ncols=1, sharex=True, sharey=False, layout="constrained") - # self.fig, self.ax = plt.subplots(4, 1) - # self.canvas_BS = FigureCanvas(self.fig_BS) - # self.canvas_BS = FigureCanvas() - # self.plotToolbar_rawdata = NavigationToolBar(self.canvas_rawdata, self) - # self.plot_acoustic_raw_data() - # self.verticalLayout_plotrawdata.addWidget(self.plotToolbar_rawdata) - # self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.canvas_BS) - - # ++++++++++++++++++++++++++++++++++++++++++++ - # | Group Box Signal to Noise ratio 2D field | - # ++++++++++++++++++++++++++++++++++++++++++++ - - # self.verticalLayout_groupbox_transect_2Dplot_snr_data = QVBoxLayout(self.groupbox_transect_2Dplot_snr_data) - # - # self.canvas_SNR = None - # self.scroll_SNR = None - # - # # self.figure, self.axis = plt.subplots(nrows=4, ncols=1, sharex=True, sharey=False, layout="constrained") - # # # self.canvas_snrdata = FigureCanvas(self.figure) - # # - # # self.canvas_snrdata = FigureCanvas() - # # # self.plotToolbar_snrdata = NavigationToolBar(self.canvas_snrdata, self) - # # # self.plot_snr_data() - # # # self.verticalLayout_plotsnrdata.addWidget(self.plotToolbar_snrdata) - # # self.verticalLayout_plotsnrdata.addWidget(self.canvas_snrdata) - # # - # # self.horizontalLayoutBottom.addWidget(self.groupbox_transect_2Dplot_snr_data) - # +++++++++++++++++++++++++++++++++++++++++++ # | Group Box Plot profile from BS 2D field | # +++++++++++++++++++++++++++++++++++++++++++ @@ -1265,25 +574,13 @@ class AcousticDataTab(QWidget): self.verticalLayout_groupbox_plot_the_vertical_profile_for_a_frequency.addWidget(self.groupbox_plot_profile) - # self.groupbox_plot_profile = QGroupBox() - # self.groupbox_plot_profile.setTitle("Profile") - # self.verticalLayout_groupbox_plot_profile = QVBoxLayout(self.groupbox_plot_profile) - # self.verticalLayout_groupbox_plot_the_vertical_profile_for_a_frequency.addWidget(self.groupbox_plot_profile) - - # self.fig_profile, self.axis_profile = plt.subplots(nrows=1, ncols=1, layout="constrained") - # self.canvas_plot_profile = FigureCanvas(self.fig_profile) self.canvas_plot_profile = FigureCanvas() self.toolbar_profile = NavigationToolBar(self.canvas_plot_profile, self) - # print("navigation toolbar item", self.toolbar_profile.toolitems) - # self.horizontalLayout_spacerItem_combobox_frequency_profile.addWidget(self.toolbar_profile) - # self.horizontalLayout_spacerItem_combobox_frequency_profile.addWidget(self.combobox_frequency_profile) self.verticalLayout_groupbox_plot_profile.addWidget(self.toolbar_profile) self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_plot_profile) - # self.canvas_plot_profile = None - # --- Slider for moving the profile --- self.horizontalLayout_slider = QHBoxLayout() self.verticalLayout_groupbox_plot_the_vertical_profile_for_a_frequency.addLayout(self.horizontalLayout_slider) @@ -1319,16 +616,9 @@ class AcousticDataTab(QWidget): self.slider.setTickInterval(1) self.slider.setValue(1) - # self.slider.valueChanged.connect(self.plot_transect_with_BS_raw_data) - # self.slider.valueChanged.connect(self.plot_profile) - self.retranslate_acoustic_data_tab() self.max_selected_file = 1 - # self.btnToggled() - - # plt.rcParams['figure.max_open_warning'] = 100 - # print("plt.rcParams['figure.max_open_warning'] ", plt.rcParams['figure.max_open_warning']) # -------------------------------------------------------------------------------------------------------------- # --- Connect signal of widget --- @@ -1339,13 +629,11 @@ class AcousticDataTab(QWidget): self.delBtn.clicked.connect(self.remove_file_from_ListWidget) self.clearBtn.clicked.connect(self.clear_files_from_ListWidget) - # self.fileListWidget.itemSelectionChanged.connect(self.fileListWidget_function) self.fileListWidget.itemSelectionChanged.connect(self.print_selected_file) self.fileListWidget.itemSelectionChanged.connect(self.fill_measurements_information_groupbox) self.fileListWidget.itemSelectionChanged.connect(self.fill_table) self.fileListWidget.itemSelectionChanged.connect(self.compute_tmin_tmax) self.fileListWidget.itemSelectionChanged.connect(self.compute_rmin_rmax) - # self.fileListWidget.itemSelectionChanged.connect(self.compute_BS_cross_section) self.fileListWidget.itemSelectionChanged.connect(self.update_frequency_combobox) self.fileListWidget.itemSelectionChanged.connect(self.plot_backscattered_acoustic_signal_recording) self.fileListWidget.itemSelectionChanged.connect(self.plot_profile) @@ -1353,58 +641,33 @@ class AcousticDataTab(QWidget): self.fileListWidget.itemSelectionChanged.connect(self.update_plot_profile) self.fileListWidget.itemSelectionChanged.connect(self.set_range_for_spinboxes_bathymetry) - # self.fileListWidget.clicked.connect(self.rename_file_in_ListWidget) - self.combobox_ABS_name.currentIndexChanged.connect(self.fill_measurements_information_groupbox) self.checkbox_kt.stateChanged.connect(self.activate_unactivate_spinbox_kt) - # self.radiobutton_value.toggled.connect(self.onClicked_radiobutton_gps) - # self.radiobutton_file.toggled.connect(self.onClicked_radiobutton_gps) - self.lineEdit_distance_from_ABS_to_free_surface.returnPressed.connect(self.distance_from_ABS_to_free_surface) self.pushbutton_distance_from_ABS_to_free_surface.clicked.connect(self.refresh_distance_from_ABS_to_free_surface) - # self.spinbox_temperature.valueChanged.connect(self.temperature_value) - # self.spinbox_temperature.lineEdit().returnPressed.connect(self.temperature_value) self.lineEdit_temperature.returnPressed.connect(self.temperature_value) self.lineEdit_speed_of_sound.returnPressed.connect(self.water_velocity) self.lineEdit_sound_attenuation.returnPressed.connect(self.water_attenuation) - # self.spinbox_tmax.lineEdit().returnPressed.connect(self.time_spin_box_value) - # self.spinbox_tmax.lineEdit().returnPressed.connect(self.compute_tmin_tmax) - # self.spinbox_tmax.lineEdit().returnPressed.connect(self.compute_BS_cross_section) - # self.spinbox_tmax.lineEdit().returnPressed.connect(self.update_plot_backscattered_acoustic_signal_recording) - # self.spinbox_tmax.lineEdit().returnPressed.connect(self.update_plot_profile) - self.groupbox_gps_value.toggled.connect(self.groupbox_gps_value_toggle) self.groupbox_gps_value.toggled.connect(self.groupbox_gps_value_size_change) self.groupbox_gps_file.toggled.connect(self.groupbox_gps_file_toggle) self.groupbox_gps_file.toggled.connect(self.groupbox_gps_file_size_change) - # self.doubleRangeSlider_recording_time.lab .connect(self.print_value_doubleRangeSlider) - - # self.pushbutton_apply_depth_limits.clicked.connect(self.compute_depth_cross_section) - # self.pushbutton_apply_depth_limits.clicked.connect(self.compute_rmin_rmax) self.pushbutton_apply_depth_limits.clicked.connect(self.compute_BS_cross_section) self.pushbutton_apply_depth_limits.clicked.connect(self.update_plot_backscattered_acoustic_signal_recording) self.pushbutton_apply_depth_limits.clicked.connect(self.update_plot_profile) self.pushbutton_apply_depth_limits.clicked.connect(self.set_range_for_spinboxes_bathymetry) - # self.pushbutton_apply_recording_time_limits.clicked.connect(self.compute_time_cross_section) - # self.pushbutton_apply_recording_time_limits.clicked.connect(self.compute_tmin_tmax) self.pushbutton_apply_recording_time_limits.clicked.connect(self.compute_BS_cross_section) self.pushbutton_apply_recording_time_limits.clicked.connect(self.detect_bottom) self.pushbutton_apply_recording_time_limits.clicked.connect(self.update_plot_backscattered_acoustic_signal_recording) self.pushbutton_apply_recording_time_limits.clicked.connect(self.update_plot_profile) - # self.pushbutton_apply_transect_boundaries_in_time.clicked.connect(self.compute_tmin_tmax) - # self.pushbutton_apply_transect_boundaries_in_time.clicked.connect(self.compute_BS_cross_section) - # self.pushbutton_apply_transect_boundaries_in_time.clicked.connect( - # self.update_plot_backscattered_acoustic_signal_recording) - # self.pushbutton_apply_transect_boundaries_in_time.clicked.connect(self.update_plot_profile) - self.pushbutton_apply_bathymetry.clicked.connect(self.detect_bottom) self.pushbutton_slider_left_to_begin.clicked.connect(self.slide_profile_number_to_begin) @@ -1423,41 +686,13 @@ class AcousticDataTab(QWidget): # -------------------- Functions for Acoustic dataTab -------------------- - def print_value_doubleRangeSlider(self): - if Qt.Key_Return: - print(f"value of double range slider {self.doubleRangeSlider_recording_time.value()}") - - def print_range_changed(self): - print(f"tmax = {self.doubleRangeSlider_depth.value()[1]}") - - # def fileListWidget_function(self): - # self.print_selected_file() - # self.fill_measurements_information_groupbox() - # self.fill_table() - # self.compute_tmin_tmax() - # self.compute_rmin_rmax() - # self.update_frequency_combobox() - # self.plot_backscattered_acoustic_signal_recording() - # self.plot_profile() - # self.update_plot_backscattered_acoustic_signal_recording() - # self.update_plot_profile() - # self.set_range_for_spinboxes_bathymetry() - def retranslate_acoustic_data_tab(self): - # self.groupbox_download.setTitle(_translate("CONSTANT_STRING", cs.DOWNLOAD)) - self.groupbox_info.setTitle(_translate("CONSTANT_STRING", cs.MEASUREMENTS_INFORMATION)) - # self.groupbox_acoustic_file.setTitle(_translate("CONSTANT_STRING", cs.ACOUSTIC_FILE)) self.label_date_acoustic_file.setText(_translate("CONSTANT_STRING", cs.DATE) + ":") self.label_hour_acoustic_file.setText(_translate("CONSTANT_STRING", cs.HOUR) + ":") - # self.groupbox_noise_file.setTitle(_translate("CONSTANT_STRING", cs.NOISE_FILE)) - # self.pushbutton_noise_level_with_tail_of_mean_profile.setText(_translate("CONSTANT_STRING", cs.NOISE_LEVEL)) - # 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.label_profiles.setText(_translate("CONSTANT_STRING", cs.NB_PROFILES) + ":") self.label_profiles.setToolTip(_translate("CONSTANT_STRING", cs.NB_PROFILES_TOOLTIP)) @@ -1491,72 +726,14 @@ class AcousticDataTab(QWidget): self.label_tx.setText(_translate("CONSTANT_STRING", cs.GAIN_TX) + ":") self.label_tx.setToolTip(_translate("CONSTANT_STRING", cs.GAIN_TX_TOOLTIP)) - # self.groupbox_table.setTitle(_translate("CONSTANT_STRING", cs.TABLE_VALUES)) - - # self.pushbutton_fill_table.setText(_translate("CONSTANT_STRING", cs.SYNCHRONIZE_AND_FILL_TABLE)) - # self.pushbutton_export_table.setText(_translate("CONSTANT_STRING", cs.EXPORT_TABLE)) - - # self.groupbox_gps.setTitle(_translate("CONSTANT_STRING", cs.GPS_FILE)) - # self.label_date_groupbox_gps_file.setText(_translate("CONSTANT_STRING", cs.DATE) + ":") - # self.label_hour_groupbox_gps_file.setText(_translate("CONSTANT_STRING", cs.HOUR) + ":") - - # self.label_time_offset.setText(_translate("CONSTANT_STRING", cs.TIME_OFFSET)) - - # self.groupbox_display_option.setTitle(_translate("CONSTANT_STRING", cs.DISPLAY_OPTIONS)) - - # self.pushbutton_plot_transect_with_BS_raw_data.setText(_translate("CONSTANT_STRING", cs.PLOT_TRANSECT)) - # self.pushbutton_plot_transect_with_SNR_data.setText(_translate("CONSTANT_STRING", cs.PLOT_SNR)) - - # self.groupbox_xaxis_time.setTitle(_translate("CONSTANT_STRING", cs.PLOT_XAXIS_IN_TIME)) - # self.label_tmin.setText(_translate("CONSTANT_STRING", cs.FROM) + " tmin = ") - # self.label_tmax.setText(_translate("CONSTANT_STRING", cs.TO) + " tmax = ") - # self.pushButton_plot_acoustic_transect_in_time.setText(_translate("CONSTANT_STRING", cs.PLOT_TRANSECT)) - - # self.groupbox_xaxis_space.setTitle(_translate("CONSTANT_STRING", cs.PLOT_XAXIS_IN_SPACE)) - # self.label_zmin.setText(_translate("CONSTANT_STRING", cs.FROM) + " zmin = ") - # self.label_zmax.setText(_translate("CONSTANT_STRING", cs.TO) + " zmax = ") - # self.pushButton_plot_acoustic_transect_in_space.setText(_translate("CONSTANT_STRING", cs.PLOT_TRANSECT)) - - # self.groupbox_compute_bathymetry.setTitle(_translate("CONSTANT_STRING", cs.PLOT_BOTTOM_CROSS_SECTION)) - # self.label_depthmin.setText(_translate("CONSTANT_STRING", cs.INITIAL_DEPTH_RANGE) + ":") - # self.label_depthmin.setText(_translate("CONSTANT_STRING", cs.FROM)) - # self.label_to.setText(_translate("CONSTANT_STRING", cs.TO)) - # self.pushButton_bottom_transect.setText(_translate("CONSTANT_STRING", cs.PLOT_BOTTOM)) - self.groupbox_transect_2Dplot_raw_BS_data.setTitle(_translate("CONSTANT_STRING", cs.RAW_ACOUSTIC_DATA_2D_FIELD)) - # self.groupbox_transect_2Dplot_snr_data.setTitle(_translate("CONSTANT_STRING", cs.SIGNAL_TO_NOISE_RATIO_2D_FIELD)) - - # def currentItemChanged(self, i1, i2): - # self.btnToggled() - - # def btnToggled(self): - # # f1 = self.fileListWidget.count() > 0 - # # f2 = True if self.fileListWidget.currentItem() else False - # # print(f"f1 {f1}") - # # print(f"f2 {f2}") - # # self.delBtn.setEnabled(f1 and f2) - # # self.clearBtn.setEnabled(f1) - # print("self.fileListWidget.selectedItems()[1:] : ", self.fileListWidget.selectedItems()[1:]) - # if len(self.fileListWidget.selectedItems()) > self.max_selected_file: - # self.fileListWidget.selectedItems()[1:].setSelected(False) - - def print_selected_file(self): print(f"Selected file in list widget : {self.fileListWidget.selectedItems()}") print("self.fileListWidget.selectedItems()[1:] : ", self.fileListWidget.selectedItems()[1:]) if len(self.fileListWidget.selectedItems()) > self.max_selected_file: self.fileListWidget.setSelectionMode(1) - # def add(self): - # # ext_lst = self.__extensions if self.__extensions else 'All Files (*.*)' - # filenames = QFileDialog.getOpenFileNames(self, 'Open Files', '', ext_lst) - # if filenames[0]: - # filenames = filenames[0] - # self.fileListWidget.addFilenames(filenames) - # self.fileAdded.emit(filenames) - # # self.__btnToggled() - def onClicked_radiobutton_gps(self): radiobutton = self.sender() @@ -1570,20 +747,11 @@ class AcousticDataTab(QWidget): def ABS_system_choice(self): if self.combobox_ABS_system_choice.currentText() == " ": - print("0 combobox_ABS_system_choice ", self.combobox_ABS_system_choice.currentText()) self.groupbox_measurement_information_no_ABS() elif self.combobox_ABS_system_choice.currentText() == "AQUAscat": - print("1 combobox_ABS_system_choice ", self.combobox_ABS_system_choice.currentText()) self.groupbox_measurement_information_Aquascat() - # self.lineEdit_acoustic_file.clear() elif self.combobox_ABS_system_choice.currentText() == "UBSediFlow": - print("2 combobox_ABS_system_choice ", self.combobox_ABS_system_choice.currentText()) self.groupbox_measurement_information_UBSediFlow() - # self.lineEdit_acoustic_file.clear() - # self.label_date_groupbox_acoustic_file.clear() - # self.label_date_groupbox_acoustic_file.setText(_translate("CONSTANT_STRING", cs.DATE) + ": ") - # self.label_hour_groupbox_acoustic_file.clear() - # self.label_hour_groupbox_acoustic_file.setText(_translate("CONSTANT_STRING", cs.HOUR) + ": ") def groupbox_measurement_information_no_ABS(self): @@ -1600,17 +768,14 @@ class AcousticDataTab(QWidget): self.pushbutton_distance_from_ABS_to_free_surface.hide() self.label_temperature.hide() - # self.spinbox_temperature.hide() self.lineEdit_temperature.hide() self.label_temperature_unit.hide() self.label_speed_of_sound.hide() - # self.spinbox_speed_of_sound.hide() self.lineEdit_speed_of_sound.hide() self.label_speed_of_sound_unit.hide() self.label_sound_attenuation.hide() - # self.spinbox_sound_attenuation.hide() self.lineEdit_sound_attenuation.hide() self.label_sound_attenuation_unit.hide() @@ -1626,18 +791,15 @@ class AcousticDataTab(QWidget): self.label_pings_per_profile.hide() self.label_kt.hide() - # self.spinbox_kt.hide() self.lineEdit_kt.hide() self.label_kt_unit.hide() self.checkbox_kt.hide() self.label_rx.hide() - # self.spinbox_rx.hide() self.lineEdit_rx.hide() self.checkbox_rx.hide() self.label_tx.hide() - # self.spinbox_tx.hide() self.lineEdit_tx.hide() self.checkbox_tx.hide() @@ -1656,17 +818,14 @@ class AcousticDataTab(QWidget): self.pushbutton_distance_from_ABS_to_free_surface.hide() self.label_temperature.hide() - # self.spinbox_temperature.hide() self.lineEdit_temperature.hide() self.label_temperature_unit.hide() self.label_speed_of_sound.hide() - # self.spinbox_speed_of_sound.hide() self.lineEdit_speed_of_sound.hide() self.label_speed_of_sound_unit.hide() self.label_sound_attenuation.hide() - # self.spinbox_sound_attenuation.hide() self.lineEdit_sound_attenuation.hide() self.label_sound_attenuation_unit.hide() @@ -1682,21 +841,18 @@ class AcousticDataTab(QWidget): self.label_pings_per_profile.hide() self.label_kt.hide() - # self.spinbox_kt.hide() self.lineEdit_kt.hide() self.label_kt_unit.hide() self.checkbox_kt.hide() self.label_rx.hide() - # self.spinbox_rx.hide() self.lineEdit_rx.hide() self.checkbox_rx.hide() self.label_tx.hide() - # self.spinbox_tx.hide() self.lineEdit_tx.hide() self.checkbox_tx.hide() - print("Coucou 0") + for i in reversed(range(self.gridLayout_groupbox_info.count())): widgetToRemove = self.gridLayout_groupbox_info.itemAt(i).widget() # remove it from the layout list @@ -1729,7 +885,6 @@ class AcousticDataTab(QWidget): self.label_temperature.show() self.gridLayout_groupbox_info.addWidget(self.label_temperature, 3, 0, 1, 1, Qt.AlignLeft) - # self.spinbox_temperature.show() self.lineEdit_temperature.show() self.gridLayout_groupbox_info.addWidget(self.lineEdit_temperature, 3, 1, 1, 1, Qt.AlignLeft) self.label_temperature_unit.show() @@ -1738,12 +893,10 @@ class AcousticDataTab(QWidget): self.label_speed_of_sound.show() self.gridLayout_groupbox_info.addWidget(self.label_speed_of_sound, 4, 0, 1, 1, Qt.AlignLeft) - # self.spinbox_speed_of_sound.show() self.lineEdit_speed_of_sound.show() self.gridLayout_groupbox_info.addWidget(self.lineEdit_speed_of_sound, 4, 1, 1, 1, Qt.AlignLeft) self.label_speed_of_sound_unit.show() self.gridLayout_groupbox_info.addWidget(self.label_speed_of_sound_unit, 4, 2, 1, 1, Qt.AlignLeft) - print("Coucou 1.5") self.label_freq.show() self.gridLayout_groupbox_info.addWidget(self.label_freq, 5, 0, 1, 1, Qt.AlignLeft) @@ -1752,7 +905,6 @@ class AcousticDataTab(QWidget): self.label_kt.show() self.gridLayout_groupbox_info.addWidget(self.label_kt, 6, 0, 1, 1, Qt.AlignLeft) - # self.spinbox_kt.show() self.lineEdit_kt.show() self.gridLayout_groupbox_info.addWidget(self.lineEdit_kt, 6, 1, 1, 1, Qt.AlignLeft) self.label_kt_unit.show() @@ -1762,7 +914,6 @@ class AcousticDataTab(QWidget): self.label_sound_attenuation.show() self.gridLayout_groupbox_info.addWidget(self.label_sound_attenuation, 7, 0, 1, 1, Qt.AlignLeft) - # self.spinbox_sound_attenuation.show() self.lineEdit_sound_attenuation.show() self.gridLayout_groupbox_info.addWidget(self.lineEdit_sound_attenuation, 7, 1, 1, 1, Qt.AlignLeft) self.label_sound_attenuation_unit.show() @@ -1785,7 +936,6 @@ class AcousticDataTab(QWidget): self.label_rx.show() self.gridLayout_groupbox_info.addWidget(self.label_rx, 15, 0, 1, 1, Qt.AlignLeft) - # self.spinbox_rx.show() self.lineEdit_rx.show() self.gridLayout_groupbox_info.addWidget(self.lineEdit_rx, 15, 1, 1, 1, Qt.AlignLeft) self.checkbox_rx.show() @@ -1793,12 +943,10 @@ class AcousticDataTab(QWidget): self.label_tx.show() self.gridLayout_groupbox_info.addWidget(self.label_tx, 16, 0, 1, 1, Qt.AlignLeft) - # self.spinbox_tx.show() self.lineEdit_tx.show() self.gridLayout_groupbox_info.addWidget(self.lineEdit_tx, 16, 1, 1, 1, Qt.AlignLeft) self.checkbox_tx.show() self.gridLayout_groupbox_info.addWidget(self.checkbox_tx, 16, 3, 1, 1, Qt.AlignLeft) - print("Coucou 2") def groupbox_measurement_information_UBSediFlow(self): # --- Hide Aquascat information --- @@ -1815,17 +963,14 @@ class AcousticDataTab(QWidget): self.pushbutton_distance_from_ABS_to_free_surface.hide() self.label_temperature.hide() - # self.spinbox_temperature.hide() self.lineEdit_temperature.hide() self.label_temperature_unit.hide() self.label_speed_of_sound.hide() - # self.spinbox_speed_of_sound.hide() self.lineEdit_speed_of_sound.hide() self.label_speed_of_sound_unit.hide() self.label_sound_attenuation.hide() - # self.spinbox_sound_attenuation.hide() self.lineEdit_sound_attenuation.hide() self.label_sound_attenuation_unit.hide() @@ -1841,18 +986,15 @@ class AcousticDataTab(QWidget): self.label_pings_per_profile.hide() self.label_kt.hide() - # self.spinbox_kt.hide() self.lineEdit_kt.hide() self.label_kt_unit.hide() self.checkbox_kt.hide() self.label_rx.hide() - # self.spinbox_rx.hide() self.lineEdit_rx.hide() self.checkbox_rx.hide() self.label_tx.hide() - # self.spinbox_tx.hide() self.lineEdit_tx.hide() self.checkbox_tx.hide() @@ -1887,7 +1029,6 @@ class AcousticDataTab(QWidget): self.label_temperature.show() self.gridLayout_groupbox_info.addWidget(self.label_temperature, 3, 0, 1, 1, Qt.AlignLeft) - # self.spinbox_temperature.show() self.lineEdit_temperature.show() self.gridLayout_groupbox_info.addWidget(self.lineEdit_temperature, 3, 1, 1, 1, Qt.AlignLeft) self.label_temperature_unit.show() @@ -1895,7 +1036,6 @@ class AcousticDataTab(QWidget): self.label_speed_of_sound.show() self.gridLayout_groupbox_info.addWidget(self.label_speed_of_sound, 4, 0, 1, 1, Qt.AlignLeft) - # self.spinbox_speed_of_sound.show() self.lineEdit_speed_of_sound.show() self.gridLayout_groupbox_info.addWidget(self.lineEdit_speed_of_sound, 4, 1, 1, 1, Qt.AlignLeft) self.label_speed_of_sound_unit.show() @@ -1908,7 +1048,6 @@ class AcousticDataTab(QWidget): self.label_kt.show() self.gridLayout_groupbox_info.addWidget(self.label_kt, 6, 0, 1, 1, Qt.AlignLeft) - # self.spinbox_kt.show() self.lineEdit_kt.show() self.gridLayout_groupbox_info.addWidget(self.lineEdit_kt, 6, 1, 1, 1, Qt.AlignLeft) self.label_kt_unit.show() @@ -1918,7 +1057,6 @@ class AcousticDataTab(QWidget): self.label_sound_attenuation.show() self.gridLayout_groupbox_info.addWidget(self.label_sound_attenuation, 7, 0, 1, 1, Qt.AlignLeft) - # self.spinbox_sound_attenuation.show() self.lineEdit_sound_attenuation.show() self.gridLayout_groupbox_info.addWidget(self.lineEdit_sound_attenuation, 7, 1, 1, 1, Qt.AlignLeft) self.label_sound_attenuation_unit.show() @@ -1941,7 +1079,6 @@ class AcousticDataTab(QWidget): self.label_rx.show() self.gridLayout_groupbox_info.addWidget(self.label_rx, 15, 0, 1, 1, Qt.AlignLeft) - # self.spinbox_rx.show() self.lineEdit_rx.show() self.gridLayout_groupbox_info.addWidget(self.lineEdit_rx, 15, 1, 1, 1, Qt.AlignLeft) self.checkbox_rx.show() @@ -1949,7 +1086,6 @@ class AcousticDataTab(QWidget): self.label_tx.show() self.gridLayout_groupbox_info.addWidget(self.label_tx, 16, 0, 1, 1, Qt.AlignLeft) - # self.spinbox_tx.show() self.lineEdit_tx.show() self.gridLayout_groupbox_info.addWidget(self.lineEdit_tx, 16, 1, 1, 1, Qt.AlignLeft) self.checkbox_tx.show() @@ -1982,8 +1118,6 @@ class AcousticDataTab(QWidget): stg.depth[self.fileListWidget.currentRow()] = acoustic_data._r stg.depth_reshape[self.fileListWidget.currentRow()] = acoustic_data.reshape_r() - print("0 np.nanmin(self.depth[self.fileListWidget.currentRow()][0]) ", - np.nanmin(stg.depth[self.fileListWidget.currentRow()])) stg.depth[self.fileListWidget.currentRow()] = ( stg.depth[self.fileListWidget.currentRow()] + stg.distance_from_ABS_to_free_surface[self.fileListWidget.currentRow()]) @@ -1991,8 +1125,6 @@ class AcousticDataTab(QWidget): stg.depth_reshape[self.fileListWidget.currentRow()] = ( stg.depth_reshape[self.fileListWidget.currentRow()] + stg.distance_from_ABS_to_free_surface[self.fileListWidget.currentRow()]) - print("1 np.nanmin(self.depth[self.fileListWidget.currentRow()][0]) ", - np.nanmin(stg.depth[self.fileListWidget.currentRow()])) stg.depth_cross_section[self.fileListWidget.currentRow()] = stg.depth[self.fileListWidget.currentRow()] @@ -2002,34 +1134,12 @@ class AcousticDataTab(QWidget): self.compute_depth_cross_section() self.set_range_for_spinboxes_bathymetry() - print('rmin ', stg.rmin) - print('rmax ', stg.rmax) - - print("stg.depth_cross_section", stg.depth_cross_section[self.fileListWidget.currentRow()].shape, - np.nanmin(stg.depth_cross_section[self.fileListWidget.currentRow()]), - np.nanmax(stg.depth_cross_section[self.fileListWidget.currentRow()])) - self.compute_BS_cross_section() self.update_plot_backscattered_acoustic_signal_recording() self.update_plot_profile() def temperature_value(self): - print("self.lineEdit_temperature.text() ", self.lineEdit_temperature.text()) - # if self.lineEdit_temperature.text()[-3:] == " °C": - # if findall(r",", self.lineEdit_temperature.text()[:-3]): - # stg.temperature = float(self.lineEdit_temperature.text()[:-3].replace(',', '.')) - # self.lineEdit_temperature.setText(self.lineEdit_temperature.text()[:-3].replace(',', '.') + " °C") - # else: - # stg.temperature = float(self.lineEdit_temperature.text()[:-3]) - # self.lineEdit_temperature.setText(self.lineEdit_temperature.text()[:-3] + " °C") - # else: - # if findall(r",", self.lineEdit_temperature.text()): - # stg.temperature = float(self.lineEdit_temperature.text().replace(',', '.')) - # self.lineEdit_temperature.setText(self.lineEdit_temperature.text().replace(',', '.') + " °C") - # else: - # stg.temperature = float(self.lineEdit_temperature.text()) - # self.lineEdit_temperature.setText(self.lineEdit_temperature.text() + " °C") if findall(r",", self.lineEdit_temperature.text()): stg.temperature = float(self.lineEdit_temperature.text().replace(',', '.')) @@ -2037,7 +1147,6 @@ class AcousticDataTab(QWidget): else: stg.temperature = float(self.lineEdit_temperature.text()) self.lineEdit_temperature.setText(self.lineEdit_temperature.text()) - print(f"stg.temperature : {stg.temperature}") self.water_velocity() self.water_attenuation() @@ -2053,10 +1162,6 @@ class AcousticDataTab(QWidget): self.lineEdit_speed_of_sound.setText(str(round(stg.water_velocity, 2))) - print("water velocity ", stg.water_velocity) - - # --------- - def groupbox_gps_value_toggle(self): if self.groupbox_gps_value.isChecked() == True: self.groupbox_gps_file.setChecked(False) @@ -2122,17 +1227,10 @@ class AcousticDataTab(QWidget): stg.water_attenuation[self.fileListWidget.currentRow()].append(alpha) - # self.spinbox_sound_attenuation.setValue(stg.water_attenuation[self.fileListWidget.currentRow()] - # [self.combobox_frequency_information.currentIndex()]) self.lineEdit_sound_attenuation.setText( str("%.6f" % stg.water_attenuation[self.fileListWidget.currentRow()][ self.combobox_frequency_information.currentIndex()])) - print("water attenuation ", stg.water_attenuation) - - def clicked_pushbutton_noise_level(self): - self.WindowNoiseLevelTailAveragedProfile().show() - def open_dialog_box(self): # --- Open dialog box + choice directory and select file --- @@ -2144,37 +1242,29 @@ class AcousticDataTab(QWidget): msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() elif self.combobox_ABS_system_choice.currentIndex() == 1: - # print("hello ", [stg.path_BS_raw_data[-1] if self.fileListWidget.count() > 0 else ""][0]) + filename = QFileDialog.getOpenFileNames(self, "AQUAscat file", [stg.path_BS_raw_data[-1] if self.fileListWidget.count() > 0 else ""][0], "Aquascat file (*.aqa)", options=QFileDialog.DontUseNativeDialog) - print("filenme ", filename) + for n in filename[0]: stg.path_BS_raw_data.append(path.dirname(n)) stg.filename_BS_raw_data.append(path.basename(n)) stg.data_preprocessed.append(path.basename(n)) - print("stg.path_BS_raw_data ", stg.path_BS_raw_data) - print("stg.filename_BS_raw_data ", stg.filename_BS_raw_data) - print("stg.data_preprocessed ", stg.data_preprocessed) - elif self.combobox_ABS_system_choice.currentIndex() == 2: filename = QFileDialog.getOpenFileNames(self, "UBSediFlow file", [stg.path_BS_raw_data[-1] if self.fileListWidget.count() > 0 else ""][0], "UBSediFlow file (*.udt)", options=QFileDialog.DontUseNativeDialog) - print("filename ", filename) + for n in filename[0]: stg.path_BS_raw_data.append(path.dirname(n)) stg.filename_BS_raw_data.append(path.basename(n)) stg.data_preprocessed.append(path.basename(n)) - # dir_name = path.dirname(filename[0]) - # name = path.basename(filename[0]) - print(f"dir name : {stg.path_BS_raw_data} & file name : {stg.filename_BS_raw_data}") - # --- Fill lineEdit with path and file names + load acoustic data --- # --- fill date, hour and measurements information + fill frequency combobox for bottom detection --- @@ -2183,7 +1273,6 @@ class AcousticDataTab(QWidget): try: self.load_BS_acoustic_raw_data() - print("0 Lecture de la donnée BS") except ValueError as e: @@ -2196,13 +1285,6 @@ class AcousticDataTab(QWidget): else: - print("1 Fill widget and plot graphs") - print(f"stg.path_BS_raw_data {stg.path_BS_raw_data}") - print(f"stg.filename_BS_raw_data {stg.filename_BS_raw_data}") - # self.lineEdit_acoustic_file.setText(stg.filename_BS_raw_data) - # self.lineEdit_acoustic_file.setToolTip(stg.path_BS_raw_data) - print("0. Number of filenames in fileListWidget : ", self.fileListWidget.count()) - if self.fileListWidget.count() == 0: for p, f in zip(stg.path_BS_raw_data, stg.filename_BS_raw_data): @@ -2210,15 +1292,11 @@ class AcousticDataTab(QWidget): self.fileListWidget.setToolTip(p) else: - print("self.fileListWidget.count() ", self.fileListWidget.count()) - print("stg.filename_BS_raw_data ", stg.filename_BS_raw_data) + for k in range(self.fileListWidget.count(), len(stg.filename_BS_raw_data), 1): - print("k = ", k) self.fileListWidget.addFilenames([stg.filename_BS_raw_data[k]]) self.fileListWidget.setToolTip(stg.path_BS_raw_data[k]) - print("1. Number of filenames in fileListWidget : ", self.fileListWidget.count()) - print("2. fileListWidget : ", self.fileListWidget) self.fill_measurements_information_groupbox() self.fill_table() @@ -2227,12 +1305,9 @@ class AcousticDataTab(QWidget): self.water_attenuation() stg.acoustic_data = list(range(self.fileListWidget.count())) - print("acoustic data ", stg.acoustic_data) - def rename_file_in_ListWidget(self, event): - print("souris cliqué !") - print(f"event = {event}") + if event == QEvent.MouseButtonPress: print("c'est bon") if event.button == Qt.RightButton: @@ -2244,12 +1319,6 @@ class AcousticDataTab(QWidget): menu = QMenu() menu.addAction('Rename') - # if menu.exec_(event.globalPos()): - # item = self.fileListWidget.itemAt(event.pos()) - # print(item.text()) - # return True - # return super().eventFilter(source, event) - def remove_file_from_ListWidget(self): if self.fileListWidget.count() > 0: @@ -2269,12 +1338,9 @@ class AcousticDataTab(QWidget): "stg.BS_raw_data_reshape", "stg.time_reshape", "stg.depth_reshape"] for p in list_to_pop1: - print(p) if isinstance(p, list): exec(p + ".pop(current_row)") - print("stg.freq after remove: ", stg.freq) - if stg.BS_cross_section: list_to_pop2 = ["stg.rmin", "stg.rmax", "stg.tmin", "stg.tmax", @@ -2290,10 +1356,6 @@ class AcousticDataTab(QWidget): self.label_date_acoustic_file.setText("Date: ") self.label_hour_acoustic_file.clear() self.label_hour_acoustic_file.setText("Hour: ") - # self.spinbox_temperature.setValue(0) - # self.lineEdit_temperature.setText("0.00") - # self.spinbox_speed_of_sound.setValue(0) - # self.spinbox_sound_attenuation.setValue(0) self.lineEdit_sound_attenuation.setText("0.00") self.combobox_frequency_information.clear() self.label_profiles_value.clear() @@ -2303,11 +1365,8 @@ class AcousticDataTab(QWidget): self.label_pulse_length_value.clear() self.label_pings_per_sec_value.clear() self.label_pings_per_profile_value.clear() - # self.spinbox_kt.setValue(0) self.lineEdit_kt.setText("0.00") - # self.spinbox_rx.setValue(0) self.lineEdit_rx.setText("0.00") - # self.spinbox_tx.setValue(0) self.lineEdit_tx.setText("0.00") # --- Clear display options --- @@ -2328,11 +1387,8 @@ class AcousticDataTab(QWidget): self.label_distance_from_bank_max.setText("0.00") self.combobox_frequency_bathymetry.clear() - # self.spinbox_depth_min_bathy.setValue(0.00) self.lineEdit_depth_min_bathy.setText("0.00") - # self.spinbox_depth_max_bathy.setValue(0.00) self.lineEdit_depth_max_bathy.setText("0.00") - # self.doublespinbox_next_cell_bathy.setValue(0.00) self.lineEdit_next_cell_bathy.setText("0.00") # --- Clear table of values --- @@ -2367,19 +1423,7 @@ class AcousticDataTab(QWidget): self.slider.setValue(0) self.slider.setMaximum(10) - # if self.line - # self.fig_BS.clf() - # print("axis BS : ", self.axis_BS) - # self.axis_BS.tolist().clear() - # print("clear axis BS : ", self.axis_BS) - # self.canvas_plot_profile.figure.clear() - # self.fig_profile.clear() - # self.axis_profile.clear() - # self.slider.setValue(0) - # self.slider.setMaximum(10) - def clear_files_from_ListWidget(self): - # if self.fileListWidget.count() > 0: list_to_clear = ["stg.acoustic_data", "stg.date", "stg.hour", "stg.freq", "stg.freq_text", "stg.temperature", "stg.nb_profiles", "stg.nb_profiles_per_sec", "stg.nb_cells", "stg.cell_size", @@ -2402,10 +1446,6 @@ class AcousticDataTab(QWidget): self.label_date_acoustic_file.setText("Date: ") self.label_hour_acoustic_file.clear() self.label_hour_acoustic_file.setText("Hour: ") - # self.spinbox_temperature.setValue(0) - # self.lineEdit_temperature.setText("0.00") - # self.spinbox_speed_of_sound.setValue(0) - # self.spinbox_sound_attenuation.setValue(0) self.lineEdit_sound_attenuation.setText("0.00") self.combobox_frequency_information.clear() self.label_profiles_value.clear() @@ -2415,11 +1455,8 @@ class AcousticDataTab(QWidget): self.label_pulse_length_value.clear() self.label_pings_per_sec_value.clear() self.label_pings_per_profile_value.clear() - # self.spinbox_kt.setValue(0) self.lineEdit_kt.setText("0.00") - # self.spinbox_rx.setValue(0) self.lineEdit_rx.setText("0.00") - # self.spinbox_tx.setValue(0) self.lineEdit_tx.setText("0.00") # --- Clear display options --- @@ -2440,11 +1477,8 @@ class AcousticDataTab(QWidget): self.label_distance_from_bank_max.setText("0.00") self.combobox_frequency_bathymetry.clear() - # self.spinbox_depth_min_bathy.setValue(0.00) self.lineEdit_depth_min_bathy.setText("0.00") - # self.spinbox_depth_max_bathy.setValue(0.00) self.lineEdit_depth_max_bathy.setText("0.00") - # self.doublespinbox_next_cell_bathy.setValue(0.00) self.lineEdit_next_cell_bathy.setText("0.00") # --- Clear table of values --- @@ -2453,21 +1487,6 @@ class AcousticDataTab(QWidget): self.tableModel = TableModel(data) self.tableView.setModel(self.tableModel) - # --- Clear figure area for backscattered acoutsic signal recording --- - # self.canvas_BS.figure.clear() - # self.fig_BS.clf() - # for ax in range(len(self.axis_BS)): - # self.axis_BS[ax].cla() - # print("axis BS : ", self.axis_BS) - # # self.axis_BS.tolist().clear() - # # print("clear axis BS : ", self.axis_BS) - # - # self.canvas_plot_profile.figure.clear() - # print("0 fig profile : ", self.fig_profile) - # self.fig_profile.delaxes(self.axis_profile) - # print("1 fig profile : ", self.fig_profile) - # # self.axis_profile.clear() - # --- Clear figure : 2D plot of the acoustic recording --- self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.scroll_BS) self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.toolbar_BS) @@ -2494,44 +1513,11 @@ class AcousticDataTab(QWidget): self.slider.setValue(0) self.slider.setMaximum(10) - # self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.scroll_BS) - # self.canvas_BS = FigureCanvas() - # self.scroll_BS.setWidget(self.canvas_BS) - # self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.scroll_BS) - - # --- Clear figure area for profile --- - - - # if self.fig_profile: - # self.axis_profile.cla() - # self.fig_profile.clf() - # self.verticalLayout_groupbox_plot_profile.removeWidget(self.canvas_plot_profile) - # self.canvas_plot_profile = FigureCanvas() - # self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_plot_profile) - - # self.canvas_BS.figure.clear() - # self.fig_BS.clf() - # print("axis BS : ", self.axis_BS) - # self.axis_BS.tolist().clear() - # print("clear axis BS : ", self.axis_BS) - # self.canvas_BS = FigureCanvas() - # self.scroll_BS.setWidget(self.canvas_BS) - # - # self.canvas_plot_profile.figure.clear() - # self.fig_profile.clear() - # self.axis_profile.clear() - # self.canvas_plot_profile = FigureCanvas() - # self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_plot_profile) - - - def load_BS_acoustic_raw_data(self): if self.fileListWidget.count() == 0: for p, f in zip(stg.path_BS_raw_data, stg.filename_BS_raw_data): - print("p ", p) - print("f ", f) if self.combobox_ABS_system_choice.currentIndex() == 1: @@ -2565,18 +1551,13 @@ class AcousticDataTab(QWidget): stg.BS_raw_data_reshape.append(acoustic_data.reshape_BS_raw_data()) stg.depth.append(acoustic_data._r) stg.depth_2D.append(np.array([])) - print("stg.depth_2D ", len(stg.depth_2D), stg.depth_2D[0].shape) - # stg.depth_2D.append(np.array([])) stg.depth_reshape.append(acoustic_data.reshape_r()) stg.time.append(acoustic_data._time) stg.time_reshape.append(acoustic_data.reshape_t()) stg.freq.append(acoustic_data._freq) - print("stg.freq", stg.freq) stg.freq_text.append(acoustic_data._freq_text) - print("stg.freq text", stg.freq_text) stg.date.append(acoustic_data._date) stg.hour.append(acoustic_data._hour) - print("date ", stg.date, "hour ", stg.hour) stg.distance_from_ABS_to_free_surface.append(0.00) stg.nb_profiles.append(acoustic_data._nb_profiles) stg.nb_profiles_per_sec.append(acoustic_data._nb_profiles_per_sec) @@ -2589,11 +1570,8 @@ class AcousticDataTab(QWidget): stg.kt_read = acoustic_data._kt else: stg.kt_read = [0*i for i in range(acoustic_data._freq.shape[0])] - # stg.kt_corrected.append([0]*len(stg.kt_read[-1])) stg.gain_rx.append(acoustic_data._gain_rx) stg.gain_tx.append(acoustic_data._gain_tx) - # stg.temperature.append(0) - # stg.water_velocity.append(0) stg.water_attenuation.append([]) # --- The other acoustic variables lists are filled with empty object. --- @@ -2613,7 +1591,6 @@ class AcousticDataTab(QWidget): stg.val_bottom.append([]) stg.ind_bottom.append([]) stg.freq_bottom_detection.append((0, 0)) - # stg.depth_bottom_detection_1st_int_area.append([]) stg.BS_mean.append(np.array([])) stg.BS_noise_raw_data.append(np.array([])) @@ -2642,12 +1619,6 @@ class AcousticDataTab(QWidget): stg.FCB = np.array([]) stg.depth_real = np.array([]) stg.lin_reg = [] - # - # stg.frequencies_for_calibration.append([]) - # stg.frequency_for_inversion.append([]) - # - # stg.fine_sample_position.append([]) - # stg.sand_sample_position.append([]) stg.kt2D.append(np.array([])) stg.kt3D.append(np.array([])) @@ -2657,41 +1628,6 @@ class AcousticDataTab(QWidget): stg.SSC_sand.append(np.array([])) def fill_measurements_information_groupbox(self): - # if self.combobox_ABS_system_choice.currentIndex() == 1: - - # self.label_date_acoustic_file.setText( - # _translate("CONSTANT_STRING", cs.DATE) + ": " + str(stg.date[self.fileListWidget.currentRow()])) - # self.label_hour_acoustic_file.setText( - # _translate("CONSTANT_STRING", cs.HOUR) + ": " + str(stg.hour[self.fileListWidget.currentRow()])) - # self.label_profiles.setText( - # _translate("CONSTANT_STRING", cs.NB_PROFILES) + ": " + str(stg.nb_profiles[self.fileListWidget.currentRow()])) - # self.label_profiles_per_sec.setText( - # _translate("CONSTANT_STRING", cs.NB_PROFILES_PER_SEC) + ": " + - # str(stg.nb_profiles_per_sec[self.fileListWidget.currentRow()]) + " Hz") - # print("OL ", self.fileListWidget.currentRow()) - # self.label_freq.setText( - # _translate("CONSTANT_STRING", cs.FREQUENCY) + ": " + ', '.join(stg.freq_text[self.fileListWidget.currentIndex().row()])) - # self.label_cells.setText( - # _translate("CONSTANT_STRING", cs.NB_CELLS) + ": " + str(stg.nb_cells[self.fileListWidget.currentRow()])) - # self.label_cell_size.setText( - # _translate("CONSTANT_STRING", cs.CELL_SIZE) + ": " + str(100*round(stg.cell_size[self.fileListWidget.currentRow()], 3)) + " cm") - # self.label_pulse_length.setText( - # _translate("CONSTANT_STRING", cs.PULSE_LENGHT) + ": " + str(round(stg.pulse_length[self.fileListWidget.currentRow()], 6)) + "sec") - # self.label_pings_per_sec.setText( - # _translate("CONSTANT_STRING", cs.NB_PINGS_PER_SEC) + ": " + str(stg.nb_pings_per_sec[self.fileListWidget.currentRow()]) + " Hz") - # self.label_pings_per_profile.setText( - # _translate("CONSTANT_STRING", cs.NB_PINGS_PER_PROFILE) + ": " + - # str(stg.nb_pings_averaged_per_profile[self.fileListWidget.currentRow()])) - # self.label_kt.setText( - # _translate("CONSTANT_STRING", cs.KT) + ": " + ', '.join(map(str, stg.kt[self.fileListWidget.currentRow()]))) - # self.label_rx.setText( - # _translate("CONSTANT_STRING", cs.GAIN_RX) + ": " + ', '.join(map(str, stg.gain_rx[self.fileListWidget.currentRow()]))) - # self.label_tx.setText( - # _translate("CONSTANT_STRING", cs.GAIN_TX) + ": " + ', '.join(map(str, stg.gain_tx[self.fileListWidget.currentRow()]))) - - print("self.fileListWidget.currentItem() ", self.fileListWidget.currentItem()) - print("self.fileListWidget.currentRow ", self.fileListWidget.currentRow()) - print("self.fileListWidget.count() ", self.fileListWidget.count()) if self.fileListWidget.currentRow() != -1: @@ -2707,7 +1643,6 @@ class AcousticDataTab(QWidget): self.combobox_frequency_information.addItems(stg.freq_text[self.fileListWidget.currentRow()]) self.combobox_frequency_information.currentIndexChanged.connect(self.combobox_frequency_information_update) - # self.spinbox_temperature.setValue(0) self.lineEdit_temperature.setText(str(stg.temperature)) self.label_profiles_value.setText(str(stg.nb_profiles[self.fileListWidget.currentRow()] @@ -2758,124 +1693,25 @@ class AcousticDataTab(QWidget): ][1]) - print("stg.kt_corrected ", stg.kt_corrected) - self.lineEdit_kt.setText(str("%.4f" % stg.kt_corrected[self.combobox_frequency_information.currentIndex()])) self.lineEdit_kt.setEnabled(True) self.lineEdit_kt.returnPressed.connect(self.kt_value) - # self.spinbox_rx.setValue(stg.gain_rx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()]) - # self.spinbox_rx.setEnabled(False) self.lineEdit_rx.setText(str("%.2f" % stg.gain_rx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()])) self.lineEdit_rx.setEnabled(False) self.checkbox_rx.stateChanged.connect(self.activate_unactivate_spinbox_rx) - # self.spinbox_rx.valueChanged.connect(self.gain_rx_value) self.lineEdit_rx.returnPressed.connect(self.gain_rx_value) - # self.spinbox_tx.setValue(stg.gain_tx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()]) - # self.spinbox_tx.setEnabled(False) - print("--gain tx-- ", self.fileListWidget.currentRow(), self.combobox_frequency_information.currentIndex(), stg.gain_tx) self.lineEdit_tx.setText(str("%.2f" % stg.gain_tx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()])) self.lineEdit_tx.setEnabled(False) self.checkbox_tx.stateChanged.connect(self.activate_unactivate_spinbox_tx) - # self.spinbox_tx.valueChanged.connect(self.gain_tx_value) self.lineEdit_tx.returnPressed.connect(self.gain_tx_value) - # for find, fval in enumerate(stg.freq[self.fileListWidget.currentRow()]): - # print(f"find {find} fval {fval}") - # exec(f"self.spinbox_freq_" + str(int(fval)) + " = QDoubleSpinBox()") - # exec(f"self.spinbox_freq_" + str(int(fval)) + ".setSuffix('Hz')") - # exec(f"self.spinbox_freq_" + str(int(fval)) + ".setValue(" + str(fval) + ")") - # exec(f"self.gridLayout_groupbox_info.addWidget(self.spinbox_freq_" + str(int(fval)) + ", 6, " + str(find+1) + ", 1, 1)") - # self.gridLayout_groupbox_info.addWidget(stg.freq_text[self.fileListWidget.currentIndex().row()]) - - # self.gridLayout_groupbox_info.addWidget(', '.join(map(str, stg.kt[self.fileListWidget.currentRow()]))) - - # self.gridLayout_groupbox_info.addWidget(', '.join(map(str, stg.gain_rx[self.fileListWidget.currentRow()]))) - - # self.gridLayout_groupbox_info.addWidget(', '.join(map(str, stg.gain_tx[self.fileListWidget.currentRow()]))) - - - - # elif self.combobox_ABS_system_choice.currentIndex() == 2: - # - # # self.label_freq.setText( - # # _translate("CONSTANT_STRING", cs.FREQUENCY) + ": " + ', '.join(stg.freq_text[self.fileListWidget.currentRow()])) - # - # self.label_freq = QLabel("Date: " + str(stg.date[self.fileListWidget.currentRow()])) - # self.gridLayout_groupbox_info.addWidget(self.label_freq, 0, 0, 1, 1) - # self.label_freq = QLabel("Hour: " + str(stg.hour[self.fileListWidget.currentRow()])) - # self.gridLayout_groupbox_info.addWidget(self.label_freq, 0, 1, 1, 1) - # - # self.combobox_frequency_information.clear() - # self.combobox_frequency_information.addItems(stg.freq_text[self.fileListWidget.currentRow()]) - # self.combobox_frequency_information.currentIndexChanged.connect(self.combobox_frequency_information_update) - # - # self.label_profiles_value.clear() - # self.label_profiles_value.setText(str(stg.nb_profiles[self.fileListWidget.currentRow()] - # [self.combobox_frequency_information.currentIndex()])) - # self.gridLayout_groupbox_info.addWidget(self.label_profiles_value, 3, 1, 1, 1) - # - # self.label_profiles_per_sec_value.clear() - # self.label_profiles_per_sec_value.setText(str(stg.nb_profiles_per_sec[self.fileListWidget.currentRow()] - # [self.combobox_frequency_information.currentIndex()]) + " Hz") - # self.gridLayout_groupbox_info.addWidget(self.label_profiles_per_sec_value, 4, 1, 1, 1) - # - # self.label_cells_value.clear() - # self.label_cells_value.setText(str(stg.nb_cells[self.fileListWidget.currentRow()] - # [self.combobox_frequency_information.currentIndex()])) - # self.gridLayout_groupbox_info.addWidget(self.label_cells_value, 5, 1, 1, 1) - # - # self.label_cell_size_value.clear() - # self.label_cell_size_value.setText(str(100 * round(stg.cell_size[self.fileListWidget.currentRow()] - # [self.combobox_frequency_information.currentIndex()], - # 3)) + " cm") - # self.gridLayout_groupbox_info.addWidget(self.label_cell_size_value, 6, 1, 1, 1) - # - # self.label_pulse_length_value.clear() - # self.label_pulse_length_value.setText(str(round(stg.pulse_length[self.fileListWidget.currentRow()] - # [self.combobox_frequency_information.currentIndex()], - # 6)) + " sec") - # self.gridLayout_groupbox_info.addWidget(self.label_pulse_length_value, 7, 1, 1, 1) - # - # self.label_pings_per_sec_value.clear() - # self.label_pings_per_sec_value.setText(str(stg.nb_pings_per_sec[self.fileListWidget.currentRow()] - # [self.combobox_frequency_information.currentIndex()]) + " Hz") - # self.gridLayout_groupbox_info.addWidget(self.label_pings_per_sec_value, 8, 1, 1, 1) - # - # self.label_pings_per_profile_value.clear() - # self.label_pings_per_profile_value.setText( - # str(stg.nb_pings_averaged_per_profile[self.fileListWidget.currentRow()] - # [self.combobox_frequency_information.currentIndex()])) - # self.gridLayout_groupbox_info.addWidget(self.label_pings_per_profile_value, 9, 1, 1, 1) - # - # self.spinbox_kt.setValue( - # stg.kt[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()]) - # self.spinbox_kt.setSuffix(f" V.m^{1.5}") - # self.spinbox_kt.setEnabled(False) - # self.checkbox_kt.stateChanged.connect(self.activate_unactivate_spinbox_kt) - # self.spinbox_kt.valueChanged.connect(self.kt_value) - # - # self.spinbox_rx.setValue( - # stg.gain_rx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()]) - # self.spinbox_rx.setEnabled(False) - # self.checkbox_rx.stateChanged.connect(self.activate_unactivate_spinbox_rx) - # self.spinbox_rx.valueChanged.connect(self.gain_rx_value) - # - # self.spinbox_tx.setValue( - # stg.gain_tx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()]) - # self.spinbox_tx.setEnabled(False) - # self.checkbox_tx.stateChanged.connect(self.activate_unactivate_spinbox_tx) - # self.spinbox_kt.valueChanged.connect(self.gain_tx_value) - def combobox_frequency_information_update(self): if self.fileListWidget.count() > 0: - # print("stg.water_attenuation ", stg.water_attenuation) if stg.water_attenuation[self.fileListWidget.currentRow()]: - # self.spinbox_sound_attenuation.clear() - # self.spinbox_sound_attenuation.setValue(stg.water_attenuation[self.fileListWidget.currentRow()] - # [self.combobox_frequency_information.currentIndex()]) + self.lineEdit_sound_attenuation.setText( str("%.6f" % stg.water_attenuation[self.fileListWidget.currentRow()][ self.combobox_frequency_information.currentIndex()])) @@ -2921,68 +1757,42 @@ class AcousticDataTab(QWidget): [self.combobox_frequency_information.currentIndex()])) self.gridLayout_groupbox_info.addWidget(self.label_pings_per_profile_value, 14, 1, 1, 1, Qt.AlignLeft) - print("stg.kt_corrected ", stg.kt_corrected) - print("self.combobox_frequency_information.currentText()", - self.combobox_frequency_information.count()) - print("self.combobox_frequency_information.currentText()", self.combobox_frequency_information.currentText()) - # self.spinbox_kt.clear() if self.checkbox_kt.isChecked(): if self.combobox_frequency_information.count() > 0: - # self.spinbox_kt.setValue(stg.kt_corrected[self.combobox_frequency_information.currentText()]) self.lineEdit_kt.setText(str("%.4f" % stg.kt_corrected[self.combobox_frequency_information.currentIndex()])) else: - # print("combobox information update : checkbox unchecked") - # self.spinbox_kt.setValue(stg.kt_read[self.combobox_frequency_information.currentIndex()]) self.lineEdit_kt.setText(str("%.4f" % stg.kt_read[self.combobox_frequency_information.currentIndex()])) - # self.spinbox_kt.setSuffix(f" V.m^{1.5}") - # self.spinbox_rx.clear() - # self.spinbox_rx.setValue(stg.gain_rx[self.fileListWidget.currentRow()] - # [self.combobox_frequency_information.currentIndex()]) self.lineEdit_rx.setText(str(stg.gain_rx[self.fileListWidget.currentRow()][ self.combobox_frequency_information.currentIndex()])) - # self.spinbox_tx.clear() - # self.spinbox_tx.setValue(stg.gain_tx[self.fileListWidget.currentRow()] - # [self.combobox_frequency_information.currentIndex()]) self.lineEdit_tx.setText(str(stg.gain_tx[self.fileListWidget.currentRow()][ self.combobox_frequency_information.currentIndex()])) def activate_unactivate_spinbox_kt(self): if self.checkbox_kt.isChecked(): - # self.spinbox_kt.setEnabled(True) self.lineEdit_kt.setEnabled(True) if stg.kt_corrected: - # self.spinbox_kt.setValue(stg.kt_corrected[self.combobox_frequency_information.currentText()]) self.lineEdit_kt.setText(str("%.4f" % stg.kt_corrected[self.combobox_frequency_information.currentIndex()])) else: - # self.spinbox_kt.setDisabled(True) self.lineEdit_kt.setDisabled(True) if stg.kt_read: - print(self.combobox_frequency_information.currentIndex()) - print(stg.kt_read) - # self.spinbox_kt.setValue(stg.kt_read[self.combobox_frequency_information.currentIndex()]) self.lineEdit_kt.setText(str("%.4f" % stg.kt_read[self.combobox_frequency_information.currentIndex()])) def activate_unactivate_spinbox_rx(self): if self.checkbox_rx.isChecked(): - # self.spinbox_rx.setEnabled(True) self.lineEdit_rx.setEnabled(True) else: - # self.spinbox_rx.setDisabled(True) self.lineEdit_rx.setDisabled(True) def activate_unactivate_spinbox_tx(self): if self.checkbox_tx.isChecked(): - # self.spinbox_tx.setEnabled(True) self.lineEdit_tx.setEnabled(True) else: - # self.spinbox_tx.setDisabled(True) self.lineEdit_tx.setDisabled(True) def kt_value(self): - # print(f"0 stg.kt_read : {stg.kt_read}") - # print(f"0 stg.kt_corrected {stg.kt_corrected}") + if self.fileListWidget.count() > 0: if self.checkbox_kt.isChecked(): @@ -2995,59 +1805,21 @@ class AcousticDataTab(QWidget): float(self.lineEdit_kt.text())) self.lineEdit_kt.setText("%.4f" % float(self.lineEdit_kt.text())) - # else: - # stg.kt_corrected[self.combobox_frequency_information.currentText()] = ( - # float(self.lineEdit_kt.text())) - # self.lineEdit_kt.setText(str("%.4f" % stg.kt_corrected[ - # self.combobox_frequency_information.currentText()])) - - # print(f"1 stg.kt_read : {stg.kt_read}") - print(f"1 stg.kt_corrected {stg.kt_corrected}") - def gain_rx_value(self): if self.fileListWidget.count() > 0: - # stg.gain_rx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()] = ( - # self.spinbox_rx.value()) stg.gain_rx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()] = ( float(self.lineEdit_rx.text())) - # print(f"stg.rx : {stg.gain_rx}") + def gain_tx_value(self): if self.fileListWidget.count() > 0: - # stg.gain_tx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()] = ( - # self.spinbox_tx.value()) stg.gain_tx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()] = ( float(self.lineEdit_tx.text())) - # print(f"stg.tx : {stg.gain_tx}") def fill_table(self): if self.fileListWidget.currentRow() != -1: - # header_list = [] - # for freq_ind, freq_value in enumerate(stg.freq_text[0]): - # header_list.append("Time - " + freq_value) - # header_list.append("Depth - " + freq_value) - # header_list.append("BS - " + freq_value) - # - # if freq_ind == 0: - # table_data = np.vstack((np.vstack((stg.time_reshape[0][:, freq_ind], - # stg.depth_reshape[0][:, freq_ind])), - # stg.BS_raw_data_reshape[0][:, freq_ind])) - # else: - # table_data = np.vstack((table_data, - # np.vstack((np.vstack((stg.time_reshape[0][:, freq_ind], - # stg.depth_reshape[0][:, freq_ind])), - # stg.BS_raw_data_reshape[0][:, freq_ind])) - # )) - # - # print("1 header_list ", header_list) - # print("1 table_data.shape ", table_data.shape) - # - # stg.DataFrame_acoustic = pd.DataFrame(data=table_data.transpose(), columns=header_list) - # - # else: - header_list = [] header_list.clear() table_data = np.array([[]]) @@ -3071,65 +1843,8 @@ class AcousticDataTab(QWidget): stg.DataFrame_acoustic = pd.DataFrame(None) stg.DataFrame_acoustic = pd.DataFrame(data=table_data.transpose(), columns=header_list) - print("2 header_list ", header_list) - print("2 table_data.shape", table_data.shape) - # stg.DataFrame_acoustic = ( - # pd.DataFrame(np.concatenate((stg.time_reshape[self.fileListWidget.currentRow()], - # stg.BS_raw_data_reshape[self.fileListWidget.currentRow()]), axis=1), - # columns=list(map(str, ["Time - " + f for f in stg.freq_text[self.fileListWidget.currentRow()]] + - # ["BS - " + f for f in stg.freq_text[self.fileListWidget.currentRow()]]))) - # ) - - print("hola") self.tableModel = TableModel(stg.DataFrame_acoustic) self.tableView.setModel(self.tableModel) - # self.tableView.setItemDelegate(FloatDelegate(3)) - - # if self.combobox_ABS_system_choice.currentIndex() == 2: - # if ((self.lineEdit_acoustic_file.text()) and (self.lineEdit_noise_file.text())): - # stg.DataFrame_acoustic = pd.DataFrame( - # np.concatenate((stg.time_reshape, stg.BS_raw_data_reshape, stg.snr_reshape), axis=1), - # columns=list(map(str, ["Time"] + ["BS - " + f for f in stg.freq_text] + - # ["SNR - " + f for f in stg.freq_text]))) - # self.tableModel = TableModel(stg.DataFrame_acoustic) - # self.tableView.setModel(self.tableModel) - # elif self.lineEdit_acoustic_file.text(): - # stg.DataFrame_acoustic = pd.DataFrame( - # np.concatenate((stg.time_reshape, stg.BS_raw_data_reshape), axis=1), - # columns=list(map(str, ["Time"] + ["BS - " + f for f in stg.freq_text]))) - # self.tableModel = TableModel(stg.DataFrame_acoustic) - # self.tableView.setModel(self.tableModel) - # else: - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Fill table Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Download files before fill table") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() - - # elif self.combobox_ABS_system_choice.currentIndex() == 1: - # if ((self.lineEdit_acoustic_file.text()) and (self.lineEdit_noise_file.text())): - # stg.DataFrame_acoustic = pd.DataFrame( - # np.concatenate((stg.time_reshape, stg.BS_raw_data_reshape, stg.time_snr_reshape, stg.SNR_reshape), axis=1), - # columns=list(map(str, ["Time BS - " + f for f in stg.freq_text] + - # ["BS - " + f for f in stg.freq_text] + - # ["Time SNR - " + f for f in stg.freq_text] + - # ["SNR - " + f for f in stg.freq_text]))) - # self.tableModel = TableModel(stg.DataFrame_acoustic) - # self.tableView.setModel(self.tableModel) - # if self.lineEdit_acoustic_file.text(): - # stg.DataFrame_acoustic = pd.DataFrame( - # np.concatenate((stg.time_reshape, stg.BS_raw_data_reshape), axis=1), - # columns=list(map(str, ["Time BS - " + f for f in stg.freq_text] + ["BS - " + f for f in stg.freq_text]))) - # self.tableModel = TableModel(stg.DataFrame_acoustic) - # self.tableView.setModel(self.tableModel) - # else: - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Fill table Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Download files before fill table") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() def export_table(self): if self.tableWidget.columnCount() == 10: @@ -3144,20 +1859,15 @@ class AcousticDataTab(QWidget): def transect_xaxis_choice(self): if self.groupbox_xaxis_time.isChecked() == True: - # self.groupbox_xaxis_time.setDisabled(True) self.groupbox_xaxis_space.setChecked(False) - # self.groupbox_xaxis_space.setDisabled(False) elif self.groupbox_xaxis_space.isChecked() == True: self.groupbox_xaxis_time.setChecked(False) - # self.groupbox_xaxis_time.setDisabled(False) - # self.groupbox_xaxis_space.setDisabled(True) def compute_tmin_tmax(self): ''' tmin and tmax are filled with min and max of time when data are uploaded and double slider of time are updated with these values ''' if self.fileListWidget.currentRow() != -1: - print("self.fileListWidget.currentRow() ", self.fileListWidget.currentRow()) # --- tmim / tmax --- tmin_indice = np.where(np.abs(stg.time[self.fileListWidget.currentRow()][0, :] - np.nanmin( @@ -3167,8 +1877,6 @@ class AcousticDataTab(QWidget): tmin_value = np.round(np.nanmin(stg.time[self.fileListWidget.currentRow()][0, :]), 2) stg.tmin[self.fileListWidget.currentRow()] = (tmin_indice, tmin_value) - print(f" tmin_indice = {tmin_indice} , tmin_value = {tmin_value}") - tmax_indice = np.where(np.abs(stg.time[self.fileListWidget.currentRow()][0, :] - np.nanmax( stg.time[self.fileListWidget.currentRow()][0, :])) == np.nanmin(np.abs(stg.time[self.fileListWidget.currentRow()][0, :] - np.nanmax( @@ -3207,7 +1915,6 @@ class AcousticDataTab(QWidget): 2) - float(self.lineEdit_time_min_limits.text().replace(",", ".")))))[0][0], float(self.lineEdit_time_min_limits.text().replace(",", ".")) )) - print("tmin = ", stg.tmin) stg.tmax[self.fileListWidget.currentRow()] = (( np.where(np.abs(np.round(stg.time[self.fileListWidget.currentRow()][0, :], 2) - @@ -3216,15 +1923,12 @@ class AcousticDataTab(QWidget): 2) - float(self.lineEdit_time_max_limits.text().replace(",", ".")))))[0][0]+1, float(self.lineEdit_time_max_limits.text().replace(",", ".")) )) - print("tmax = ", stg.tmax) stg.time_cross_section[self.fileListWidget.currentRow()] = ( stg.time[self.fileListWidget.currentRow()][:, stg.tmin[self.fileListWidget.currentRow()][0]: stg.tmax[self.fileListWidget.currentRow()][0]] ) - print("stg.time_cross_section ", stg.time_cross_section) - def compute_rmin_rmax(self): ''' rmin and rmax are filled with min and max of depth when data are uploaded and double slider of depth are updated with these values ''' @@ -3239,8 +1943,6 @@ class AcousticDataTab(QWidget): rmin_value = np.round(np.nanmin(stg.depth[self.fileListWidget.currentRow()][0, :]), 2) stg.rmin[self.fileListWidget.currentRow()] = (rmin_indice, rmin_value) - print(f" rmin_indice = {rmin_indice} , rmin_value = {rmin_value}") - rmax_indice = np.where(np.abs(stg.depth[self.fileListWidget.currentRow()][0, :] - np.nanmax( stg.depth[self.fileListWidget.currentRow()][0, :])) == np.nanmin(np.abs(stg.depth[self.fileListWidget.currentRow()][0, :] - np.nanmax( @@ -3248,8 +1950,6 @@ class AcousticDataTab(QWidget): rmax_value = np.round(np.nanmax(stg.depth[self.fileListWidget.currentRow()][0, :]), 2) stg.rmax[self.fileListWidget.currentRow()] = (rmax_indice + 1, rmax_value) - print(f" rmax_indice = {rmax_indice} , rmax_value = {rmax_value}") - self.set_range_for_depth_boundaries_option() def set_range_for_depth_boundaries_option(self): @@ -3261,7 +1961,6 @@ class AcousticDataTab(QWidget): self.label_depth_max.setText("-" + str("%.5s" % stg.depth[self.fileListWidget.currentRow()][0, 0])) if stg.depth_cross_section[self.fileListWidget.currentRow()].shape != (0,): - print("stg.depth_cross_section[self.fileListWidget.currentRow()] ", stg.depth_cross_section[self.fileListWidget.currentRow()]) self.lineEdit_depth_min_limits.setText("-" + str("%.5s" % stg.depth_cross_section[self.fileListWidget.currentRow()][0, -1])) self.lineEdit_depth_max_limits.setText("-" + str("%.5s" % stg.depth_cross_section[self.fileListWidget.currentRow()][0, 0])) @@ -3270,19 +1969,6 @@ class AcousticDataTab(QWidget): self.lineEdit_depth_min_limits.setText("-" + str("%.5s" % stg.depth[self.fileListWidget.currentRow()][0, -1])) self.lineEdit_depth_max_limits.setText("-" + str("%.5s" % stg.depth[self.fileListWidget.currentRow()][0, 0])) - # self.doubleRangeSlider_depth.setRange(min=-stg.depth[self.fileListWidget.currentRow()][0, -1], - # max=-stg.depth[self.fileListWidget.currentRow()][0, 0]) - # - # if stg.depth_cross_section[self.fileListWidget.currentRow()].shape == (0,): - # self.doubleRangeSlider_depth.setValue(value=(-stg.depth[self.fileListWidget.currentRow()][0, -1], - # -stg.depth[self.fileListWidget.currentRow()][0, 0])) - # else: - # self.doubleRangeSlider_depth.setValue( - # value=(-stg.depth_cross_section[self.fileListWidget.currentRow()][0, -1], - # -stg.depth_cross_section[self.fileListWidget.currentRow()][0, 0])) - - # print("self.doubleRangeSlider_depth.value() ", self.doubleRangeSlider_depth.value()) - def compute_depth_cross_section(self): ''' rmin and rmax are updated with double slider of depth ''' @@ -3322,9 +2008,6 @@ class AcousticDataTab(QWidget): [:, stg.rmin[self.fileListWidget.currentRow()][0]:stg.rmax[self.fileListWidget.currentRow()][0], stg.tmin[self.fileListWidget.currentRow()][0]:stg.tmax[self.fileListWidget.currentRow()][0]]) - print(f"BS_cross_section shape : {stg.BS_cross_section[self.fileListWidget.currentRow()].shape}") - # print(f"BS_cross_section : {stg.BS_cross_section}") - def update_frequency_combobox(self): if self.fileListWidget.currentRow() != -1: self.combobox_frequency_bathymetry.clear() @@ -3368,50 +2051,13 @@ class AcousticDataTab(QWidget): else: - # self.spinbox_depth_min_bathy.setValue(stg.depth[self.fileListWidget.currentRow()][0, 0]) self.lineEdit_depth_min_bathy.setText( "-" + str("%.5s" % stg.depth[self.fileListWidget.currentRow()][0, -1])) - # self.spinbox_depth_max_bathy.setValue(stg.depth[self.fileListWidget.currentRow()][0, -1]) self.lineEdit_depth_max_bathy.setText( "-" + str("%.5s" % stg.depth[self.fileListWidget.currentRow()][0, 0])) def plot_backscattered_acoustic_signal_recording(self): - # --- Condition if table is not filled --- - # if not self.lineEdit_acoustic_file.text(): - # if not stg.filename_BS_raw_data: - # print(stg.filename_BS_raw_data.text()) - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Plot transect Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Load data before plot transect 2D field") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() - # elif self.tableModel.rowCount(1) == 10: - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Plot transect Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Fill table before plot transect 2D field") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() - # --- Condition if table is filled and figure is not plotted --- - # --- => Then plot transect for each frequency by pressing the button "Plot transect" - - # elif (self.tableModel.rowCount(1) > 10) and (self.canvas_BS == None): - # elif self.canvas_BS == None: - - # else: - - # self.fig_BS, self.axis_BS = plt.subplots(nrows=stg.freq.shape[0], ncols=1, sharex=True, sharey=False, - # layout="constrained") - # - # self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.scroll_BS) - # self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.scroll_BS) - - # plt.close(self.fig_BS) - print("On est là ") - print("fileList widget ", self.fileListWidget.count()) - # if self.fileListWidget.currentRow() != -1: if self.fileListWidget.count() > 0: self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.toolbar_BS) @@ -3421,14 +2067,8 @@ class AcousticDataTab(QWidget): sharex=False, sharey=False, layout="constrained") self.canvas_BS = FigureCanvas(self.fig_BS) self.toolbar_BS = NavigationToolBar(self.canvas_BS, self) - # self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.canvas_BS) - # self.scroll_BS = QScrollArea() self.scroll_BS.setWidget(self.canvas_BS) - # self.scroll_BS.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - # self.scroll_BS.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) - # # self.scroll_BS.setWidgetResizable(True) - # self.scroll_BS.setAlignment(Qt.AlignCenter) self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.toolbar_BS) self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.scroll_BS) @@ -3440,23 +2080,17 @@ class AcousticDataTab(QWidget): if val_min == 0: val_min = 1e-5 - # print(f"freq = {f}") - if self.combobox_ABS_system_choice.currentIndex() == 1: - print("stg.time[self.fileListWidget.currentRow()][f, :]", stg.time[self.fileListWidget.currentRow()][f, :].shape) - print("stg.depth[self.fileListWidget.currentRow()][f, :]", stg.depth[self.fileListWidget.currentRow()][f, :].shape) - print("stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, :]", stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, :].shape) + pcm = self.axis_BS[f].pcolormesh(stg.time[self.fileListWidget.currentRow()][f, :], -stg.depth[self.fileListWidget.currentRow()][f, :], stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, :], - # stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, int(stg.tmin[self.fileListWidget.currentRow()]):int(stg.tmax[self.fileListWidget.currentRow()])], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) elif self.combobox_ABS_system_choice.currentIndex() == 2: pcm = self.axis_BS[f].pcolormesh(stg.time[self.fileListWidget.currentRow()][f, :], -stg.depth[self.fileListWidget.currentRow()][f, :], np.log(stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, :]), - # np.log(stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, int(stg.tmin[self.fileListWidget.currentRow()]):int(stg.tmax[self.fileListWidget.currentRow()])]), cmap='Blues') self.axis_BS[f].text(1, .70, stg.freq_text[self.fileListWidget.currentRow()][f], @@ -3465,7 +2099,6 @@ class AcousticDataTab(QWidget): transform=self.axis_BS[f].transAxes) # --- Plot red solid line on transect to visualize position of plotted profile --- - # print("on the 2D field ", self.combobox_freq_choice.currentIndex()) self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( stg.time[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), self.slider.value() - 1] * np.ones(stg.depth[self.fileListWidget.currentRow()].shape[1]), @@ -3477,17 +2110,12 @@ class AcousticDataTab(QWidget): cbar = self.fig_BS.colorbar(pcm, ax=self.axis_BS[:], shrink=1, location='right') cbar.set_label(label='Acoustic backscatter signal (V)', rotation=270, labelpad=10) self.fig_BS.canvas.draw_idle() - # plt.show() - # plt.close(self.fig_BS) - - # self.plot_profile() def update_plot_backscattered_acoustic_signal_recording(self): # --- Condition if table is filled but transect is not plotted # --- => Error message if spin box values of tmin or tmax is change if self.canvas_BS == None: - # if stg.BS_raw_data.size == 0: msgBox = QMessageBox() msgBox.setWindowTitle("Plot transect Error") msgBox.setIcon(QMessageBox.Warning) @@ -3497,7 +2125,6 @@ class AcousticDataTab(QWidget): else: - # print("stg.BS_cross_section[self.fileListWidget.currentRow()].shape ", stg.BS_cross_section[self.fileListWidget.currentRow()].shape) if self.fileListWidget.currentRow() != -1: if len(self.axis_BS.tolist()) != stg.freq[self.fileListWidget.currentRow()].shape[0]: self.fig_BS, self.axis_BS = plt.subplots(nrows=stg.freq[self.fileListWidget.currentRow()].shape[0], @@ -3545,10 +2172,8 @@ class AcousticDataTab(QWidget): color='red', linestyle="solid", linewidth=2) # --- Plot river bottom line --- - # if (len(stg.depth_bottom) != 0) and (len(stg.depth_bottom) == self.fileListWidget.count()): if stg.depth_bottom[self.fileListWidget.currentRow()].shape != (0,): - # print("stg.depth_bottom ", stg.depth_bottom) - # print("len(stg.depth_bottom) ", len(stg.depth_bottom)) + self.axis_BS[f].plot(stg.time_cross_section[self.fileListWidget.currentRow()][ self.combobox_frequency_bathymetry.currentIndex(), :], -stg.depth_bottom[self.fileListWidget.currentRow()], @@ -3607,236 +2232,6 @@ class AcousticDataTab(QWidget): self.fig_BS.supxlabel('Time (sec)', fontsize=10) self.fig_BS.supylabel('Depth (m)', fontsize=10) self.fig_BS.canvas.draw_idle() - # self.fig_BS.canvas.flush_events() - # plt.close(self.fig_BS) - - - # # self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.scroll_BS) - # # self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.scroll_BS) - # - # # --- Backscatter acoustic signal is recorded for next tab --- - # - # # stg.BS_cross_section = np.array([[[]]]) - # # stg.t = np.array([[]]) - # - # # stg.tmin[self.fileListWidget.currentRow()] = ( - # # np.where(np.abs(np.round(stg.time[self.fileListWidget.currentRow()][0, :], - # # 2) - self.spinbox_tmin.value()) == - # # np.nanmin(np.abs(np.round(stg.time[self.fileListWidget.currentRow()][0, :], - # # 2) - self.spinbox_tmin.value())))[0][ - # # 0] - # # ) - # # - # # stg.tmax[self.fileListWidget.currentRow()] = ( - # # np.where(np.abs(np.round(stg.time[self.fileListWidget.currentRow()][0, :], - # # 2) - self.spinbox_tmax.value()) == - # # np.nanmin(np.abs(np.round(stg.time[self.fileListWidget.currentRow()][0, :], - # # 2) - self.spinbox_tmax.value())))[0][ - # # 0] - # # ) - # # - # # print(f"Update tmin {stg.tmin}") - # # print(f"Update tmax {stg.tmax}") - # # - # # if (self.fileListWidget.count() == 1) and (len(stg.BS_cross_section) == 0): - # # stg.BS_cross_section = [stg.BS_raw_data[self.fileListWidget.currentRow()][:, :, - # # int(stg.tmin[self.fileListWidget.currentRow()]):int(stg.tmax[self.fileListWidget.currentRow()])]] - # # elif (self.fileListWidget.count() > 1) and (len(stg.BS_cross_section) < self.fileListWidget.count()): - # # stg.BS_cross_section = ( - # # np.append(stg.BS_cross_section, - # # stg.BS_raw_data[self.fileListWidget.currentRow()][:, :, - # # int(stg.tmin[self.fileListWidget.currentRow()]):int( - # # stg.tmax[self.fileListWidget.currentRow()])]) - # # ) - # # else: - # # stg.BS_cross_section[self.fileListWidget.currentRow()] = ( - # # stg.BS_raw_data[self.fileListWidget.currentRow()] - # # [:, :, int(stg.tmin[self.fileListWidget.currentRow()]):int(stg.tmax[self.fileListWidget.currentRow()])]) - # # - # # - # # if (self.fileListWidget.count() == 1) and (len(stg.t) == 0): - # # stg.t = [stg.time[self.fileListWidget.currentRow()][:, - # # int(stg.tmin[self.fileListWidget.currentRow()]):int( - # # stg.tmax[self.fileListWidget.currentRow()])]] - # # elif self.fileListWidget.count() > 1: - # # stg.t = np.append(stg.t, - # # stg.time[self.fileListWidget.currentRow()][:, - # # int(stg.tmin[self.fileListWidget.currentRow()]):int(stg.tmax[self.fileListWidget.currentRow()])]) - # # else: - # # stg.t[self.fileListWidget.currentRow()] = stg.time[self.fileListWidget.currentRow()][:, - # # int(stg.tmin[self.fileListWidget.currentRow()]):int( - # # stg.tmax[self.fileListWidget.currentRow()])] - # # # stg.t = np.append(stg.t, np.array([stg.time[f, int(stg.tmin[f]):int(stg.tmax[f])]]), axis=0) - # # - # # # print("stg.t[self.fileListWidget.currentRow()].shape() ", stg.t[self.fileListWidget.currentRow()].shape()) - # # print("0/ stg.freq before plot : ", stg.freq) - # # print("2/ stg.freq after plot : ", stg.freq[self.fileListWidget.currentRow()]) - # for f, _ in enumerate(stg.freq[self.fileListWidget.currentRow()]): - # - # # print(f"f = {f}") - # - # # stg.tmin[f] = np.where(np.abs(np.round(stg.time[self.fileListWidget.currentRow()][f, :], 2) - self.spinbox_tmin.value()) == - # # np.nanmin(np.abs(np.round(stg.time[f, :], 2) - self.spinbox_tmin.value())))[0][0] - # # - # # stg.tmax[f] = np.where(np.abs(np.round(stg.time[f, :], 2) - self.spinbox_tmax.value()) == - # # np.nanmin(np.abs(np.round(stg.time[f, :], 2) - self.spinbox_tmax.value())))[0][0] - # - # # print("stg.tmin[f] ", stg.tmin[f]) - # # print("stg.tmax[f] ", stg.tmax[f]) - # # print("shape of BS_raw_data ", np.array([stg.BS_raw_data[f, :, int(stg.tmin[f]):int(stg.tmax[f])]]).shape) - # # print("BS_data shape ", stg.BS_cross_section.shape) - # - # # print(self.fileListWidget.count()) - # # print(stg.BS_cross_section[self.fileListWidget.currentRow()].shape) - # # if stg.BS_cross_section[self.fileListWidget.currentRow()].shape[2] == 0: - # # if self.fileListWidget.count() == 1: - # # stg.BS_cross_section = np.array( - # # [stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, int(stg.tmin[self.fileListWidget.currentRow()]):int(stg.tmax[self.fileListWidget.currentRow()])]]) - # # else: - # # stg.BS_cross_section[self.fileListWidget.currentRow()] = ( - # # np.append(stg.BS_cross_section[self.fileListWidget.currentRow()], - # # np.array([stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, int(stg.tmin[self.fileListWidget.currentRow()]):int(stg.tmax[self.fileListWidget.currentRow()])]]), axis=0)) - # - # - # # stg.BS_cross_section = np.stack(np.array([stg.BS_raw_data[f, :, int(stg.tmin[f]):int(stg.tmax[f])]]), axis=0) - # # stg.BS_cross_section = np.append(stg.BS_cross_section, np.array([stg.BS_raw_data[f, :, int(stg.tmin[f]):int(stg.tmax[f])]]), axis=2) - # # print("stg.BS_cross_section.shape ", stg.BS_cross_section.shape) - # # print("stg.BS_cross_section.size ", stg.BS_cross_section.size) - # # print("stg.time shape ", stg.time.shape) - # # print("stg.t shape ", stg.t.shape) - # # if stg.t[self.fileListWidget.currentRow()].shape[1] == 0: - # # if self.fileListWidget.count() == 1: - # # stg.t = np.array([stg.time[self.fileListWidget.currentRow()][f, int(stg.tmin[self.fileListWidget.currentRow()]):int(stg.tmax[self.fileListWidget.currentRow()])]]) - # # else: - # # stg.t[self.fileListWidget.currentRow()] = np.append(stg.t[self.fileListWidget.currentRow()], - # # np.array([stg.time[self.fileListWidget.currentRow()][f, int(stg.tmin[self.fileListWidget.currentRow()]):int(stg.tmax[self.fileListWidget.currentRow()])]]), axis=0) - # # stg.t = np.append(stg.t, np.array([stg.time[f, int(stg.tmin[f]):int(stg.tmax[f])]]), axis=0) - # # print("stg.t shape ", stg.t[self.fileListWidget.currentRow()].shape) - # # print(f"stg.t : {stg.t}") - # # stg.depth_2D = stg.depth_2D[:, np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: - # # np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]] - # # print("stg.depth shape ", stg.depth_2D.shape) - # - # # print("self.combobox_frequency_profile.currentIndex() ", self.combobox_frequency_profile.currentIndex()) - # # - # # print("slider value = ", [ - # # self.slider.value() - 1 if self.slider.value() - 1 <= stg.t.shape[1] - 1 else np.max( - # # stg.t[self.fileListWidget.currentRow()].shape[1] - 1)][0]) - # # - # # print(stg.t[0, - # # [self.slider.value() - 1 if self.slider.value() - 1 <= stg.t.shape[1] - 1 else np.max( - # # stg.t.shape[1] - 1)][0]]) - # - # # print("self.axis_BS ", self.axis_BS) - # # print(f"self.axis_BS[{f}] ", self.axis_BS[f]) - # self.axis_BS[f].cla() - # - # if stg.BS_cross_section[self.fileListWidget.currentRow()].shape == (0,): - # - # # print("stg.BS_cross_section[self.fileListWidget.currentRow()].shape ", - # # stg.BS_cross_section[self.fileListWidget.currentRow()].shape) - # - # val_min = np.nanmin(stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, :]) - # val_max = np.nanmax(stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, :]) - # if val_min == 0: - # val_min = 1e-5 - # - # # print("stg.t[f, :].shape ", stg.t[f]) - # # print("stg.depth[f, :].shape ", stg.depth[f, :]) - # - # if self.combobox_ABS_system_choice.currentIndex() == 1: - # pcm = self.axis_BS[f].pcolormesh(stg.time[self.fileListWidget.currentRow()][f, :], - # -stg.depth[self.fileListWidget.currentRow()][f, - # :], - # stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, - # :], - # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - # - # elif self.combobox_ABS_system_choice.currentIndex() == 2: - # pcm = self.axis_BS[f].pcolormesh(stg.time[self.fileListWidget.currentRow()][f, :], - # -stg.depth[self.fileListWidget.currentRow()][f, - # :], - # np.log( - # stg.BS_raw_data[self.fileListWidget.currentRow()][f, - # :, :]), - # cmap='Blues') - # - # # --- Plot red solid line on transect to visualize position of plotted profile --- - # slider_value = \ - # [self.slider.value() - 1 if self.slider.value() - 1 <= - # stg.time[self.fileListWidget.currentRow()].shape[ - # 1] - 1 - # else np.max(stg.time[self.fileListWidget.currentRow()].shape[1] - 1)][0] - # - # self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( - # stg.time[self.fileListWidget.currentRow()][ - # 0, # self.combobox_frequency_profile.currentIndex(), - # slider_value] * np.ones( - # stg.depth[self.fileListWidget.currentRow()].shape[1]), - # -stg.depth[self.fileListWidget.currentRow()][ - # self.combobox_frequency_profile.currentIndex(), :], - # color='red', linestyle="solid", linewidth=2) - # - # else: - # - # # print("stg.BS_cross_section[self.fileListWidget.currentRow()].shape ", - # # stg.BS_cross_section[self.fileListWidget.currentRow()].shape) - # - # val_min = np.nanmin(stg.BS_cross_section[self.fileListWidget.currentRow()][f, :, :]) - # val_max = np.nanmax(stg.BS_cross_section[self.fileListWidget.currentRow()][f, :, :]) - # if val_min == 0: - # val_min = 1e-5 - # - # # print("stg.t[f, :].shape ", stg.t[f]) - # # print("stg.depth[f, :].shape ", stg.depth[f, :]) - # - # if self.combobox_ABS_system_choice.currentIndex() == 1: - # pcm = self.axis_BS[f].pcolormesh(stg.time_cross_section[self.fileListWidget.currentRow()][f, :], - # -stg.depth_cross_section[self.fileListWidget.currentRow()][f, :], - # stg.BS_cross_section[self.fileListWidget.currentRow()][f, :, :], - # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - # elif self.combobox_ABS_system_choice.currentIndex() == 2: - # pcm = self.axis_BS[f].pcolormesh(stg.time_cross_section[self.fileListWidget.currentRow()][f, :], - # -stg.depth_cross_section[self.fileListWidget.currentRow()][f, :], - # np.log(stg.BS_cross_section[self.fileListWidget.currentRow()][f, :, :]), - # cmap='Blues') - # - # # --- Plot red solid line on transect to visualize position of plotted profile --- - # slider_value = \ - # [self.slider.value() - 1 if self.slider.value() - 1 <= - # stg.time_cross_section[self.fileListWidget.currentRow()].shape[1] - 1 - # else np.max(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1] - 1)][0] - # - # self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot( - # stg.time_cross_section[self.fileListWidget.currentRow()][ - # 0, # self.combobox_frequency_profile.currentIndex(), - # slider_value] * np.ones( - # stg.depth_cross_section[self.fileListWidget.currentRow()].shape[1]), - # -stg.depth_cross_section[self.fileListWidget.currentRow()][ - # self.combobox_frequency_profile.currentIndex(), :], - # color='red', linestyle="solid", linewidth=2) - # - # # --- Plot river bottom line --- - # - # # if (len(stg.depth_bottom) != 0) and (len(stg.depth_bottom) == self.fileListWidget.count()): - # if len(stg.depth_bottom[self.fileListWidget.currentRow()]) != 0: - # - # # print("stg.depth_bottom ", stg.depth_bottom) - # # print("len(stg.depth_bottom) ", len(stg.depth_bottom)) - # self.axis_BS[f].plot(stg.time_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_bathymetry.currentIndex(), :], - # -stg.depth_bottom[self.fileListWidget.currentRow()], - # color='black', linewidth=1, linestyle="solid") - # - # self.axis_BS[f].text(1, .70, stg.freq_text[self.fileListWidget.currentRow()][f], - # fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, - # horizontalalignment='right', verticalalignment='bottom', - # transform=self.axis_BS[f].transAxes) - # - # self.fig_BS.supxlabel('Time (sec)', fontsize=10) - # self.fig_BS.supylabel('Depth (m)', fontsize=10) - # self.fig_BS.canvas.draw_idle() - # # self.fig_BS.canvas.flush_events() - # # plt.close(self.fig_BS) def plot_profile(self): if self.fileListWidget.currentRow() != -1: @@ -3847,7 +2242,6 @@ class AcousticDataTab(QWidget): self.combobox_frequency_profile.currentIndexChanged.connect( self.update_plot_backscattered_acoustic_signal_recording) - # self.slider.setMaximum(stg.BS_raw_data[self.fileListWidget.currentRow()].shape[2]) self.slider.setMaximum(stg.time[self.fileListWidget.currentRow()].shape[1]) self.verticalLayout_groupbox_plot_profile.removeWidget(self.toolbar_profile) @@ -3861,14 +2255,12 @@ class AcousticDataTab(QWidget): self.verticalLayout_groupbox_plot_profile.addWidget(self.toolbar_profile) self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_plot_profile) - # for f, _ in enumerate(stg.freq[0]): - slider_value = [ self.slider.value() - 1 if self.slider.value() - 1 <= stg.time[self.fileListWidget.currentRow()].shape[ 1] - 1 else np.max(stg.time[self.fileListWidget.currentRow()].shape[1] - 1)][0] # --- Profile plot --- - # self.axis_profile.cla() + self.axis_profile.plot(stg.BS_raw_data[self.fileListWidget.currentRow()][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], -stg.depth[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), :], @@ -3881,10 +2273,8 @@ class AcousticDataTab(QWidget): # --- Plot bottom line --- - # if (len(stg.depth_bottom) != 0) and (len(stg.depth_bottom) == self.fileListWidget.count()): if len(stg.depth_bottom[self.fileListWidget.currentRow()]) != 0: - print("slider value : ", self.fileListWidget.currentRow(), self.combobox_frequency_profile.currentIndex(), - slider_value, stg.ind_bottom[self.fileListWidget.currentRow()][slider_value]) + self.axis_profile.plot([0, np.nanmax(stg.BS_raw_data[self.fileListWidget.currentRow()][ self.combobox_frequency_profile.currentIndex(), @@ -3910,18 +2300,9 @@ class AcousticDataTab(QWidget): self.fig_profile.supylabel("Depth (m)") self.fig_profile.canvas.draw_idle() - # plt.close(self.fig_profile) - - # self.plot_transect_with_BS_raw_data() - - # self.slider.valueChanged.connect(self.update_plot_profile) - # self.slider.valueChanged.connect(self.update_xaxis_transect_with_BS_raw_data) - # self.combobox_frequency_profile.currentIndexChanged.connect(self.update_xaxis_transect_with_BS_raw_data) - # self.combobox_frequency_profile.currentIndexChanged.connect(self.update_plot_profile) def update_plot_profile(self): - # print("len(stg.BS_cross_section) ", len(stg.BS_cross_section)) - # if (len(stg.BS_cross_section) == 0) and (len(stg.BS_raw_data) != 0): + if self.fileListWidget.currentRow() != -1: if stg.BS_cross_section[self.fileListWidget.currentRow()].shape != (0,): @@ -4025,8 +2406,6 @@ class AcousticDataTab(QWidget): self.fig_profile.supxlabel("Acoustic Backscatter Signal (V)") self.fig_profile.supylabel("Depth (m)") self.fig_profile.canvas.draw_idle() - # self.fig_profile.canvas.flush_events() - # plt.close(self.fig_profile) def slide_profile_number_to_begin(self): self.slider.setValue(int(self.slider.minimum())) @@ -4068,280 +2447,6 @@ class AcousticDataTab(QWidget): self.lineEdit_slider.setText( str(stg.time[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), self.slider.value()-1])) - # def plot_transect_with_SNR_data(self): - # if not self.lineEdit_noise_file.text(): - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Plot transect Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Load data before plot SNR 2D field") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() - # elif self.tableModel.rowCount(1) == 10: - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Plot transect Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Fill table before plot SNR 2D field") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() - # elif self.canvas_BS == None: - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Plot transect Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Plot backscatter acoustic raw data 2D field before plot SNR 2D field") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() - # elif (self.lineEdit_noise_file.text()) and (self.tableModel.rowCount(1) > 11): - # - # self.fig_SNR, self.axis_SNR = plt.subplots(nrows=stg.freq.shape[0] , ncols=1, - # sharex=True, sharey=False, layout="constrained") - # self.canvas_SNR = FigureCanvas(self.fig_SNR) - # self.verticalLayout_groupbox_transect_2Dplot_snr_data.addWidget(self.canvas_SNR) - # - # self.verticalLayout_groupbox_transect_2Dplot_snr_data.removeWidget(self.scroll_SNR) - # self.scroll_SNR = QScrollArea() - # self.scroll_SNR.setWidget(self.canvas_SNR) - # self.scroll_SNR.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - # self.scroll_SNR.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) - # self.scroll_SNR.setAlignment(Qt.AlignCenter) - # self.verticalLayout_groupbox_transect_2Dplot_snr_data.addWidget(self.scroll_SNR) - # - # # self.spinbox_tmin.setValue(np.min(noise_data._time_snr)) - # # self.spinbox_tmax.setValue(np.round(np.max(noise_data._time_snr), 2)) - # - # # if self.combobox_ABS_system_choice.currentIndex() == 1: - # # - # # x, y = np.meshgrid( - # # stg.time[np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: - # # np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]], - # # stg.depth) - # # - # # for f in range(stg.freq.shape[0]): - # # - # # val_min = np.min(stg.snr[:, f, :]) - # # val_max = np.max(stg.snr[:, f, :]) - # # if val_min == 0: - # # val_min = 1e-5 - # # if val_max > 1000: - # # levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) - # # else: - # # levels = np.array([00.1, 1, 2, 10, 100, val_max]) - # # bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] - # # norm = BoundaryNorm(boundaries=bounds, ncolors=300) - # # - # # cf = (self.axis_SNR[f]. - # # contourf(x, -y, - # # stg.snr[:, f, - # # np.where(np.round(stg.snr, 2) == self.spinbox_tmin.value())[0][0]: - # # np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]], - # # levels, cmap='gist_rainbow', norm=norm)) - # # - # # self.axis_SNR[f].text(1, .70, stg.freq_text[f], - # # fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, - # # horizontalalignment='right', verticalalignment='bottom', - # # transform=self.axis_SNR[f].transAxes) - # # - # # self.fig_SNR.supxlabel('Time (sec)', fontsize=10) - # # self.fig_SNR.supylabel('Depth (m)', fontsize=10) - # # cbar = self.fig_SNR.colorbar(cf, ax=self.axis_SNR[:], shrink=1, location='right') - # # cbar.set_label(label='Signal to Noise Ratio', rotation=270, labelpad=10) - # # cbar.set_ticklabels(['0', '1', '2', '10', '100', r'10$^3$', r'10$^6$']) - # # self.fig_SNR.canvas.draw_idle() - # - # # elif self.combobox_ABS_system_choice.currentIndex() == 2: - # - # x = np.array([[[]]]) - # y = np.array([[[]]]) - # print(f"x : {x.shape}, y : {y.shape}") - # for f, freq in enumerate(stg.freq): - # - # if x.shape[2] == 0: - # x, y = np.meshgrid(stg.time_snr[f, :], stg.depth[f, :]) - # x = np.array([x]) - # y = np.array([y]) - # print(f"x : {x.shape}, y : {y.shape}") - # else: - # x0, y0 = np.meshgrid(stg.time_snr[f, :], stg.depth[f, :]) - # x = np.append(x, np.array([x0]), axis=0) - # y = np.append(y, np.array([y0]), axis=0) - # print(f"x : {x.shape}, y : {y.shape}") - # - # val_min = np.nanmin(abs(stg.SNR_data[f, :, :])) - # # print(f"val_min = {val_min}") - # val_max = np.nanmax(abs(stg.SNR_data[f, :, :])) - # # print(f"val_max = {val_max}") - # if int(val_min) == 0: - # val_min = 1e-5 - # if int(val_max) < 1000: - # levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) - # bounds = [00.1, 1, 2, 10, 100, 1000, 1e6, 1e6 * 1.2] - # else: - # levels = np.array([00.1, 1, 2, 10, 100, val_max]) - # bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] - # norm = BoundaryNorm(boundaries=bounds, ncolors=300) - # - # # print(f"levels = {levels}") - # # print(f"norm = {norm.boundaries}") - # if self.combobox_ABS_system_choice.currentIndex() == 1: - # - # cf = self.axis_SNR[f].contourf(x[f, :, :], -y[f, :, :], - # stg.SNR_data[f, :, :], levels, cmap='gist_rainbow', norm=norm) - # - # elif self.combobox_ABS_system_choice.currentIndex() == 2: - # - # cf = self.axis_SNR[f].contourf(x[f, :, :], -y[f, :, :], stg.SNR_data[f, :, :])#, levels, cmap='gist_rainbow', norm=norm) - # - # self.axis_SNR[f].text(1, .70, stg.freq_text[f], - # fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, - # horizontalalignment='right', verticalalignment='bottom', - # transform=self.axis_SNR[f].transAxes) - # - # self.fig_SNR.supxlabel('Time (sec)', fontsize=10) - # self.fig_SNR.supylabel('Depth (m)', fontsize=10) - # cbar = self.fig_SNR.colorbar(cf, ax=self.axis_SNR[:], shrink=1, location='right') - # cbar.set_label(label='Signal to Noise Ratio', rotation=270, labelpad=10) - # self.fig_SNR.canvas.draw_idle() - - # def update_xaxis_transect_with_SNR_data(self): - # - # # if self.canvas_SNR == None: - # # msgBox = QMessageBox() - # # msgBox.setWindowTitle("Plot transect Error") - # # msgBox.setIcon(QMessageBox.Warning) - # # msgBox.setText("Plot transect before change x-axis value") - # # msgBox.setStandardButtons(QMessageBox.Ok) - # # msgBox.exec() - # - # if ((self.canvas_BS != None) and (self.canvas_SNR != None)): - # - # # --- Backscatter noise signal is recorded for next tab --- - # - # stg.tmin_snr = np.array([]) - # stg.tmax_snr = np.array([]) - # - # stg.SNR_cross_section = np.array([[[]]]) - # stg.t_snr = np.array([[]]) - # - # x = np.array([[[]]]) - # y = np.array([[[]]]) - # # print(f"x : {x.shape}, y : {y.shape}") - # for f, _ in enumerate(stg.freq): - # - # if x.shape[2] == 0: - # x, y = np.meshgrid(stg.time_snr[f, :], stg.depth[f, :]) - # x = np.array([x]) - # y = np.array([y]) - # # print(f"x : {x.shape}, y : {y.shape}") - # else: - # x0, y0 = np.meshgrid(stg.time_snr[f, :], stg.depth[f, :]) - # x = np.append(x, np.array([x0]), axis=0) - # y = np.append(y, np.array([y0]), axis=0) - # # print(f"x : {x.shape}, y : {y.shape}") - # - # # print(np.abs(np.round(stg.time_snr[f, :], 2) - self.spinbox_tmin.value())) - # # print(np.where(np.abs(np.round(stg.time_snr[f, :], 2) - self.spinbox_tmin.value()) == - # # np.nanmin(np.abs(np.round(stg.time_snr[f, :], 2) - self.spinbox_tmin.value())))[0][0]) - # - # stg.tmin_snr = ( - # np.append(stg.tmin_snr, - # np.where(np.abs(np.round(stg.time_snr[f, :], 2) - self.spinbox_tmin.value()) == - # np.nanmin(np.abs(np.round(stg.time_snr[f, :], 2) - self.spinbox_tmin.value())))[0][ - # 0]) - # ) - # - # stg.tmax_snr = ( - # np.append(stg.tmax_snr, - # np.where(np.abs(np.round(stg.time_snr[f, :], 2) - self.spinbox_tmax.value()) == - # np.nanmin(np.abs(np.round(stg.time_snr[f, :], 2) - self.spinbox_tmax.value())))[0][ - # 0]) - # ) - # - # # print("stg.tmin[f] ", stg.tmin_snr[f]) - # # print("stg.tmax[f] ", stg.tmax_snr[f]) - # - # if stg.SNR_cross_section.shape[2] == 0: - # stg.SNR_cross_section = np.array([stg.SNR_data[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])]]) - # else: - # stg.SNR_cross_section = np.append(stg.SNR_cross_section, - # np.array([stg.SNR_data[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])]]), - # axis=0) - # - # # stg.BS_cross_section = np.stack(np.array([stg.BS_raw_data[f, :, int(stg.tmin[f]):int(stg.tmax[f])]]), axis=0) - # # stg.BS_cross_section = np.append(stg.BS_cross_section, np.array([stg.BS_raw_data[f, :, int(stg.tmin[f]):int(stg.tmax[f])]]), axis=2) - # - # if stg.t_snr.shape[1] == 0: - # stg.t_snr = np.array([stg.time_snr[f, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])]]) - # else: - # stg.t_snr = np.append(stg.t_snr, np.array([stg.time_snr[f, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])]]), axis=0) - # # stg.t = np.append(stg.t, np.array([stg.time[f, int(stg.tmin[f]):int(stg.tmax[f])]]), axis=0) - # # print("stg.t shape ", stg.t_snr.shape) - # - # self.axis_SNR[f].cla() - # - # # if self.combobox_ABS_system_choice.currentIndex() == 1: - # # - # # val_min = np.nanmin(stg.SNR_data[f, :, :]) - # # val_max = np.nanmax(stg.snr[f, :, :]) - # # if val_min == 0: - # # val_min = 1e-5 - # # if val_max < 1000: - # # levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) - # # else: - # # levels = np.array([00.1, 1, 2, 10, 100, val_max]) - # # - # # bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] - # # norm = BoundaryNorm(boundaries=bounds, ncolors=300) - # # - # # cf = self.axis_SNR[f].contourf(x, -y, - # # stg.snr[:, f, - # # np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: - # # np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]], - # # levels, cmap='gist_rainbow', norm=norm) - # # - # # self.axis_SNR[f].text(1, .70, stg.freq_text[f], - # # fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, - # # horizontalalignment='right', verticalalignment='bottom', - # # transform=self.axis_SNR[f].transAxes) - # # - # # elif self.combobox_ABS_system_choice.currentIndex() == 2: - # - # val_min = np.nanmin(abs(stg.SNR_data[f, :, :])) - # # print(f"val_min = {val_min}") - # val_max = np.nanmax(abs(stg.SNR_data[f, :, :])) - # # print(f"val_max = {val_max}") - # if int(val_min) == 0: - # val_min = 1e-5 - # if int(val_max) < 1000: - # levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) - # bounds = [00.1, 1, 2, 10, 100, 1000, 1e6, 1e6 * 1.2] - # else: - # levels = np.array([00.1, 1, 2, 10, 100, val_max]) - # bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] - # norm = BoundaryNorm(boundaries=bounds, ncolors=300) - # - # # print(f"levels = {levels}") - # # print(f"norm = {norm.boundaries}") - # - # if self.combobox_ABS_system_choice.currentIndex() == 1: - # - # cf = self.axis_SNR[f].contourf(x[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])], - # -y[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])], - # stg.SNR_data[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])], - # levels, cmap='gist_rainbow', norm=norm) - # - # elif self.combobox_ABS_system_choice.currentIndex() == 2: - # - # cf = self.axis_SNR[f].contourf(x[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])], - # -y[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])], - # stg.SNR_data[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])]) # , levels, cmap='gist_rainbow', norm=norm) - # - # self.axis_SNR[f].text(1, .70, stg.freq_text[f], - # fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, - # horizontalalignment='right', verticalalignment='bottom', - # transform=self.axis_SNR[f].transAxes) - # - # self.fig_SNR.supxlabel('Distance from left bank (m)', fontsize=10) - # self.fig_SNR.supylabel('Depth (m)', fontsize=10) - # self.fig_SNR.canvas.draw_idle() def detect_bottom(self): if self.fileListWidget.count() == 0: @@ -4351,13 +2456,7 @@ class AcousticDataTab(QWidget): msgBox.setText("Load data before compute bathymety algorithm") msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() - # elif self.tableModel.rowCount(1) == 10: - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Detect bottom Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Fill table before compute bathymety algorithm") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() + elif self.canvas_BS == None: msgBox = QMessageBox() msgBox.setWindowTitle("Detect bottom Error") @@ -4365,89 +2464,42 @@ class AcousticDataTab(QWidget): msgBox.setText("Plot transect before compute bathymety algorithm") msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() - # elif self.canvas_SNR == None: - # msgBox = QMessageBox() - # msgBox.setWindowTitle("Detect bottom Error") - # msgBox.setIcon(QMessageBox.Warning) - # msgBox.setText("Plot transect before compute bathymety algorithm") - # msgBox.setStandardButtons(QMessageBox.Ok) - # msgBox.exec() + elif self.lineEdit_next_cell_bathy.text() == "0.00": pass else: - # --- Record frequency choose for bottom detection --- - # if ((self.fileListWidget.count() == 1) and (len(stg.freq_bottom_detection) == 0)): - # - # stg.freq_bottom_detection = [self.combobox_frequency_bathymetry.currentIndex()] - # - # elif len(stg.rmax) < self.fileListWidget.count(): - # - # stg.freq_bottom_detection.append(self.combobox_frequency_bathymetry.currentIndex()) - - # if stg.depth_bottom == []: - # stg.freq_bottom_detection = [np.array([])]*self.fileListWidget.count() - # stg.depth_bottom = [np.array([])]*self.fileListWidget.count() - # stg.val_bottom = [np.array([])]*self.fileListWidget.count() - # stg.ind_bottom = [np.array([])]*self.fileListWidget.count() - if stg.BS_cross_section[self.fileListWidget.currentRow()].shape != (0,): stg.freq_bottom_detection[self.fileListWidget.currentRow()] = \ (self.combobox_frequency_bathymetry.currentIndex(), self.combobox_frequency_bathymetry.currentText()) - # Selecting the range in which we look for the bottom reflection - # rmin = np.float32(self.doubleRangeSlider_intg_area.value()[0].text().replace(",", ".")) - # rmax = np.float32(self.doubleRangeSlider_intg_area.value()[1].text().replace(",", ".")) - # rmin = -self.doubleRangeSlider_intg_area.value()[1] - # rmax = -self.doubleRangeSlider_intg_area.value()[0] - # rmin = self.spinbox_depth_min_bathy.value() rmin = float("".join(findall("[.0-9]", self.lineEdit_depth_max_bathy.text()))) - # rmax = self.spinbox_depth_max_bathy.value() rmax = float("".join(findall("[.0-9]", self.lineEdit_depth_min_bathy.text()))) - print("rmin ", rmin) - print("rmax ", rmax) - # empty result arrays - # r_bottom = np.zeros(stg.nb_profiles) - # val_bottom = np.zeros(stg.nb_profiles) r_bottom = np.zeros(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1]) val_bottom = np.zeros(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1]) r_bottom_ind = [] - # print(f"r_bottom shape with zeros : {r_bottom.shape}") BS_smooth = deepcopy(stg.BS_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_bathymetry.currentIndex(), :, :]) - # print(f"BS_smooth shape : {BS_smooth.shape}") + for k in range(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1]): BS_smooth[:, k] = savgol_filter(BS_smooth[:, k], 10, 2) - # fig1, ax1 = plt.subplots(nrows=1, ncols=1, layout="constrained") - # pcm1 = ax1.pcolormesh(stg.time_cross_section[0][0, :], -stg.depth_cross_section[0][0, :], (BS_smooth[:, :]), cmap='Blues') - # fig1.colorbar(pcm1, ax=ax1, shrink=1, location='right') - # plt.show() - # ----------- Detecting the bottom ------------- - # for d in range(stg.nb_profiles): for d in range(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1]): - # Index of the range where we look for the peak - # print(f"self.combobox_freq_choice.currentIndex() : {self.combobox_freq_choice.currentIndex()}") - # print(f"r = {stg.r}") - # print(f"ind_min : {np.where(stg.depth_cross_section[self.fileListWidget.currentRow()][int(self.combobox_frequency_bathymetry.currentIndex()), :] >= rmin)}") - # print(f"ind_max : {np.where(stg.depth_cross_section[self.fileListWidget.currentRow()][int(self.combobox_frequency_bathymetry.currentIndex()), :] <= rmax)}") + ind_min = np.where(stg.depth_cross_section[self.fileListWidget.currentRow()][int(self.combobox_frequency_bathymetry.currentIndex()), :] >= rmin)[0][0] ind_max = np.where(stg.depth_cross_section[self.fileListWidget.currentRow()][int(self.combobox_frequency_bathymetry.currentIndex()), :] <= rmax)[0][-1] # Getting the peak try: - # val_bottom[d] = np.nanmax((stg.BS_raw_data[self.combobox_freq_choice.currentIndex(), ind_min:ind_max, d])) val_bottom[d] = np.nanmax(BS_smooth[ind_min:ind_max, d]) - # print('---------------------------------------------------') - # print(f"d = {d}") - # print("stg.BS_raw_data[ind_min:ind_max] : ", stg.BS_raw_data[self.combobox_freq_choice.currentIndex(), ind_min:ind_max, d]) + except ValueError as e: msgBox = QMessageBox() msgBox.setWindowTitle("Detect bottom Error") @@ -4457,53 +2509,23 @@ class AcousticDataTab(QWidget): msgBox.setStandardButtons(QMessageBox.Ok) msgBox_return = msgBox.exec() if msgBox_return == msgBox.Ok: - break #msgBox.close() + break else: - # Getting the range cell of the peak - # ind_bottom = np.where((stg.BS_raw_data[self.combobox_freq_choice.currentIndex(), ind_min:ind_max, d]) - # == val_bottom[d])[0][0] + ind_bottom = np.where((BS_smooth[ind_min:ind_max, d]) == val_bottom[d])[0][0] np.append(stg.ind_bottom, ind_bottom) r_bottom[d] = stg.depth_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_bathymetry.currentIndex(), ind_bottom + ind_min] r_bottom_ind.append(ind_bottom + ind_min) # Updating the range where we will look for the peak (in the next cell) - # rmin = r_bottom[d] - locale.atof(self.doublespinbox_next_cell.text()) - # rmax = r_bottom[d] + locale.atof(self.doublespinbox_next_cell.text()) - # rmin = r_bottom[d] - np.float32(self.spinbox_offset_next_cell.text().replace(",", ".")) - # rmax = r_bottom[d] + np.float32(self.spinbox_offset_next_cell.text().replace(",", ".")) - # rmin = r_bottom[d] - self.doublespinbox_next_cell_bathy.value() rmin = r_bottom[d] - float("".join(findall("[.0-9]", self.lineEdit_next_cell_bathy.text()))) - # rmax = r_bottom[d] + self.doublespinbox_next_cell_bathy.value() rmax = r_bottom[d] + float("".join(findall("[.0-9]", self.lineEdit_next_cell_bathy.text()))) - # --- Plot vertical profile for bottom detection --- - # n = 60 - # t0 = 200 - # t1 = np.where(np.abs(stg.time[0, :] - t0) == np.nanmin(np.abs(stg.time[0, :] - t0)))[0][0] - # # print(np.abs(self._time[0, :] - 200)) - # # print(f"x0 = {x0}") - # r1 = 98 - # r2 = 150 - # fig2, ax2 = plt.subplots(nrows=1, ncols=n, layout="constrained") - # for i in range(n): - # ax2[i].plot(stg.BS_raw_data[self.combobox_freq_choice.currentIndex(), r1:r2, t1 + i], - # -stg.r[0, r1:r2], 'b') - # ax2[i].plot(BS_smooth[r1:r2, t1 + i], -stg.r[0, r1:r2], 'r') - # ax2[i].scatter(val_bottom[i], -r_bottom[i], marker="o", fc="black", s=12) - # ax2[i].set_xticks([]) - # if i != 0: - # ax2[i].set_yticks([]) - # plt.show() - - - # print(f"r_bootom shape : {r_bottom.shape}") BS_section_bottom = np.zeros((stg.depth_cross_section[self.fileListWidget.currentRow()].shape[1], stg.time_cross_section[self.fileListWidget.currentRow()].shape[1])) for i in range(BS_section_bottom.shape[0]): try: - # print(f"r_bottom_ind : {r_bottom_ind}") BS_section_bottom[r_bottom_ind[i]][i] = 1 except IndexError as e: msgBox = QMessageBox() @@ -4514,51 +2536,20 @@ class AcousticDataTab(QWidget): msgBox.setStandardButtons(QMessageBox.Ok) msgBox_return = msgBox.exec() if msgBox_return == msgBox.Ok: - break # msgBox.close() + break if BS_section_bottom.sum() > 2: - # --- Record r_bottom for other tabs --- - # stg.r_bottom = r_bottom[np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: - # np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]] - # stg.val_bottom = val_bottom[np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: - # np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]] stg.depth_bottom[self.fileListWidget.currentRow()] = r_bottom - print("stg.depth_bottom", stg.depth_bottom) stg.val_bottom[self.fileListWidget.currentRow()] = val_bottom - print("stg.val_bottom", stg.val_bottom) stg.ind_bottom[self.fileListWidget.currentRow()] = r_bottom_ind - print("stg.ind_bottom", stg.ind_bottom) - # if ((self.fileListWidget.count() == 1) and (len(stg.depth_bottom) == 0)): - # stg.depth_bottom = [r_bottom]#[int(stg.tmin[self.combobox_freq_choice.currentIndex()]): - # # int(stg.tmax[self.combobox_freq_choice.currentIndex()])] - # stg.val_bottom = [val_bottom]#[int(stg.tmin[self.combobox_freq_choice.currentIndex()]): - # # int(stg.tmax[self.combobox_freq_choice.currentIndex()])] - # stg.ind_bottom = [r_bottom_ind] - # - # elif len(stg.depth_bottom) < self.fileListWidget.count(): - # - # stg.depth_bottom.append(r_bottom) - # - # stg.val_bottom.append(val_bottom) - # - # stg.ind_bottom.append(r_bottom_ind) - # - # else: - # - # stg.depth_bottom[self.fileListWidget.currentRow()] = r_bottom - # - # stg.val_bottom[self.fileListWidget.currentRow()] = val_bottom - # - # stg.ind_bottom[self.fileListWidget.currentRow()] = r_bottom_ind BS_stream_bed_copy = deepcopy(stg.BS_cross_section[self.fileListWidget.currentRow()]) for f, _ in enumerate(stg.freq[self.fileListWidget.currentRow()]): for k, _ in enumerate(stg.depth_bottom[self.fileListWidget.currentRow()]): - # print(k, np.where(stg.r >= stg.r_bottom[k])[0]) BS_stream_bed_copy[ f, np.where(stg.depth_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_bathymetry.currentIndex(), :] >= stg.depth_bottom[self.fileListWidget.currentRow()][k])[ @@ -4566,18 +2557,6 @@ class AcousticDataTab(QWidget): stg.BS_stream_bed[self.fileListWidget.currentRow()] = BS_stream_bed_copy - # if ((self.fileListWidget.count() == 1) and (len(stg.BS_stream_bed) == 0)): - # - # stg.BS_stream_bed = [BS_stream_bed_copy] - # - # elif len(stg.BS_stream_bed) < self.fileListWidget.count(): - # - # stg.BS_stream_bed.append(BS_stream_bed_copy) - # - # else: - # - # stg.BS_stream_bed[self.fileListWidget.currentRow()] = BS_stream_bed_copy - # --- Plot transect BS with bathymetry --- for f, _ in enumerate(stg.freq[self.fileListWidget.currentRow()]): self.axis_BS[f].cla() @@ -4587,15 +2566,6 @@ class AcousticDataTab(QWidget): if val_min == 0: val_min = 1e-5 - # pcm = self.axis_BS[f].pcolormesh( - # stg.time[np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: - # np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]], - # -stg.r, - # (stg.BS_raw_data[:, f, - # np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: - # np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]]), - # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - if self.combobox_ABS_system_choice.currentIndex() == 1: pcm = self.axis_BS[f].pcolormesh(stg.time_cross_section[self.fileListWidget.currentRow()][f, :], -stg.depth_cross_section[self.fileListWidget.currentRow()][f, :], @@ -4607,15 +2577,6 @@ class AcousticDataTab(QWidget): np.log(stg.BS_cross_section[self.fileListWidget.currentRow()][f, :, :]), cmap='Blues') - # self.axis_BS[f].plot( - # stg.time[np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: - # np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]], - # - r_bottom[np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: - # np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]], - # color='black', linewidth=1, linestyle="solid") - - # print("stg.t[self.combobox_freq_choice.currentIndex(), :] : ", stg.t[self.combobox_freq_choice.currentIndex(), :].shape) - # print("-stg.r_bottom : ", stg.r_bottom.shape) self.axis_BS[f].plot(stg.time_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_bathymetry.currentIndex(), :], -stg.depth_bottom[self.fileListWidget.currentRow()], color='black', linewidth=1, linestyle="solid") @@ -4628,22 +2589,15 @@ class AcousticDataTab(QWidget): # --- Update plot profile --- self.update_plot_profile() - self.fig_BS.canvas.draw_idle() elif stg.BS_raw_data[self.fileListWidget.currentRow()].shape != (0,): - print("I'm here for bottom detection") - stg.freq_bottom_detection[self.fileListWidget.currentRow()] = ( self.combobox_frequency_bathymetry.currentIndex(), self.combobox_frequency_bathymetry.currentText()) # Selecting the range in which we look for the bottom reflection - # rmin = -self.doubleRangeSlider_intg_area.value()[1] - # rmax = -self.doubleRangeSlider_intg_area.value()[0] - # rmin = self.spinbox_depth_min_bathy.value() rmin = float("".join(findall("[.0-9]", self.lineEdit_depth_max_bathy.text()))) - # rmax = self.spinbox_depth_max_bathy.value() rmax = float("".join(findall("[.0-9]", self.lineEdit_depth_min_bathy.text()))) # empty result arrays @@ -4654,7 +2608,6 @@ class AcousticDataTab(QWidget): BS_smooth = deepcopy(stg.BS_raw_data[self.fileListWidget.currentRow()][ self.combobox_frequency_bathymetry.currentIndex(), :, :]) - # print(f"BS_smooth shape : {BS_smooth.shape}") for k in range(stg.time[self.fileListWidget.currentRow()].shape[1]): BS_smooth[:, k] = savgol_filter(BS_smooth[:, k], 10, 2) @@ -4690,11 +2643,7 @@ class AcousticDataTab(QWidget): r_bottom_ind.append(ind_bottom + ind_min) # Updating the range where we will look for the peak (in the next cell) - # rmin = r_bottom[d] - np.float32(self.spinbox_offset_next_cell.text().replace(",", ".")) - # rmax = r_bottom[d] + np.float32(self.spinbox_offset_next_cell.text().replace(",", ".")) - # rmin = r_bottom[d] - self.doublespinbox_next_cell_bathy.value() rmin = r_bottom[d] - float("".join(findall("[.0-9]", self.lineEdit_next_cell_bathy.text()))) - # rmax = r_bottom[d] + self.doublespinbox_next_cell_bathy.value() rmax = r_bottom[d] + float("".join(findall("[.0-9]", self.lineEdit_next_cell_bathy.text()))) BS_section_bottom = np.zeros((stg.depth[self.fileListWidget.currentRow()].shape[1], @@ -4725,7 +2674,6 @@ class AcousticDataTab(QWidget): BS_stream_bed_copy = deepcopy(stg.BS_raw_data[self.fileListWidget.currentRow()]) for f, _ in enumerate(stg.freq[self.fileListWidget.currentRow()]): for k, _ in enumerate(stg.depth_bottom[self.fileListWidget.currentRow()]): - # print(k, np.where(stg.r >= stg.r_bottom[k])[0]) BS_stream_bed_copy[ f, np.where(stg.depth[self.fileListWidget.currentRow()][ self.combobox_frequency_bathymetry.currentIndex(), :] @@ -4772,176 +2720,3 @@ class AcousticDataTab(QWidget): self.fig_BS.canvas.draw_idle() - # print("stg.freq_bottom_detection : ", stg.freq_bottom_detection) - # print("stg.depth_bottom : ", stg.depth_bottom) - # print("stg.val_bottom : ", stg.val_bottom) - # print("stg.ind_bottom : ", stg.ind_bottom) - - # # --- Plot transect SNR with bathymetry --- - # if self.canvas_SNR != None: - # # x, y = np.meshgrid( - # # stg.time[np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: - # # np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]], - # # stg.depth) - # - # x = np.array([[[]]]) - # y = np.array([[[]]]) - # # print(f"x : {x.shape}, y : {y.shape}") - # - # for f, _ in enumerate(stg.freq): - # - # if x.shape[2] == 0: - # x, y = np.meshgrid(stg.time_snr[f, :], stg.depth[f, :]) - # x = np.array([x]) - # y = np.array([y]) - # # print(f"x : {x.shape}, y : {y.shape}") - # else: - # x0, y0 = np.meshgrid(stg.time_snr[f, :], stg.depth[f, :]) - # x = np.append(x, np.array([x0]), axis=0) - # y = np.append(y, np.array([y0]), axis=0) - # # print(f"x : {x.shape}, y : {y.shape}") - # - # self.axis_SNR[f].cla() - # - # val_min = abs(np.nanmin(stg.SNR_data[f, :, :])) - # val_max = abs(np.nanmax(stg.SNR_data[f, :, :])) - # if val_min == 0: - # val_min = 1e-5 - # if val_max < 1000: - # levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) - # else: - # levels = np.array([00.1, 1, 2, 10, 100, val_max]) - # bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] - # norm = BoundaryNorm(boundaries=bounds, ncolors=300) - # - # # cf = self.axis_SNR[f].contourf(x, -y, - # # stg.snr[:, f, - # # np.where(np.round(stg.time, - # # 2) == self.spinbox_tmin.value())[0][0]: - # # np.where(np.round(stg.time, - # # 2) == self.spinbox_tmax.value())[0][0]], - # # levels, cmap='gist_rainbow', norm=norm) # , shading='gouraud') - # - # if self.combobox_ABS_system_choice.currentIndex() == 1: - # - # cf = self.axis_SNR[f].contourf(x[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])], - # -y[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])], - # stg.SNR_data[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])], - # levels, cmap='gist_rainbow', norm=norm) - # - # elif self.combobox_ABS_system_choice.currentIndex() == 2: - # - # cf = self.axis_SNR[f].contourf(x[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])], - # -y[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])], - # stg.SNR_data[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[ - # f])]) # , levels, cmap='gist_rainbow', norm=norm) - # - # self.axis_SNR[f].text(1, .70, stg.freq_text[f], - # fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, - # horizontalalignment='right', verticalalignment='bottom', - # transform=self.axis_SNR[f].transAxes) - # - # self.axis_SNR[f].plot(stg.t[self.combobox_freq_choice.currentIndex(), :], -stg.depth_bottom, - # color='black', linewidth=1, linestyle="solid") - # - # # self.axis_SNR[f].plot( - # # stg.time[np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: - # # np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]], - # # - r_bottom[np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: - # # np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]], - # # + np.min(r_bottom[np.where(np.round(noise_data._time, 2) == self.spinbox_tmin.value())[0][0]: - # # np.where(np.round(noise_data._time, 2) == self.spinbox_tmax.value())[0][0]]), - # # np.max(self._model.r_bottom_cross_section) - self._model.r_bottom_cross_section + np.min(self._model.r_bottom_cross_section), - # # color='black', linewidth=1, linestyle="solid") - # - # self.axis_SNR[f].text(1, .70, stg.freq_text[f], - # fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, - # horizontalalignment='right', verticalalignment='bottom', - # transform=self.axis_SNR[f].transAxes) - # - # self.fig_SNR.canvas.draw_idle() - - - # else: - # - # acoustic_data = self.load_BS_acoustic_raw_data() - # # Selecting the range in which we look for the bottom reflection - # rmin = np.int(self.spinbox_depth_min.text()) # 4 - # rmax = np.int(self.spinbox_depth_max.text()) # 8 - # - # # empty result arrays - # r_bottom = np.zeros(acoustic_data._nb_profiles) - # val_bottom = np.zeros(acoustic_data._nb_profiles) - # r_bottom_ind = [] - # # ----------- Detecting the bottom ------------- - # for d in range(acoustic_data._nb_profiles): - # # Index of the range where we look for the peak - # ind_min = np.where(acoustic_data._r >= rmin)[0][0] - # ind_max = np.where(acoustic_data._r <= rmax)[0][-1] - # # Getting the peak - # val_bottom[d] = np.nanmax(acoustic_data._BS_raw_data[ind_min:ind_max, - # self.combobox_freq_choice.currentIndex() - 1, d]) - # # Getting the range cell of the peak - # ind_bottom = np.where(acoustic_data._BS_raw_data[ind_min:ind_max, - # self.combobox_freq_choice.currentIndex() - 1, d] == val_bottom[d])[0][0] - # r_bottom[d] = acoustic_data._r[ind_bottom + ind_min] - # r_bottom_ind.append(ind_bottom + ind_min) - # # Updating the range where we will look for the peak (in the next cell) - # rmin = r_bottom[d] - locale.atof(self.doublespinbox_next_cell.text()) # 0.75 - # rmax = r_bottom[d] + locale.atof(self.doublespinbox_next_cell.text()) # 0.75 - # - # BS_section_bottom = np.zeros((acoustic_data._BS_raw_data.shape[0], acoustic_data._BS_raw_data.shape[2])) - # - # for i in range(BS_section_bottom.shape[0]): - # # print(r_bottom_temp_ind[i]) - # # print(i) - # BS_section_bottom[r_bottom_ind[i]][i] = 1 - # # print(BS_section_bottom[r_bottom_temp_ind[i]][i]) - # - # # --- Plot transect BS with bathymetry --- - # for f in range(acoustic_data._freq.shape[0]): - # self.axis_BS[f].cla() - # - # val_min = np.min(acoustic_data._BS_raw_data[:, f, :]) - # val_max = np.max(acoustic_data._BS_raw_data[:, f, :]) - # if val_min == 0: - # val_min = 1e-5 - # - # pcm = self.axis_BS[f].pcolormesh( - # acoustic_data._time[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: - # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]], - # -acoustic_data._r, - # (acoustic_data._BS_raw_data[:, f, - # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: - # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]]), - # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) # , shading='gouraud') - # - # self.axis_BS[f].plot( - # acoustic_data._time[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: - # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]], - # # np.max(r_bottom[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: - # # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]]), - # - r_bottom[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: - # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]], - # # + np.min(r_bottom[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: - # # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]]), - # # np.max(self._model.r_bottom_cross_section) - self._model.r_bottom_cross_section + np.min(self._model.r_bottom_cross_section), - # color='black', linewidth=1, linestyle="solid") - # - # self.axis_BS[f].text(1, .70, acoustic_data._freq_text[f], - # fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, - # horizontalalignment='right', verticalalignment='bottom', - # transform=self.axis_BS[f].transAxes) - # - # - - - # self.fig_BS.supxlabel('Distance from left bank (m)', fontsize=10) - # self.fig_BS.supylabel('Depth (m)', fontsize=10) - # # plt.subplots_adjust(bottom=0.125, top=0.98, right=1.03, left=0.08, hspace=0.1) - # # self.fig.tight_layout() - # cbar = self.fig_BS.colorbar(pcm, ax=self.axis_BS[:], shrink=1, location='right') - # cbar.set_label(label='Backscatter acoustic signal (V)', rotation=270, labelpad=10) - - # self.fig_SNR.canvas.draw_idle() - # return r_bottom, val_bottom, r_bottom_ind, BS_section_bottom