From 394b557d736d226c8eb7b4bbf749bb05ae4ef03c Mon Sep 17 00:00:00 2001 From: brahim Date: Fri, 18 Oct 2024 14:21:15 +0200 Subject: [PATCH] GPS groupbox is reorganized with animated groupbox --- View/acoustic_data_tab.py | 282 +++++++++++++++++++++++--------------- 1 file changed, 174 insertions(+), 108 deletions(-) diff --git a/View/acoustic_data_tab.py b/View/acoustic_data_tab.py index 9cf138a..0fb5885 100644 --- a/View/acoustic_data_tab.py +++ b/View/acoustic_data_tab.py @@ -6,7 +6,7 @@ from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout, QGroupBox, QPush QProgressBar, QRadioButton, QFormLayout, QSlider, QAbstractItemView, QMenu, QItemDelegate, QCheckBox, QAbstractSpinBox) from PyQt5.QtGui import QPixmap, QIcon, QFont, QMouseEvent, QIntValidator, QDoubleValidator -from PyQt5.QtCore import Qt, QCoreApplication, pyqtSignal, pyqtSlot, QEvent +from PyQt5.QtCore import Qt, QCoreApplication, pyqtSignal, pyqtSlot, QEvent, QSize, QPropertyAnimation import numpy as np import pandas as pd @@ -618,6 +618,7 @@ class AcousticDataTab(QWidget): # | Group Box Display option | # ++++++++++++++++++++++++++++ + self.groupbox_display_option.setTitle("Display option") self.verticalLayout_groupbox_display_option = QVBoxLayout(self.groupbox_display_option) # 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 @@ -625,84 +626,59 @@ class AcousticDataTab(QWidget): # --- Group box GPS file --- self.groupbox_gps = QGroupBox() + self.groupbox_gps.setTitle("Convert recording time to distance from bank") self.horizontal_gps_input_data = QHBoxLayout(self.groupbox_gps) - self.verticalLayout_radiobutton_gps = QVBoxLayout() - 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.verticalLayout_groupbox_display_option.addWidget(self.groupbox_gps) self.groupbox_gps_value = QGroupBox() - self.groupbox_gps_value.setVisible(True) + self.groupbox_gps_value.setTitle("Value") + self.groupbox_gps_value.setCheckable(True) + self.groupbox_gps_value.setChecked(True) + self.horizontal_gps_input_data.addWidget(self.groupbox_gps_value) + 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.lineEdit_gps_value.setMaximumWidth(80) 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.setVisible(False) - # 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, 1) - self.pushbutton_gps_file = QPushButton() - self.pushbutton_gps_file.setIcon(self.icon_folder) - self.gridLayout_groupbox_gps_file.addWidget(self.pushbutton_gps_file, 0, 1, 1, 1) - self.lineEdit_gps_file = QLineEdit() - self.gridLayout_groupbox_gps_file.addWidget(self.lineEdit_gps_file, 0, 2, 1, 1) - - self.label_date_groupbox_gps_file = QLabel() - self.gridLayout_groupbox_gps_file.addWidget(self.label_date_groupbox_gps_file, 0, 3, 1, 1) - self.label_hour_groupbox_gps_file = QLabel() - self.gridLayout_groupbox_gps_file.addWidget(self.label_hour_groupbox_gps_file, 0, 4, 1, 1) - - # Download Push Button event : connect button clicked signal to open file slot - # self.pushButton_gpsfile.clicked.connect(self.open_dialog_box) + self.groupbox_gps_file.setCheckable(True) + self.groupbox_gps_file.setChecked(False) + self.groupbox_gps_file.setTitle("GPS file") self.horizontal_gps_input_data.addWidget(self.groupbox_gps_file) - self.verticalLayout_groupbox_display_option.addWidget(self.groupbox_gps) + self.gridLayout_groupbox_gps_file = QGridLayout(self.groupbox_gps_file) - # # --- Time offset line between ABS system time and GPS time --- + self.pushbutton_gps_file = QPushButton() + self.pushbutton_gps_file.setIcon(self.icon_folder) + self.gridLayout_groupbox_gps_file.addWidget(self.pushbutton_gps_file, 0, 0, 1, 1) + self.lineEdit_gps_file = QLineEdit() + self.gridLayout_groupbox_gps_file.addWidget(self.lineEdit_gps_file, 0, 1, 1, 1) + + # --- 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, 1, 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, 1, 2, 1, 1) + self.gridLayout_groupbox_gps_file.addWidget(self.label_acoustic_gps_time, 0, 2, 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, 1, 3, 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, 1, 4, 1, 1) + self.gridLayout_groupbox_gps_file.addWidget(self.combobox_plus_minus, 0, 3, 1, 1) + self.lineEdit_time_offset_value = QLineEdit() + self.lineEdit_time_offset_value.setMaximumWidth(80) + self.gridLayout_groupbox_gps_file.addWidget(self.lineEdit_time_offset_value, 0, 4, 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, 1, 5, 1, 1) + self.gridLayout_groupbox_gps_file.addWidget(self.label_seconds, 0, 5, 1, 1) - self.verticalLayout_groupbox_display_option.addLayout(self.gridLayout_time_offset) # ---------------------------------------------------------------------------- @@ -711,6 +687,7 @@ class AcousticDataTab(QWidget): # --- Groupbox display option limits --- self.groupbox_display_option_limits = QGroupBox() + self.groupbox_display_option_limits.setTitle("Set the boundaries") self.gridLayout_groupbox_display_option_limits = QGridLayout(self.groupbox_display_option_limits) self.verticalLayout_groupbox_display_option.addWidget(self.groupbox_display_option_limits) @@ -800,12 +777,14 @@ class AcousticDataTab(QWidget): # --------------------------------------- self.groupbox_display_option_bathymetry = QGroupBox() + self.groupbox_display_option_bathymetry.setTitle("Detect bottom of the river") self.gridLayout_groupbox_display_option_bathymetry = QGridLayout(self.groupbox_display_option_bathymetry) self.verticalLayout_groupbox_display_option.addWidget(self.groupbox_display_option_bathymetry) self.combobox_frequency_bathymetry = QComboBox() - self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.combobox_frequency_bathymetry, 0, 0, 1, 1) + 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) @@ -825,47 +804,56 @@ class AcousticDataTab(QWidget): 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) + 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.gridLayout_groupbox_display_option_bathymetry.addWidget(self.spinbox_depth_min_bathy, 0, 2, 1, 1) + # 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) + self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.lineEdit_depth_min_bathy, 0, 2, 1, 1, Qt.AlignCenter) self.label_depth_min_unit = QLabel() self.label_depth_min_unit.setText("m") - self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.label_depth_min_unit, 0, 3, 1, 1) + self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.label_depth_min_unit, 0, 3, 1, 1, Qt.AlignLeft) self.label_to_bathy = QLabel() - self.label_to_bathy.setText("to -") - self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.label_to_bathy, 0, 4, 1, 1) + 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.gridLayout_groupbox_display_option_bathymetry.addWidget(self.spinbox_depth_max_bathy, 0, 5, 1, 1) + # 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) + self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.lineEdit_depth_max_bathy, 0, 5, 1, 1, Qt.AlignCenter) self.label_depth_max_unit = QLabel() self.label_depth_max_unit.setText("m") - self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.label_depth_max_unit, 0, 6, 1, 1) + self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.label_depth_max_unit, 0, 6, 1, 1, Qt.AlignLeft) self.label_next_cell = QLabel() self.label_next_cell.setText("+/-") - self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.label_next_cell, 0, 7, 1, 1) + 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.gridLayout_groupbox_display_option_bathymetry.addWidget(self.doublespinbox_next_cell_bathy, 0, 8, 1, 1) + # 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) + self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.lineEdit_next_cell_bathy, 0, 8, 1, 1, Qt.AlignCenter) self.label_next_cell_unit = QLabel() self.label_next_cell_unit.setText("m") - self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.label_next_cell_unit, 0, 9, 1, 1) + self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.label_next_cell_unit, 0, 9, 1, 1, Qt.AlignLeft) self.pushbutton_apply_bathymetry = QPushButton() self.pushbutton_apply_bathymetry.setIcon(self.icon_apply_limits) - self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.pushbutton_apply_bathymetry, 0, 10, 1, 1) + self.gridLayout_groupbox_display_option_bathymetry.addWidget(self.pushbutton_apply_bathymetry, 0, 10, 1, 1, Qt.AlignCenter) # 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 @@ -1226,8 +1214,8 @@ class AcousticDataTab(QWidget): 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.radiobutton_value.toggled.connect(self.onClicked_radiobutton_gps) + # self.radiobutton_file.toggled.connect(self.onClicked_radiobutton_gps) # self.spinbox_temperature.valueChanged.connect(self.temperature_value) # self.spinbox_temperature.lineEdit().returnPressed.connect(self.temperature_value) @@ -1241,6 +1229,12 @@ class AcousticDataTab(QWidget): # 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.set_rmin_rmax_for_doubleRangeSider_depth) @@ -1341,13 +1335,13 @@ class AcousticDataTab(QWidget): # 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.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.label_time_offset.setText(_translate("CONSTANT_STRING", cs.TIME_OFFSET)) - self.groupbox_display_option.setTitle(_translate("CONSTANT_STRING", cs.DISPLAY_OPTIONS)) + # 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)) @@ -1791,6 +1785,51 @@ class AcousticDataTab(QWidget): 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) + + def groupbox_gps_value_size_change(self): + + duration = 500 + self.animation_groupbox_gps_value = QPropertyAnimation(self.groupbox_gps_value, b"size") + self.animation_groupbox_gps_value.setDuration(duration) + + self.animation_groupbox_gps_value.setStartValue(QSize(self.groupbox_gps_value.width(), + self.groupbox_gps_value.height())) + + if self.groupbox_gps_value.isChecked(): + self.animation_groupbox_gps_value.setEndValue( + QSize(self.groupbox_gps_value.width(), + self.groupbox_gps_value.sizeHint().height())) + else: + self.animation_groupbox_gps_value.setEndValue(QSize(self.groupbox_gps_value.width(), 25)) + + self.animation_groupbox_gps_value.start() + + def groupbox_gps_file_toggle(self): + if self.groupbox_gps_file.isChecked() == True: + self.groupbox_gps_value.setChecked(False) + + def groupbox_gps_file_size_change(self): + + duration = 500 + self.animation_groupbox_gps_file = QPropertyAnimation(self.groupbox_gps_file, b"size") + self.animation_groupbox_gps_file.setDuration(duration) + + self.animation_groupbox_gps_file.setStartValue(QSize(self.groupbox_gps_file.width(), + self.groupbox_gps_file.height())) + + if self.groupbox_gps_file.isChecked(): + self.animation_groupbox_gps_file.setEndValue( + QSize(self.groupbox_gps_file.width(), + self.groupbox_gps_file.sizeHint().height())) + else: + self.animation_groupbox_gps_file.setEndValue(QSize(self.groupbox_gps_file.width(), 25)) + + self.animation_groupbox_gps_file.start() # -------- Computing water attenuation coefficient ----------- # def water_attenuation(self): @@ -2004,9 +2043,12 @@ class AcousticDataTab(QWidget): self.doubleRangeSlider_distance_from_bank.setValue(value=(5, 40)) self.combobox_frequency_bathymetry.clear() - self.spinbox_depth_min_bathy.setValue(0.00) - self.spinbox_depth_max_bathy.setValue(0.00) - self.doublespinbox_next_cell_bathy.setValue(0.00) + # 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 --- self.tableView.reset() @@ -2106,9 +2148,12 @@ class AcousticDataTab(QWidget): self.doubleRangeSlider_distance_from_bank.setValue(value=(5, 40)) self.combobox_frequency_bathymetry.clear() - self.spinbox_depth_min_bathy.setValue(0.00) - self.spinbox_depth_max_bathy.setValue(0.00) - self.doublespinbox_next_cell_bathy.setValue(0.00) + # 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 --- self.tableView.reset() @@ -2267,7 +2312,7 @@ class AcousticDataTab(QWidget): stg.depth_bottom.append(np.array([])) stg.val_bottom.append([]) stg.ind_bottom.append([]) - stg.freq_bottom_detection.append([]) + stg.freq_bottom_detection.append(()) stg.depth_bottom_detection_1st_int_area.append([]) stg.BS_noise_raw_data.append(np.array([])) @@ -3292,13 +3337,21 @@ class AcousticDataTab(QWidget): if stg.depth_cross_section[self.fileListWidget.currentRow()].shape != (0,): - self.spinbox_depth_min_bathy.setValue(stg.depth_cross_section[self.fileListWidget.currentRow()][0, 0]) - self.spinbox_depth_max_bathy.setValue(stg.depth_cross_section[self.fileListWidget.currentRow()][0, -1]) + # self.spinbox_depth_min_bathy.setValue(stg.depth_cross_section[self.fileListWidget.currentRow()][0, 0]) + self.lineEdit_depth_min_bathy.setText( + "-" + str(stg.depth_cross_section[self.fileListWidget.currentRow()][0, -1])) + # self.spinbox_depth_max_bathy.setValue(stg.depth_cross_section[self.fileListWidget.currentRow()][0, -1]) + self.lineEdit_depth_max_bathy.setText( + "-" + str(stg.depth_cross_section[self.fileListWidget.currentRow()][0, 0])) else: - self.spinbox_depth_min_bathy.setValue(stg.depth[self.fileListWidget.currentRow()][0, 0]) - self.spinbox_depth_max_bathy.setValue(stg.depth[self.fileListWidget.currentRow()][0, -1]) + # self.spinbox_depth_min_bathy.setValue(stg.depth[self.fileListWidget.currentRow()][0, 0]) + self.lineEdit_depth_min_bathy.setText( + "-" + str(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(stg.depth[self.fileListWidget.currentRow()][0, 0])) def plot_backscattered_acoustic_signal_recording(self): # --- Condition if table is not filled --- @@ -3392,7 +3445,7 @@ class AcousticDataTab(QWidget): color='red', linestyle="solid", linewidth=2) self.fig_BS.supxlabel('Time (sec)', fontsize=10) - self.fig_BS.supylabel('Depth (m)', fontsize=10) + self.fig_BS.supylabel('Distance from transducer (m)', fontsize=10) 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() @@ -3523,7 +3576,7 @@ class AcousticDataTab(QWidget): 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.supylabel('Distance from transducer (m)', fontsize=10) self.fig_BS.canvas.draw_idle() # self.fig_BS.canvas.flush_events() # plt.close(self.fig_BS) @@ -3824,7 +3877,7 @@ class AcousticDataTab(QWidget): transform=self.axis_profile.transAxes) self.fig_profile.supxlabel("Acoustic Backscatter Signal (V)") - self.fig_profile.supylabel("Depth (m)") + self.fig_profile.supylabel("Distance from transducer (m)") self.fig_profile.canvas.draw_idle() # plt.close(self.fig_profile) @@ -3940,7 +3993,7 @@ class AcousticDataTab(QWidget): transform=self.axis_profile.transAxes) self.fig_profile.supxlabel("Acoustic Backscatter Signal (V)") - self.fig_profile.supylabel("Depth (m)") + self.fig_profile.supylabel("Distance from transducer (m)") self.fig_profile.canvas.draw_idle() # self.fig_profile.canvas.flush_events() # plt.close(self.fig_profile) @@ -4271,7 +4324,11 @@ class AcousticDataTab(QWidget): # msgBox.setText("Plot transect before compute bathymety algorithm") # msgBox.setStandardButtons(QMessageBox.Ok) # msgBox.exec() - elif self.canvas_BS != None: + 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)): @@ -4290,15 +4347,18 @@ class AcousticDataTab(QWidget): if stg.BS_cross_section[self.fileListWidget.currentRow()].shape != (0,): - stg.freq_bottom_detection[self.fileListWidget.currentRow()] = self.combobox_frequency_bathymetry.currentIndex() + 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() - rmax = self.spinbox_depth_max_bathy.value() + # 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) @@ -4364,10 +4424,12 @@ class AcousticDataTab(QWidget): # 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() - rmax = r_bottom[d] + self.doublespinbox_next_cell_bathy.value() + # 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 --- + # --- 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] @@ -4525,14 +4587,16 @@ class AcousticDataTab(QWidget): print("I'm here for bottom detection") - stg.freq_bottom_detection[ - self.fileListWidget.currentRow()] = self.combobox_frequency_bathymetry.currentIndex() + 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() - rmax = self.spinbox_depth_max_bathy.value() + # 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 r_bottom = np.zeros(stg.time[self.fileListWidget.currentRow()].shape[1]) @@ -4580,8 +4644,10 @@ class AcousticDataTab(QWidget): # 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() - rmax = r_bottom[d] + self.doublespinbox_next_cell_bathy.value() + # 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], stg.time[self.fileListWidget.currentRow()].shape[1]))