From 5eec52bda9055a16bca3fbada36095f9fbf0461f Mon Sep 17 00:00:00 2001 From: brahim Date: Tue, 22 Oct 2024 17:26:47 +0200 Subject: [PATCH] Distance from ABS to free surface is added so that depth represents distance to the free surace in plots and not distance from transducers. --- View/acoustic_data_tab.py | 764 ++++++++++++++------------------------ settings.py | 187 ++++++---- 2 files changed, 400 insertions(+), 551 deletions(-) diff --git a/View/acoustic_data_tab.py b/View/acoustic_data_tab.py index e052675..4d22841 100644 --- a/View/acoustic_data_tab.py +++ b/View/acoustic_data_tab.py @@ -19,6 +19,9 @@ from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as Navigatio from os import path from copy import deepcopy import locale + +from settings import depth_cross_section + locale.setlocale(locale.LC_ALL, '') from scipy.signal import savgol_filter @@ -78,6 +81,7 @@ class AcousticDataTab(QWidget): self.icon_delete = QIcon(self.path_icon + "delete.png") 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") ### --- General layout of widgets --- @@ -212,8 +216,8 @@ class AcousticDataTab(QWidget): # | Group Box Measurements information | # ++++++++++++++++++++++++++++++++++++++ - self.gridLayout_goupbox_info = QGridLayout() - self.groupbox_info.setLayout(self.gridLayout_goupbox_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) @@ -226,6 +230,19 @@ class AcousticDataTab(QWidget): self.label_date_acoustic_file = QLabel() self.label_hour_acoustic_file = QLabel() + self.label_distance_from_ABS_to_free_surface = QLabel() + self.label_distance_from_ABS_to_free_surface.setText("ABS distance from the free surface") + + self.lineEdit_distance_from_ABS_to_free_surface = QLineEdit() + self.lineEdit_distance_from_ABS_to_free_surface.setText("0.00") + self.lineEdit_distance_from_ABS_to_free_surface.setMaximumWidth(100) + + self.label_distance_from_ABS_to_free_surface_unit = QLabel() + self.label_distance_from_ABS_to_free_surface_unit.setText("m") + + self.pushbutton_distance_from_ABS_to_free_surface = QPushButton() + self.pushbutton_distance_from_ABS_to_free_surface.setIcon(self.icon_refresh) + self.label_temperature = QLabel("Temperature : ") # self.spinbox_temperature = QDoubleSpinBox() @@ -433,22 +450,22 @@ class AcousticDataTab(QWidget): # # self.formLayout_temperature.addRow(self.label_temperature, self.lineEdit_temperature) # # self.verticalLayout_groupbox_info.addLayout(self.formLayout_temperature) # # - # # self.gridLayout_goupbox_info = QGridLayout() - # # self.verticalLayout_groupbox_info.addLayout(self.gridLayout_goupbox_info) + # # 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_goupbox_info = QGridLayout() - # self.groupbox_info.setLayout(self.gridLayout_goupbox_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_goupbox_info = QGridLayout() - # # self.scrollbar_measurement_information.setLayout(self.gridLayout_goupbox_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() @@ -459,18 +476,18 @@ class AcousticDataTab(QWidget): # # layout.addWidget(scroll) # # self.label_temperature = QLabel("Temperature : ") - # # self.gridLayout_goupbox_info.addWidget(self.label_temperature, 0, 0, 1, 1) + # # 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_goupbox_info.addWidget(self.spinbox_temperature, 0, 1, 1, 1) + # # self.gridLayout_groupbox_info.addWidget(self.spinbox_temperature, 0, 1, 1, 1) # # self.label_degreCelsius = QLabel("°C") - # # self.gridLayout_goupbox_info.addWidget(self.label_degreCelsius, 0, 2, 1, 1) + # # self.gridLayout_groupbox_info.addWidget(self.label_degreCelsius, 0, 2, 1, 1) # # # self.label_date_acoustic_file = QLabel() - # # self.gridLayout_goupbox_info.addWidget(self.label_date_acoustic_file, 1, 0, 1, 2) + # # self.gridLayout_groupbox_info.addWidget(self.label_date_acoustic_file, 1, 0, 1, 2) # # self.label_hour_acoustic_file = QLabel() - # # self.gridLayout_goupbox_info.addWidget(self.label_hour_acoustic_file, 1, 1, 1, 1) + # # self.gridLayout_groupbox_info.addWidget(self.label_hour_acoustic_file, 1, 1, 1, 1) # # self.label_ABS_name = QLabel() # @@ -1291,8 +1308,8 @@ class AcousticDataTab(QWidget): 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_time) - self.fileListWidget.itemSelectionChanged.connect(self.compute_depth) + 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) @@ -1308,6 +1325,9 @@ class AcousticDataTab(QWidget): # 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) @@ -1315,7 +1335,7 @@ class AcousticDataTab(QWidget): 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_time) + # 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) @@ -1328,21 +1348,21 @@ class AcousticDataTab(QWidget): # self.doubleRangeSlider_recording_time.lab .connect(self.print_value_doubleRangeSlider) - self.pushbutton_apply_depth_limits.clicked.connect(self.set_rmin_rmax_for_doubleRangeSider_depth) - # self.pushbutton_apply_depth_limits.clicked.connect(self.compute_depth) + # 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.set_tmin_tmax_for_doubleRangeSider_time) - # self.pushbutton_apply_recording_time_limits.clicked.connect(self.compute_time) + # 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_time) + # 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) @@ -1519,6 +1539,11 @@ class AcousticDataTab(QWidget): self.label_date_acoustic_file.hide() self.label_hour_acoustic_file.hide() + self.label_distance_from_ABS_to_free_surface.hide() + self.lineEdit_distance_from_ABS_to_free_surface.hide() + self.label_distance_from_ABS_to_free_surface_unit.hide() + self.pushbutton_distance_from_ABS_to_free_surface.hide() + self.label_temperature.hide() # self.spinbox_temperature.hide() self.lineEdit_temperature.hide() @@ -1568,6 +1593,11 @@ class AcousticDataTab(QWidget): self.label_date_acoustic_file.hide() self.label_hour_acoustic_file.hide() + self.label_distance_from_ABS_to_free_surface.hide() + self.lineEdit_distance_from_ABS_to_free_surface.hide() + self.label_distance_from_ABS_to_free_surface_unit.hide() + self.pushbutton_distance_from_ABS_to_free_surface.hide() + self.label_temperature.hide() # self.spinbox_temperature.hide() self.lineEdit_temperature.hide() @@ -1610,10 +1640,10 @@ class AcousticDataTab(QWidget): self.lineEdit_tx.hide() self.checkbox_tx.hide() - for i in reversed(range(self.gridLayout_goupbox_info.count())): - widgetToRemove = self.gridLayout_goupbox_info.itemAt(i).widget() + for i in reversed(range(self.gridLayout_groupbox_info.count())): + widgetToRemove = self.gridLayout_groupbox_info.itemAt(i).widget() # remove it from the layout list - self.gridLayout_goupbox_info.removeWidget(widgetToRemove) + self.gridLayout_groupbox_info.removeWidget(widgetToRemove) # remove it from the gui widgetToRemove.setParent(None) @@ -1621,83 +1651,92 @@ class AcousticDataTab(QWidget): self.label_ABS_name.show() self.label_ABS_name.setText("Acoustic Backscatter System: AQUAscat") - self.gridLayout_goupbox_info.addWidget(self.label_ABS_name, 0, 0, 1, 2) + self.gridLayout_groupbox_info.addWidget(self.label_ABS_name, 0, 0, 1, 2) self.label_date_acoustic_file.show() - self.gridLayout_goupbox_info.addWidget(self.label_date_acoustic_file, 1, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_date_acoustic_file, 1, 0, 1, 1) self.label_hour_acoustic_file.show() - self.gridLayout_goupbox_info.addWidget(self.label_hour_acoustic_file, 1, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_hour_acoustic_file, 1, 1, 1, 1) + + self.label_distance_from_ABS_to_free_surface.show() + self.gridLayout_groupbox_info.addWidget(self.label_distance_from_ABS_to_free_surface, 2, 0, 1, 1) + self.lineEdit_distance_from_ABS_to_free_surface.show() + self.gridLayout_groupbox_info.addWidget(self.lineEdit_distance_from_ABS_to_free_surface, 2, 1, 1, 1) + self.label_distance_from_ABS_to_free_surface_unit.show() + self.gridLayout_groupbox_info.addWidget(self.label_distance_from_ABS_to_free_surface_unit, 2, 2, 1, 1) + self.pushbutton_distance_from_ABS_to_free_surface.show() + self.gridLayout_groupbox_info.addWidget(self.pushbutton_distance_from_ABS_to_free_surface, 2, 3, 1, 1) self.label_temperature.show() - self.gridLayout_goupbox_info.addWidget(self.label_temperature, 2, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_temperature, 3, 0, 1, 1) # self.spinbox_temperature.show() self.lineEdit_temperature.show() - self.gridLayout_goupbox_info.addWidget(self.lineEdit_temperature, 2, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_temperature, 3, 1, 1, 1) self.label_temperature_unit.show() - self.gridLayout_goupbox_info.addWidget(self.label_temperature_unit, 2, 2, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_info.addWidget(self.label_temperature_unit, 3, 2, 1, 1, Qt.AlignLeft) self.temperature_value() self.label_speed_of_sound.show() - self.gridLayout_goupbox_info.addWidget(self.label_speed_of_sound, 3, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_speed_of_sound, 4, 0, 1, 1) # self.spinbox_speed_of_sound.show() self.lineEdit_speed_of_sound.show() - self.gridLayout_goupbox_info.addWidget(self.lineEdit_speed_of_sound, 3, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_speed_of_sound, 4, 1, 1, 1) self.label_speed_of_sound_unit.show() - self.gridLayout_goupbox_info.addWidget(self.label_speed_of_sound_unit, 3, 2, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_info.addWidget(self.label_speed_of_sound_unit, 4, 2, 1, 1, Qt.AlignLeft) self.label_freq.show() - self.gridLayout_goupbox_info.addWidget(self.label_freq, 4, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_freq, 5, 0, 1, 1) self.combobox_frequency_information.show() - self.gridLayout_goupbox_info.addWidget(self.combobox_frequency_information, 4, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.combobox_frequency_information, 5, 1, 1, 1) self.label_kt.show() - self.gridLayout_goupbox_info.addWidget(self.label_kt, 5, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_kt, 6, 0, 1, 1) # self.spinbox_kt.show() self.lineEdit_kt.show() - self.gridLayout_goupbox_info.addWidget(self.lineEdit_kt, 5, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_kt, 6, 1, 1, 1) self.label_kt_unit.show() - self.gridLayout_goupbox_info.addWidget(self.label_kt_unit, 5, 2, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_info.addWidget(self.label_kt_unit, 6, 2, 1, 1, Qt.AlignLeft) self.checkbox_kt.show() - self.gridLayout_goupbox_info.addWidget(self.checkbox_kt, 5, 3, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_info.addWidget(self.checkbox_kt, 6, 3, 1, 1, Qt.AlignCenter) self.label_sound_attenuation.show() - self.gridLayout_goupbox_info.addWidget(self.label_sound_attenuation, 6, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_sound_attenuation, 7, 0, 1, 1) # self.spinbox_sound_attenuation.show() self.lineEdit_sound_attenuation.show() - self.gridLayout_goupbox_info.addWidget(self.lineEdit_sound_attenuation, 6, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_sound_attenuation, 7, 1, 1, 1) self.label_sound_attenuation_unit.show() - self.gridLayout_goupbox_info.addWidget(self.label_sound_attenuation_unit, 6, 2, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_info.addWidget(self.label_sound_attenuation_unit, 7, 2, 1, 1, Qt.AlignLeft) self.label_profiles.show() - self.gridLayout_goupbox_info.addWidget(self.label_profiles, 7, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles, 8, 0, 1, 1) self.label_profiles_per_sec.show() - self.gridLayout_goupbox_info.addWidget(self.label_profiles_per_sec, 8, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles_per_sec, 9, 0, 1, 1) self.label_cells.show() - self.gridLayout_goupbox_info.addWidget(self.label_cells, 9, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cells, 10, 0, 1, 1) self.label_cell_size.show() - self.gridLayout_goupbox_info.addWidget(self.label_cell_size, 10, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cell_size, 11, 0, 1, 1) self.label_pulse_length.show() - self.gridLayout_goupbox_info.addWidget(self.label_pulse_length, 11, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pulse_length, 12, 0, 1, 1) self.label_pings_per_sec.show() - self.gridLayout_goupbox_info.addWidget(self.label_pings_per_sec, 12, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_sec, 13, 0, 1, 1) self.label_pings_per_profile.show() - self.gridLayout_goupbox_info.addWidget(self.label_pings_per_profile, 13, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_profile, 14, 0, 1, 1) self.label_rx.show() - self.gridLayout_goupbox_info.addWidget(self.label_rx, 14, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_rx, 15, 0, 1, 1) # self.spinbox_rx.show() self.lineEdit_rx.show() - self.gridLayout_goupbox_info.addWidget(self.lineEdit_rx, 14, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_rx, 15, 1, 1, 1) self.checkbox_rx.show() - self.gridLayout_goupbox_info.addWidget(self.checkbox_rx, 14, 3, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_info.addWidget(self.checkbox_rx, 15, 3, 1, 1, Qt.AlignCenter) self.label_tx.show() - self.gridLayout_goupbox_info.addWidget(self.label_tx, 15, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_tx, 16, 0, 1, 1) # self.spinbox_tx.show() self.lineEdit_tx.show() - self.gridLayout_goupbox_info.addWidget(self.lineEdit_tx, 15, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_tx, 16, 1, 1, 1) self.checkbox_tx.show() - self.gridLayout_goupbox_info.addWidget(self.checkbox_tx, 15, 3, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_info.addWidget(self.checkbox_tx, 16, 3, 1, 1, Qt.AlignCenter) def groupbox_measurement_information_UBSediFlow(self): # --- Hide Aquascat information --- @@ -1706,6 +1745,11 @@ class AcousticDataTab(QWidget): self.label_date_acoustic_file.hide() self.label_hour_acoustic_file.hide() + self.label_distance_from_ABS_to_free_surface.hide() + self.lineEdit_distance_from_ABS_to_free_surface.hide() + self.label_distance_from_ABS_to_free_surface_unit.hide() + self.pushbutton_distance_from_ABS_to_free_surface.hide() + self.label_temperature.hide() # self.spinbox_temperature.hide() self.lineEdit_temperature.hide() @@ -1748,92 +1792,160 @@ class AcousticDataTab(QWidget): self.lineEdit_tx.hide() self.checkbox_tx.hide() - for i in reversed(range(self.gridLayout_goupbox_info.count())): - widgetToRemove = self.gridLayout_goupbox_info.itemAt(i).widget() + for i in reversed(range(self.gridLayout_groupbox_info.count())): + widgetToRemove = self.gridLayout_groupbox_info.itemAt(i).widget() # remove it from the layout list - self.gridLayout_goupbox_info.removeWidget(widgetToRemove) + self.gridLayout_groupbox_info.removeWidget(widgetToRemove) # remove it from the gui widgetToRemove.setParent(None) # --- Show UBSediFlow information --- self.label_ABS_name.show() self.label_ABS_name.setText("Acoustic Backscatter System: UBSediFlow") - self.gridLayout_goupbox_info.addWidget(self.label_ABS_name, 0, 0, 1, 2) + self.gridLayout_groupbox_info.addWidget(self.label_ABS_name, 0, 0, 1, 2) self.label_date_acoustic_file.show() - self.gridLayout_goupbox_info.addWidget(self.label_date_acoustic_file, 1, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_date_acoustic_file, 1, 0, 1, 1) self.label_hour_acoustic_file.show() - self.gridLayout_goupbox_info.addWidget(self.label_hour_acoustic_file, 1, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_hour_acoustic_file, 1, 1, 1, 1) + + self.label_distance_from_ABS_to_free_surface.show() + self.gridLayout_groupbox_info.addWidget(self.label_distance_from_ABS_to_free_surface, 2, 0, 1, 1) + self.lineEdit_distance_from_ABS_to_free_surface.show() + self.gridLayout_groupbox_info.addWidget(self.lineEdit_distance_from_ABS_to_free_surface, 2, 1, 1, 1) + self.label_distance_from_ABS_to_free_surface_unit.show() + self.gridLayout_groupbox_info.addWidget(self.label_distance_from_ABS_to_free_surface_unit, 2, 2, 1, 1) + self.pushbutton_distance_from_ABS_to_free_surface.show() + self.gridLayout_groupbox_info.addWidget(self.pushbutton_distance_from_ABS_to_free_surface, 2, 3, 1, 1) self.label_temperature.show() - self.gridLayout_goupbox_info.addWidget(self.label_temperature, 2, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_temperature, 3, 0, 1, 1) # self.spinbox_temperature.show() self.lineEdit_temperature.show() - self.gridLayout_goupbox_info.addWidget(self.lineEdit_temperature, 2, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_temperature, 3, 1, 1, 1) self.label_temperature_unit.show() - self.gridLayout_goupbox_info.addWidget(self.label_temperature_unit, 2, 2, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_info.addWidget(self.label_temperature_unit, 3, 2, 1, 1, Qt.AlignLeft) self.label_speed_of_sound.show() - self.gridLayout_goupbox_info.addWidget(self.label_speed_of_sound, 3, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_speed_of_sound, 4, 0, 1, 1) # self.spinbox_speed_of_sound.show() self.lineEdit_speed_of_sound.show() - self.gridLayout_goupbox_info.addWidget(self.lineEdit_speed_of_sound, 3, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_speed_of_sound, 4, 1, 1, 1) self.label_speed_of_sound_unit.show() - self.gridLayout_goupbox_info.addWidget(self.label_speed_of_sound_unit, 3, 2, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_info.addWidget(self.label_speed_of_sound_unit, 4, 2, 1, 1, Qt.AlignLeft) self.label_freq.show() - self.gridLayout_goupbox_info.addWidget(self.label_freq, 4, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_freq, 5, 0, 1, 1) self.combobox_frequency_information.show() - self.gridLayout_goupbox_info.addWidget(self.combobox_frequency_information, 4, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.combobox_frequency_information, 5, 1, 1, 1) self.label_kt.show() - self.gridLayout_goupbox_info.addWidget(self.label_kt, 5, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_kt, 6, 0, 1, 1) # self.spinbox_kt.show() self.lineEdit_kt.show() - self.gridLayout_goupbox_info.addWidget(self.lineEdit_kt, 5, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_kt, 6, 1, 1, 1) self.label_kt_unit.show() - self.gridLayout_goupbox_info.addWidget(self.label_kt_unit, 5, 2, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_info.addWidget(self.label_kt_unit, 6, 2, 1, 1, Qt.AlignLeft) self.checkbox_kt.show() - self.gridLayout_goupbox_info.addWidget(self.checkbox_kt, 5, 3, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_info.addWidget(self.checkbox_kt, 6, 3, 1, 1, Qt.AlignCenter) self.label_sound_attenuation.show() - self.gridLayout_goupbox_info.addWidget(self.label_sound_attenuation, 6, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_sound_attenuation, 7, 0, 1, 1) # self.spinbox_sound_attenuation.show() self.lineEdit_sound_attenuation.show() - self.gridLayout_goupbox_info.addWidget(self.lineEdit_sound_attenuation, 6, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_sound_attenuation, 7, 1, 1, 1) self.label_sound_attenuation_unit.show() - self.gridLayout_goupbox_info.addWidget(self.label_sound_attenuation_unit, 6, 2, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_info.addWidget(self.label_sound_attenuation_unit, 7, 2, 1, 1, Qt.AlignLeft) self.label_profiles.show() - self.gridLayout_goupbox_info.addWidget(self.label_profiles, 7, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles, 8, 0, 1, 1) self.label_profiles_per_sec.show() - self.gridLayout_goupbox_info.addWidget(self.label_profiles_per_sec, 8, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles_per_sec, 9, 0, 1, 1) self.label_cells.show() - self.gridLayout_goupbox_info.addWidget(self.label_cells, 9, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cells, 10, 0, 1, 1) self.label_cell_size.show() - self.gridLayout_goupbox_info.addWidget(self.label_cell_size, 10, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cell_size, 11, 0, 1, 1) self.label_pulse_length.show() - self.gridLayout_goupbox_info.addWidget(self.label_pulse_length, 11, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pulse_length, 12, 0, 1, 1) self.label_pings_per_sec.show() - self.gridLayout_goupbox_info.addWidget(self.label_pings_per_sec, 12, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_sec, 13, 0, 1, 1) self.label_pings_per_profile.show() - self.gridLayout_goupbox_info.addWidget(self.label_pings_per_profile, 13, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_profile, 14, 0, 1, 1) self.label_rx.show() - self.gridLayout_goupbox_info.addWidget(self.label_rx, 14, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_rx, 15, 0, 1, 1) # self.spinbox_rx.show() self.lineEdit_rx.hide() - self.gridLayout_goupbox_info.addWidget(self.lineEdit_rx, 14, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_rx, 15, 1, 1, 1) self.checkbox_rx.show() - self.gridLayout_goupbox_info.addWidget(self.checkbox_rx, 14, 3, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_info.addWidget(self.checkbox_rx, 15, 3, 1, 1, Qt.AlignCenter) self.label_tx.show() - self.gridLayout_goupbox_info.addWidget(self.label_tx, 15, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_tx, 16, 0, 1, 1) # self.spinbox_tx.show() self.lineEdit_tx.show() - self.gridLayout_goupbox_info.addWidget(self.lineEdit_tx, 15, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_tx, 16, 1, 1, 1) self.checkbox_tx.show() - self.gridLayout_goupbox_info.addWidget(self.checkbox_tx, 15, 2, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_info.addWidget(self.checkbox_tx, 16, 2, 1, 1, Qt.AlignCenter) + + def distance_from_ABS_to_free_surface(self): + if self.fileListWidget.count() == 0: + + msgBox = QMessageBox() + msgBox.setWindowTitle("Distance ABS - Free surface Error") + msgBox.setIcon(QMessageBox.Warning) + msgBox.setText("Upload data before setting distance ABS - Free surface") + msgBox.setStandardButtons(QMessageBox.Ok) + msgBox.exec() + + self.lineEdit_distance_from_ABS_to_free_surface.setText("0.00") + + else: + + stg.distance_from_ABS_to_free_surface[self.fileListWidget.currentRow()] = ( + float(self.lineEdit_distance_from_ABS_to_free_surface.text().replace(",", "."))) + self.lineEdit_distance_from_ABS_to_free_surface.setText( + str("%4s" % stg.distance_from_ABS_to_free_surface[self.fileListWidget.currentRow()])) + + def refresh_distance_from_ABS_to_free_surface(self): + + acoustic_data = AcousticDataLoader(stg.path_BS_raw_data[self.fileListWidget.currentRow()] + "/" + + stg.filename_BS_raw_data[self.fileListWidget.currentRow()]) + + 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()]) + + 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()] + + self.fill_table() + + self.compute_rmin_rmax() + 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()) @@ -2386,6 +2498,7 @@ class AcousticDataTab(QWidget): stg.freq_text.append(acoustic_data._freq_text) stg.date.append(acoustic_data._date) stg.hour.append(acoustic_data._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) stg.nb_cells.append(acoustic_data._nb_cells) @@ -2501,11 +2614,11 @@ class AcousticDataTab(QWidget): self.label_date_acoustic_file.clear() self.label_date_acoustic_file.setText("Date: " + str(stg.date[self.fileListWidget.currentRow()])) - self.gridLayout_goupbox_info.addWidget(self.label_date_acoustic_file, 1, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_date_acoustic_file, 1, 0, 1, 1) self.label_hour_acoustic_file.clear() self.label_hour_acoustic_file.setText("Hour: " + str(stg.hour[self.fileListWidget.currentRow()])) - self.gridLayout_goupbox_info.addWidget(self.label_hour_acoustic_file, 1, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_hour_acoustic_file, 1, 1, 1, 1) self.combobox_frequency_information.clear() self.combobox_frequency_information.addItems(stg.freq_text[self.fileListWidget.currentRow()]) @@ -2516,31 +2629,31 @@ class AcousticDataTab(QWidget): self.label_profiles_value.setText(str(stg.nb_profiles[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()])) - self.gridLayout_goupbox_info.addWidget(self.label_profiles_value, 7, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles_value, 7, 1, 1, 1) self.label_profiles_per_sec_value.setText(str(stg.nb_profiles_per_sec[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()]) + " Hz") - self.gridLayout_goupbox_info.addWidget(self.label_profiles_per_sec_value, 8, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles_per_sec_value, 8, 1, 1, 1) self.label_cells_value.setText(str(stg.nb_cells[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()])) - self.gridLayout_goupbox_info.addWidget(self.label_cells_value, 9, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cells_value, 9, 1, 1, 1) self.label_cell_size_value.setText(str(100*round(stg.cell_size[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()], 3)) + " cm") - self.gridLayout_goupbox_info.addWidget(self.label_cell_size_value, 10, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cell_size_value, 10, 1, 1, 1) self.label_pulse_length_value.setText(str(round(stg.pulse_length[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()], 6)) + " sec") - self.gridLayout_goupbox_info.addWidget(self.label_pulse_length_value, 11, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pulse_length_value, 11, 1, 1, 1) self.label_pings_per_sec_value.setText(str(stg.nb_pings_per_sec[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()]) + " Hz") - self.gridLayout_goupbox_info.addWidget(self.label_pings_per_sec_value, 12, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_sec_value, 12, 1, 1, 1) self.label_pings_per_profile_value.setText(str(stg.nb_pings_averaged_per_profile[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()])) - self.gridLayout_goupbox_info.addWidget(self.label_pings_per_profile_value, 13, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_profile_value, 13, 1, 1, 1) if self.combobox_ABS_system_choice.currentText() == "Aquascat 1000R": # stg.kt_corrected = stg.kt_read @@ -2595,14 +2708,14 @@ class AcousticDataTab(QWidget): # 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_goupbox_info.addWidget(self.spinbox_freq_" + str(int(fval)) + ", 6, " + str(find+1) + ", 1, 1)") - # self.gridLayout_goupbox_info.addWidget(stg.freq_text[self.fileListWidget.currentIndex().row()]) + # 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_goupbox_info.addWidget(', '.join(map(str, stg.kt[self.fileListWidget.currentRow()]))) + # self.gridLayout_groupbox_info.addWidget(', '.join(map(str, stg.kt[self.fileListWidget.currentRow()]))) - # self.gridLayout_goupbox_info.addWidget(', '.join(map(str, stg.gain_rx[self.fileListWidget.currentRow()]))) + # self.gridLayout_groupbox_info.addWidget(', '.join(map(str, stg.gain_rx[self.fileListWidget.currentRow()]))) - # self.gridLayout_goupbox_info.addWidget(', '.join(map(str, stg.gain_tx[self.fileListWidget.currentRow()]))) + # self.gridLayout_groupbox_info.addWidget(', '.join(map(str, stg.gain_tx[self.fileListWidget.currentRow()]))) @@ -2612,9 +2725,9 @@ class AcousticDataTab(QWidget): # # _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_goupbox_info.addWidget(self.label_freq, 0, 0, 1, 1) + # 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_goupbox_info.addWidget(self.label_freq, 0, 1, 1, 1) + # 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()]) @@ -2623,40 +2736,40 @@ class AcousticDataTab(QWidget): # self.label_profiles_value.clear() # self.label_profiles_value.setText(str(stg.nb_profiles[self.fileListWidget.currentRow()] # [self.combobox_frequency_information.currentIndex()])) - # self.gridLayout_goupbox_info.addWidget(self.label_profiles_value, 3, 1, 1, 1) + # 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_goupbox_info.addWidget(self.label_profiles_per_sec_value, 4, 1, 1, 1) + # 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_goupbox_info.addWidget(self.label_cells_value, 5, 1, 1, 1) + # 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_goupbox_info.addWidget(self.label_cell_size_value, 6, 1, 1, 1) + # 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_goupbox_info.addWidget(self.label_pulse_length_value, 7, 1, 1, 1) + # 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_goupbox_info.addWidget(self.label_pings_per_sec_value, 8, 1, 1, 1) + # 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_goupbox_info.addWidget(self.label_pings_per_profile_value, 9, 1, 1, 1) + # 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()]) @@ -2690,45 +2803,45 @@ class AcousticDataTab(QWidget): self.combobox_frequency_information.currentIndex()])) self.label_profiles_value.clear() - self.gridLayout_goupbox_info.removeWidget(self.label_profiles_value) + self.gridLayout_groupbox_info.removeWidget(self.label_profiles_value) self.label_profiles_value.setText(str(stg.nb_profiles[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()])) - self.gridLayout_goupbox_info.addWidget(self.label_profiles_value, 7, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles_value, 7, 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_goupbox_info.addWidget(self.label_profiles_per_sec_value, 8, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles_per_sec_value, 8, 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_goupbox_info.addWidget(self.label_cells_value, 9, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cells_value, 9, 1, 1, 1) self.label_cell_size_value.clear() - self.gridLayout_goupbox_info.removeWidget(self.label_cell_size_value) + self.gridLayout_groupbox_info.removeWidget(self.label_cell_size_value) self.label_cell_size_value.setText( str(100 * round(stg.cell_size[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()], 3)) + " cm") - self.gridLayout_goupbox_info.addWidget(self.label_cell_size_value, 10, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cell_size_value, 10, 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_goupbox_info.addWidget(self.label_pulse_length_value, 11, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pulse_length_value, 11, 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_goupbox_info.addWidget(self.label_pings_per_sec_value, 12, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_sec_value, 12, 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_goupbox_info.addWidget(self.label_pings_per_profile_value, 13, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_profile_value, 13, 1, 1, 1) print("stg.kt_corrected ", stg.kt_corrected) print("self.combobox_frequency_information.currentText()", @@ -2962,15 +3075,13 @@ class AcousticDataTab(QWidget): # self.groupbox_xaxis_time.setDisabled(False) # self.groupbox_xaxis_space.setDisabled(True) - def compute_time(self): + 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()) - # if stg.time_cross_section[self.fileListWidget.currentRow()].shape == (0,): - # --- tmim / tmax --- tmin_indice = np.where(np.abs(stg.time[self.fileListWidget.currentRow()][0, :] - np.nanmin( stg.time[self.fileListWidget.currentRow()][0, :])) == @@ -2988,179 +3099,27 @@ class AcousticDataTab(QWidget): tmax_value = np.round(np.nanmax(stg.time[self.fileListWidget.currentRow()][0, :]), 2) stg.tmax[self.fileListWidget.currentRow()] = (tmax_indice + 1, tmax_value) - # else: - # - # # --- tmim / tmax --- - # tmin_indice = np.where(np.abs(stg.time[self.fileListWidget.currentRow()][0, :] - np.nanmin( - # stg.time[self.fileListWidget.currentRow()][0, :])) == - # np.nanmin(np.abs(stg.time[self.fileListWidget.currentRow()][0, :] - np.nanmin( - # stg.time[self.fileListWidget.currentRow()][0, :]))))[0][0] - # 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( - # stg.time[self.fileListWidget.currentRow()][0, :]))))[0][0] - # tmax_value = np.round(np.nanmax(stg.time[self.fileListWidget.currentRow()][0, :]), 2) - # stg.tmax[self.fileListWidget.currentRow()] = (tmax_indice + 1, tmax_value) + self.set_range_for_time_boundaries_option() - - # print(f" tmax_indice = {tmax_indice} , tmax_value = {tmax_value}") - # - # print("stg.time ", stg.time[self.fileListWidget.currentRow()][:, 0:4499]) - # print("stg.tmin[self.fileListWidget.currentRow()][0] ", stg.tmin[self.fileListWidget.currentRow()][0]) - # print("stg.tmax[self.fileListWidget.currentRow()][0] ", stg.tmax[self.fileListWidget.currentRow()][0]) - - # --- time_cross_section --- - # 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(f"time cross section = {stg.time_cross_section[0].shape}") - - self.set_range_for_doubleRangeSlider_time() - - # if ((self.fileListWidget.count() == 1) and (len(stg.tmax) == 0)): - # - # print("Config 1 : time") - # - # # --- tmim / tmax --- - # tmin_indice = np.where(np.abs(stg.time[self.fileListWidget.currentRow()][0, :] - np.nanmin( - # stg.time[self.fileListWidget.currentRow()][0, :])) == - # np.nanmin(np.abs(stg.time[self.fileListWidget.currentRow()][0, :] - np.nanmin( - # stg.time[self.fileListWidget.currentRow()][0, :]))))[0][0] - # tmin_value = np.round(np.nanmin(stg.time[self.fileListWidget.currentRow()][0, :]), 2) - # stg.tmin = [(tmin_indice, 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( - # stg.time[self.fileListWidget.currentRow()][0, :]))))[0][0] - # tmax_value = np.round(np.nanmax(stg.time[self.fileListWidget.currentRow()][0, :]), 2) - # stg.tmax = [(tmax_indice+1, tmax_value)] - # - # print(f" tmin = {stg.tmin} , tmax = {stg.tmax}") - # - # # --- time_cross_section --- - # stg.time_cross_section = [stg.time[self.fileListWidget.currentRow()][:, - # stg.tmin[self.fileListWidget.currentRow()][0]:stg.tmax[self.fileListWidget.currentRow()][0]]] - # print(f"t = {stg.time_cross_section}") - # - # # --- spinbox tmin / tmax --- - # # self.spinbox_tmin.setValue(stg.time_cross_section[self.fileListWidget.currentRow()][0, stg.tmin[self.fileListWidget.currentRow()][0]]) - # # self.spinbox_tmax.setValue(stg.time_cross_section[self.fileListWidget.currentRow()][0, stg.tmax[self.fileListWidget.currentRow()][0]-1]) - # - # # self.doubleRangeSlider_recording_time.update() - # # self.doubleRangeSlider_recording_time.setValue((0, 500)) - # # (stg.time_cross_section[self.fileListWidget.currentRow()][0, stg.tmin[self.fileListWidget.currentRow()][0]], - # # stg.time_cross_section[self.fileListWidget.currentRow()][0, stg.tmax[self.fileListWidget.currentRow()][0]-1])) - # - # - # print("self.doubleRangeSlider_recording_time ", self.doubleRangeSlider_recording_time.value()) - # - # elif len(stg.tmax) < self.fileListWidget.count(): - # - # print("Config 2 : time") - # - # # --- tmim / tmax --- - # tmin_indice = np.where(np.abs(stg.time[self.fileListWidget.currentRow()][0, :] - np.nanmin( - # stg.time[self.fileListWidget.currentRow()][0, :])) == - # np.nanmin(np.abs(stg.time[self.fileListWidget.currentRow()][0, :] - np.nanmin( - # stg.time[self.fileListWidget.currentRow()][0, :]))))[0][0] - # tmin_value = np.round(np.nanmin(stg.time[self.fileListWidget.currentRow()][0, :]), 2) - # 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( - # stg.time[self.fileListWidget.currentRow()][0, :]))))[0][0] - # tmax_value = np.round(np.nanmax(stg.time[self.fileListWidget.currentRow()][0, :]), 2) - # print(f" tmax_indice = {tmax_indice} , tmax_value = {tmax_value}") - # - # print(f" tmin = {stg.tmin} , tmax = {stg.tmax}") - # stg.tmin.append((tmin_indice, tmin_value)) - # stg.tmax.append((tmax_indice+1, tmax_value)) - # print(f" tmin = {stg.tmin} , tmax = {stg.tmax}") - # - # # --- time_cross_section --- - # stg.time_cross_section = stg.time_cross_section + [stg.time[self.fileListWidget.currentRow()][:, - # stg.tmin[self.fileListWidget.currentRow()][0]: - # stg.tmax[self.fileListWidget.currentRow()][0]]] - # - # # --- spinbox tmin / tmax --- - # # self.spinbox_tmin.setValue(stg.time_cross_section[self.fileListWidget.currentRow()][0, stg.tmin[self.fileListWidget.currentRow()][0]]) - # # self.spinbox_tmax.setValue(stg.time_cross_section[self.fileListWidget.currentRow()][0, stg.tmax[self.fileListWidget.currentRow()][0]-1]) - # - # # self.doubleRangeSlider_recording_time.setValue(value=( - # # stg.time_cross_section[self.fileListWidget.currentRow()][0, stg.tmin[self.fileListWidget.currentRow()][0]], - # # stg.time_cross_section[self.fileListWidget.currentRow()][0, stg.tmax[self.fileListWidget.currentRow()][0]-1])) - # - # print("self.doubleRangeSlider_recording_time ", self.doubleRangeSlider_recording_time.value()) - # - # else: - # print("-----------------") - # print("Config 3 : time") - # print("-----------------") - # - # self.set_range_for_doubleRangeSlider_time() - # - # # --- spinbox tmin / tmax --- - # # self.spinbox_tmin.setValue( - # # stg.time_cross_section[self.fileListWidget.currentRow()][0, stg.tmin[self.fileListWidget.currentRow()][0]]) - # # self.spinbox_tmax.setValue(stg.time_cross_section[self.fileListWidget.currentRow()][ - # # 0, stg.tmax[self.fileListWidget.currentRow()][0]-1]) - # - # # print("tmin = ", stg.tmin) - # # print("tmax = ", stg.tmax) - # # print("list Widget : ", self.fileListWidget.currentRow()) - # # print("stg.tmin[self.fileListWidget.currentRow()][0] ", stg.tmin[self.fileListWidget.currentRow()][0]) - # # print("stg.tmax[self.fileListWidget.currentRow()][0] - 1 ", stg.tmax[self.fileListWidget.currentRow()][0]-1) - # # - # # print("time_cross_section min ", stg.time_cross_section[self.fileListWidget.currentRow()][ - # # 0, stg.tmin[self.fileListWidget.currentRow()][0]]) - # # print("time_cross_section max ", stg.time_cross_section[self.fileListWidget.currentRow()][ - # # 0, stg.tmax[self.fileListWidget.currentRow()][0]]) - # # # self.doubleRangeSlider_recording_time.setValue(value=(stg.tmin[self.fileListWidget.currentRow()][1], stg.tmax[self.fileListWidget.currentRow()][1])) - # # - # # self.doubleRangeSlider_recording_time.setValue(value=( - # # stg.time_cross_section[self.fileListWidget.currentRow()][0, stg.tmin[self.fileListWidget.currentRow()][0]], - # # stg.time_cross_section[self.fileListWidget.currentRow()][0, stg.tmax[self.fileListWidget.currentRow()][0]-1] - # # )) - # # - # # print("self.doubleRangeSlider_recording_time ", self.doubleRangeSlider_recording_time.value()) - - def set_range_for_doubleRangeSlider_time(self): + def set_range_for_time_boundaries_option(self): self.label_time_min.clear() - self.label_time_min.setText(str(stg.time[self.fileListWidget.currentRow()][0, 0])) + self.label_time_min.setText("%.5s" % str(stg.time[self.fileListWidget.currentRow()][0, 0])) self.label_time_max.clear() - self.label_time_max.setText(str(stg.time[self.fileListWidget.currentRow()][0, -1])) + self.label_time_max.setText("%.5s" % str(stg.time[self.fileListWidget.currentRow()][0, -1])) if stg.time_cross_section[self.fileListWidget.currentRow()].shape != (0,): - self.lineEdit_time_min_limits.setText(str(stg.time_cross_section[self.fileListWidget.currentRow()][0, 0])) - self.lineEdit_time_max_limits.setText(str(stg.time_cross_section[self.fileListWidget.currentRow()][0, -1])) + self.lineEdit_time_min_limits.setText("%.5s" % str(stg.time_cross_section[self.fileListWidget.currentRow()][0, 0])) + self.lineEdit_time_max_limits.setText("%.5s" % str(stg.time_cross_section[self.fileListWidget.currentRow()][0, -1])) else: - self.lineEdit_time_min_limits.setText(str(stg.time[self.fileListWidget.currentRow()][0, 0])) - self.lineEdit_time_max_limits.setText(str(stg.time[self.fileListWidget.currentRow()][0, -1])) + self.lineEdit_time_min_limits.setText("%.5s" % str(stg.time[self.fileListWidget.currentRow()][0, 0])) + self.lineEdit_time_max_limits.setText("%.5s" % str(stg.time[self.fileListWidget.currentRow()][0, -1])) - # self.doubleRangeSlider_recording_time.setRange(min=stg.time[self.fileListWidget.currentRow()][0, 0], - # max=stg.time[self.fileListWidget.currentRow()][0, -1]) - # - # if stg.time_cross_section[self.fileListWidget.currentRow()].shape == (0,): - # self.doubleRangeSlider_recording_time.setValue(value=(stg.time[self.fileListWidget.currentRow()][0, 0], - # stg.time[self.fileListWidget.currentRow()][0, -1])) - # else: - # self.doubleRangeSlider_recording_time.setValue(value=(stg.time_cross_section[self.fileListWidget.currentRow()][0, 0], - # stg.time_cross_section[self.fileListWidget.currentRow()][0, -1])) - - - def set_tmin_tmax_for_doubleRangeSider_time(self): + def compute_time_cross_section(self): ''' tmin and tmax are updated with double slider of time ''' @@ -3182,67 +3141,17 @@ class AcousticDataTab(QWidget): )) print("tmax = ", stg.tmax) - # def time_spin_box_value(self): - # - # if Qt.Key_Return: - # - # stg.tmax[self.fileListWidget.currentRow()] = (( - # np.where(np.abs(np.round(stg.time_cross_section[self.fileListWidget.currentRow()][0, :], 2) - self.spinbox_tmax.value()) == - # np.nanmin(np.abs(np.round(stg.time_cross_section[self.fileListWidget.currentRow()][0, :], - # 2) - self.spinbox_tmax.value())))[0][0], - # self.spinbox_tmax.value() - # )) - # 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]] - # ) + stg.time_cross_section[self.fileListWidget.currentRow()] = ( + stg.time[self.fileListWidget.currentRow()][:, stg.tmin[self.fileListWidget.currentRow()][0]: + stg.tmax[self.fileListWidget.currentRow()][0]] + ) - def compute_depth(self): + 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 ''' - # if self.fileListWidget.currentRow() != -1: - # print("self.fileListWidget.currentRow() ", self.fileListWidget.currentRow()) - - # if stg.depth_cross_section[self.fileListWidget.currentRow()].shape == (0,): - # - # # --- tmim / tmax --- - # tmin_indice = np.where(np.abs(stg.time[self.fileListWidget.currentRow()][0, :] - np.nanmin( - # stg.time[self.fileListWidget.currentRow()][0, :])) == - # np.nanmin(np.abs(stg.time[self.fileListWidget.currentRow()][0, :] - np.nanmin( - # stg.time[self.fileListWidget.currentRow()][0, :]))))[0][0] - # 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( - # stg.time[self.fileListWidget.currentRow()][0, :]))))[0][0] - # tmax_value = np.round(np.nanmax(stg.time[self.fileListWidget.currentRow()][0, :]), 2) - # stg.tmax[self.fileListWidget.currentRow()] = (tmax_indice + 1, tmax_value) - # - # else: - # - # # --- tmim / tmax --- - # tmin_indice = np.where(np.abs(stg.time[self.fileListWidget.currentRow()][0, :] - np.nanmin( - # stg.time[self.fileListWidget.currentRow()][0, :])) == - # np.nanmin(np.abs(stg.time[self.fileListWidget.currentRow()][0, :] - np.nanmin( - # stg.time[self.fileListWidget.currentRow()][0, :]))))[0][0] - # 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( - # stg.time[self.fileListWidget.currentRow()][0, :]))))[0][0] - # tmax_value = np.round(np.nanmax(stg.time[self.fileListWidget.currentRow()][0, :]), 2) - # stg.tmax[self.fileListWidget.currentRow()] = (tmax_indice + 1, tmax_value) - if self.fileListWidget.currentRow() != -1: # --- rmim / rmax --- @@ -3264,91 +3173,25 @@ class AcousticDataTab(QWidget): print(f" rmax_indice = {rmax_indice} , rmax_value = {rmax_value}") - # # --- depth_cross_section --- - # - # stg.depth_cross_section[self.fileListWidget.currentRow()] = \ - # stg.depth[self.fileListWidget.currentRow()][:, stg.rmin[self.fileListWidget.currentRow()][0]: - # stg.rmax[self.fileListWidget.currentRow()][0]] + self.set_range_for_depth_boundaries_option() - # print(f"depth cross section = {stg.depth_cross_section}") - - self.set_range_for_doubleRangeSlider_depth() - - # if ((self.fileListWidget.count() == 1) and (len(stg.rmax) == 0)): - # - # # --- rmim / rmax --- - # rmin_indice = np.where(np.abs(stg.depth[self.fileListWidget.currentRow()][0, :] - np.nanmin( - # stg.depth[self.fileListWidget.currentRow()][0, :])) == - # np.nanmin(np.abs(stg.depth[self.fileListWidget.currentRow()][0, :] - np.nanmin( - # stg.depth[self.fileListWidget.currentRow()][0, :]))))[0][0] - # rmin_value = np.round(np.nanmin(stg.depth[self.fileListWidget.currentRow()][0, :]), 2) - # stg.rmin = [(rmin_indice, 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( - # stg.depth[self.fileListWidget.currentRow()][0, :]))))[0][0] - # rmax_value = np.round(np.nanmax(stg.depth[self.fileListWidget.currentRow()][0, :]), 2) - # stg.rmax = [(rmax_indice+1, rmax_value)] - # - # # --- depth_cross_section --- - # stg.depth_cross_section = [stg.depth[self.fileListWidget.currentRow()][:, - # stg.rmin[self.fileListWidget.currentRow()][0]: - # stg.rmax[self.fileListWidget.currentRow()][0]]] - # print("Config 1 : depth") - # print("rmin ", stg.rmin) - # print("rmax ", stg.rmax) - # - # elif len(stg.rmax) < self.fileListWidget.count(): - # - # # --- rmim / rmax --- - # rmin_indice = np.where(np.abs(stg.depth[self.fileListWidget.currentRow()][0, :] - np.nanmin( - # stg.depth[self.fileListWidget.currentRow()][0, :])) == - # np.nanmin(np.abs(stg.depth[self.fileListWidget.currentRow()][0, :] - np.nanmin( - # stg.depth[self.fileListWidget.currentRow()][0, :]))))[0][0] - # rmin_value = np.round(np.nanmin(stg.depth[self.fileListWidget.currentRow()][0, :]), 2) - # - # 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( - # stg.depth[self.fileListWidget.currentRow()][0, :]))))[0][0] - # rmax_value = np.round(np.nanmax(stg.depth[self.fileListWidget.currentRow()][0, :]), 2) - # - # stg.rmin.append((rmin_indice, rmin_value)) - # stg.rmax.append((rmax_indice+1, rmax_value)) - # - # # --- depth_cross_section --- - # stg.depth_cross_section = stg.depth_cross_section + [stg.depth[self.fileListWidget.currentRow()][:, - # stg.rmin[self.fileListWidget.currentRow()][0]: - # stg.rmax[self.fileListWidget.currentRow()][0]]] - # print("Config 2 : depth") - # print("rmin ", stg.rmin) - # print("rmax ", stg.rmax) - # - # else: - # - # self.set_range_for_doubleRangeSlider_depth() - # print("Config 3 : depth") - # print("rmin ", stg.rmin) - # print("rmax ", stg.rmax) - - def set_range_for_doubleRangeSlider_depth(self): + def set_range_for_depth_boundaries_option(self): self.label_depth_min.clear() - self.label_depth_min.setText("-" + str(stg.depth[self.fileListWidget.currentRow()][0, -1])) + self.label_depth_min.setText("-" + str("%.5s" % stg.depth[self.fileListWidget.currentRow()][0, -1])) self.label_depth_max.clear() - self.label_depth_max.setText("-" + str(stg.depth[self.fileListWidget.currentRow()][0, 0])) + self.label_depth_max.setText("-" + str("%.5s" % stg.depth[self.fileListWidget.currentRow()][0, 0])) - if stg.time_cross_section[self.fileListWidget.currentRow()].shape != (0,): - - self.lineEdit_depth_min_limits.setText("-" + str(stg.depth_cross_section[self.fileListWidget.currentRow()][0, -1])) - self.lineEdit_depth_max_limits.setText("-" + str(stg.depth_cross_section[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])) else: - self.lineEdit_depth_min_limits.setText("-" + str(stg.depth[self.fileListWidget.currentRow()][0, -1])) - self.lineEdit_depth_max_limits.setText("-" + str(stg.depth[self.fileListWidget.currentRow()][0, 0])) + 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]) @@ -3363,86 +3206,47 @@ class AcousticDataTab(QWidget): # print("self.doubleRangeSlider_depth.value() ", self.doubleRangeSlider_depth.value()) - def set_rmin_rmax_for_doubleRangeSider_depth(self): + def compute_depth_cross_section(self): ''' rmin and rmax are updated with double slider of depth ''' stg.rmin[self.fileListWidget.currentRow()] = (( np.where(np.abs(np.round(stg.depth[self.fileListWidget.currentRow()][0, :], 2) - - - float("".join(findall("[.0-9]", self.lineEdit_depth_min_limits.text())))) == + float("".join(findall("[.0-9]", self.lineEdit_depth_max_limits.text())))) == + np.nanmin(np.abs(np.round(stg.depth[self.fileListWidget.currentRow()][0, :], + 2) - (float("".join(findall("[.0-9]", self.lineEdit_depth_max_limits.text())))) + )))[0][0]+1, + float("".join(findall("[.0-9]", self.lineEdit_depth_max_limits.text()))) + )) + + stg.rmax[self.fileListWidget.currentRow()] = (( + np.where(np.abs(np.round(stg.depth[self.fileListWidget.currentRow()][0, :], 2) - + float("".join(findall("[.0-9]", self.lineEdit_depth_min_limits.text())))) == np.nanmin(np.abs(np.round(stg.depth[self.fileListWidget.currentRow()][0, :], 2) - (float("".join(findall("[.0-9]", self.lineEdit_depth_min_limits.text())))) )))[0][0], float("".join(findall("[.0-9]", self.lineEdit_depth_min_limits.text()))) )) - print("rmax before ", stg.rmax) - stg.rmax[self.fileListWidget.currentRow()] = (( - np.where(np.abs(np.round(stg.depth[self.fileListWidget.currentRow()][0, :], 2) - - - float("".join(findall("[.0-9]", self.lineEdit_depth_max_limits.text())))) == - np.nanmin(np.abs(np.round(stg.depth[self.fileListWidget.currentRow()][0, :], - 2) - (float("".join(findall("[.0-9]", self.lineEdit_depth_max_limits.text())))) - )))[0][0]+1, - float("".join(findall("[.0-9]", self.lineEdit_depth_max_limits.text()))) - )) - print("rmax afer ", stg.rmax) stg.depth_cross_section[self.fileListWidget.currentRow()] = ( stg.depth[self.fileListWidget.currentRow()][:, stg.rmin[self.fileListWidget.currentRow()][0]:stg.rmax[self.fileListWidget.currentRow()][0]] ) - def compute_BS_cross_section(self): if self.fileListWidget.currentRow() != -1: - # print("tmax for compute BS cross section = ", 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]] - ) - - stg.depth_cross_section[self.fileListWidget.currentRow()] = ( - stg.depth[self.fileListWidget.currentRow()][:, stg.rmin[self.fileListWidget.currentRow()][0]: - stg.rmax[self.fileListWidget.currentRow()][0]] - ) + self.compute_depth_cross_section() + self.compute_time_cross_section() stg.BS_cross_section[self.fileListWidget.currentRow()] = ( stg.BS_raw_data[self.fileListWidget.currentRow()] [:, 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 : {len(stg.BS_cross_section)}") - # print(f"BS_cross_section shape : {stg.BS_cross_section[self.fileListWidget.currentRow()].shape}") - - # if (self.fileListWidget.count() == 1) and (len(stg.BS_cross_section) == 0): - # - # print("Config 1 : BS_cross_section") - # - # stg.BS_cross_section = [stg.BS_raw_data[self.fileListWidget.currentRow()][:, - # stg.rmin[self.fileListWidget.currentRow()][0]:stg.rmax[self.fileListWidget.currentRow()][0], - # stg.tmin[self.fileListWidget.currentRow()][0]:stg.tmax[self.fileListWidget.currentRow()][0]]] - # - # elif len(stg.BS_cross_section) < self.fileListWidget.count(): - # - # print("Config 2 : BS_cross_section") - # print("tmin for cross section ", stg.tmin) - # stg.BS_cross_section = stg.BS_cross_section + [stg.BS_raw_data[self.fileListWidget.currentRow()][:, - # stg.rmin[self.fileListWidget.currentRow()][0]:stg.rmax[self.fileListWidget.currentRow()][0], - # stg.tmin[self.fileListWidget.currentRow()][0]:stg.tmax[self.fileListWidget.currentRow()][0]]] - # - # else: - # - # print("Config 3 : BS_cross_section") - # - # stg.BS_cross_section[self.fileListWidget.currentRow()] = ( - # stg.BS_raw_data[self.fileListWidget.currentRow()] - # [:, 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 : {len(stg.BS_cross_section)}") - # print(f"BS_cross_section shape : {stg.BS_cross_section[self.fileListWidget.currentRow()].shape}") + 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: @@ -3480,19 +3284,19 @@ class AcousticDataTab(QWidget): # 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])) + "-" + str("%.5s" % 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])) + "-" + str("%.5s" % stg.depth_cross_section[self.fileListWidget.currentRow()][0, 0])) else: # 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])) + "-" + 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(stg.depth[self.fileListWidget.currentRow()][0, 0])) + "-" + str("%.5s" % stg.depth[self.fileListWidget.currentRow()][0, 0])) def plot_backscattered_acoustic_signal_recording(self): # --- Condition if table is not filled --- @@ -3586,7 +3390,7 @@ class AcousticDataTab(QWidget): color='red', linestyle="solid", linewidth=2) self.fig_BS.supxlabel('Time (sec)', fontsize=10) - self.fig_BS.supylabel('Distance from transducer (m)', fontsize=10) + self.fig_BS.supylabel('Depth (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() @@ -3717,7 +3521,7 @@ class AcousticDataTab(QWidget): transform=self.axis_BS[f].transAxes) self.fig_BS.supxlabel('Time (sec)', fontsize=10) - self.fig_BS.supylabel('Distance from transducer (m)', 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) @@ -4018,7 +3822,7 @@ class AcousticDataTab(QWidget): transform=self.axis_profile.transAxes) self.fig_profile.supxlabel("Acoustic Backscatter Signal (V)") - self.fig_profile.supylabel("Distance from transducer (m)") + self.fig_profile.supylabel("Depth (m)") self.fig_profile.canvas.draw_idle() # plt.close(self.fig_profile) @@ -4134,7 +3938,7 @@ class AcousticDataTab(QWidget): transform=self.axis_profile.transAxes) self.fig_profile.supxlabel("Acoustic Backscatter Signal (V)") - self.fig_profile.supylabel("Distance from transducer (m)") + self.fig_profile.supylabel("Depth (m)") self.fig_profile.canvas.draw_idle() # self.fig_profile.canvas.flush_events() # plt.close(self.fig_profile) diff --git a/settings.py b/settings.py index 34c3eb2..db187a6 100644 --- a/settings.py +++ b/settings.py @@ -6,87 +6,119 @@ import datetime # --- load raw data --- -ABS_name = [] +# ========================================================= +# --- ACOUSTIC DATA TAB --- +# ========================================================= -path_BS_raw_data = [] -filename_BS_raw_data = [] -BS_raw_data = [] # BS raw data : all measurement (go and back) -depth = [] -depth_2D = [] -freq = [] -freq_text = [] -time = [] +# Variables names # Description # Type + +ABS_name = [] # Acoustic Backscatter System name : ["Aquascat 1000R", "UB-SediFlow"] # List of strings +temperature = 0 # Temperature of measurements (One temperature for all measurements) # Float +water_velocity = 0 # Speed of sound in water (One speed of sound for all measurements) # Float + +# --- Acoustic raw data --- +path_BS_raw_data = [] # Paths of the acoustic data files # List of strings +filename_BS_raw_data = [] # Files names of the acoustic data files # List of strings + +BS_raw_data = [] # Acoustic raw data measurements : 3D arrays (freq x depth x time) # List of arrays +BS_raw_data_reshape = [] # Acoustic raw data measurements : 2D arrays (freq x (depth x time)) # List of arrays + +depth = [] # Distance from transducer : 2D array (freq x depth) # List of arrays +depth_reshape = [] # Distance from transducer : 2D array (freq x (depth x time)) # List of arrays +depth_2D = [] # Distance from transducer : 2D array (freq x depth) # List of arrays + +time = [] # Time of measurements : 2D array (freq x time) # List of arrays +time_reshape = [] # Time of measurements : 2D array (freq x (depth x time)) # List of arrays + +# --- Measurement information --- +date = [] # Date of measurements # List of dates +hour = [] # Time of measurements # List of time + +distance_from_ABS_to_free_surface = [] # Set distance from ABS to free surface # List of floats + +freq = [] # Frequency of measurements : 1D array # List of arrays +freq_text = [] # Frequency of measurements : list of string # List of lists + +kt_read = [] # Constant of calibration kt of the ABS read from acoustic file # List of list + # for each frequency +kt_corrected = {} # Constant of calibration kt of the ABS corrected # Dictionary + # Sometimes, the read values of kt are wrong. Then, we define + # default values for all frequency of the ABS. + +water_attenuation = [] # Sound attenuation in water for each frequency and for one temperature # List of lists +nb_profiles = [] # Total number of profiles for each frequency = time length # List of lists +nb_profiles_per_sec = [] # Profile rate (Hz) for each frequency # List of lists +nb_cells = [] # Number of cells in profiles for each frequency # List of lists +cell_size = [] # Cell size for each frequency (m) # List of lists +pulse_length = [] # Pulse length (m) # List of lists +nb_pings_per_sec = [] # Number of pings per seconds (Hz) # List of lists +nb_pings_averaged_per_profile = [] # Profiles per average # List of lists +gain_rx = [] # Rx gain # List of lists +gain_tx = [] # Tx gain # List of lists + +DataFrame_acoustic = pd.DataFrame() + +# --- Modify raw data limits --- +tmin = [] # Minimum boundary of time for each recording : (index, value) # List of tuples +tmax = [] # Maximum boundary of time for each recording : (index, value) # List of tuples +rmin = [] # Minimum boundary of depth for each recording : (index, value) # List of tuples +rmax = [] # Maximum boundary of depth for each recording : (index, value) # List of tuples + +BS_cross_section = [] # BS data limited with tmin and tmax values # List of arrays +depth_cross_section = [] # depth limited with rmin and rmax values # List of arrays +time_cross_section = [] # time limited with rmin and rmax values # List of arrays + +# --- Detect bottom --- +BS_stream_bed = [] # BS data (raw or cross_section) with detected bottom : # List of arrays + # 3D array : (freq x depth x time) +depth_bottom = [] # Depth value of th bottom : 1D array # List of arrays +val_bottom = [] # Level of the BS signal on the bottom : 1D array # List of arrays +ind_bottom = [] # Index of bottom in depth array : list of int # List of lists +freq_bottom_detection = [] # Frequency use to detect the bottom : (index, string) # List of tuple + +dept_bottom_detection_min = [] # Min value to detect bottom on the first vertical # List of float +depth_bottom_detection_max = [] # Max value to detect bottom on the first vertical # List of float +depth_bottom_detection_1st_int_area = [] # interval for searching area # List of float + +# ---------------------------------------------------------------------------------------------------------------------- +# ========================================================= +# --- SIGNAL PREPROCESSING TAB --- +# ========================================================= + +# Variables names # Description # Type path_BS_noise_data = [] filename_BS_noise_data = [] BS_noise_raw_data = [] # BS noise raw data : BS signal listen BS_noise_averaged_data = [] # BS noise raw data averaged (array has the same shape than BS_raw_data shape) +date_noise = [] +hour_noise = [] + noise_method = [] noise_value = [] SNR_filter_value = [] Nb_cells_to_average_BS_signal = [] data_preprocessed = [] -date = [] -date_noise = [] -hour = [] -hour_noise = [] -nb_profiles = [] -nb_profiles_per_sec = [] -nb_cells = [] -cell_size = [] -pulse_length = [] -nb_pings_per_sec = [] -nb_pings_averaged_per_profile = [] -kt_read = [] -kt_corrected = {} -gain_rx = [] -gain_tx = [] +time_snr_reshape = np.array([]) +SNR_reshape = np.array([]) # snr is reshape to be included in table of values in acoustic data tab SNR_raw_data = [] # SNR is computed with BS_noise_averaged_data time_noise = [] depth_noise = [] -# --- reshape raw data for table of values in Acoustic Data tab --- -time_reshape = [] -time_snr_reshape = np.array([]) -depth_reshape = [] -BS_raw_data_reshape = [] -SNR_reshape = np.array([]) # snr is reshape to be included in table of values in acoustic data tab -DataFrame_acoustic = pd.DataFrame() - -# --- Processed data in Acoustic Data Tab and used in Acoustic processing tab --- -tmin = [] # minimum boundary of time (spin box tmin) tmin_snr = np.array([]) -tmax = [] # maximum boundary of time (spin box tmin) tmax_snr = np.array([]) -rmin = [] -rmax = [] -BS_cross_section = [] # BS data limited with tmin and tmax values of spin box -BS_stream_bed = [] # BS_data_section = BS data in the section. Values NaN outside the bottom of the section are deleted # BS_noise_cross_section = [] # BS_noise_cross_section = BS_noise_data[:, :, tmin:tmax] (former Noise_data) SNR_cross_section = [] # SNR_data = snr[:, :, tmin:tmax] SNR_stream_bed = [] -time_cross_section = [] time_snr = [] -depth_cross_section = [] -depth_bottom = [] -val_bottom = [] -ind_bottom = [] -freq_bottom_detection = [] -depth_bottom_detection_1st_int_area = [] +time_average = np.array([]) +SNR_data_average = np.array([]) # SNR data computed with BS signal averaged (not with BS raw signal) # --- Processed data in Signal Processing Tab --- -# BS_cross_section_SNR_filter = np.array([[[]]]) # BS data filtered with SNR values (remove point if SNR < value) - bottom is not detected -# BS_cross_section_averaged = np.array([[[]]]) # BS data averaged - bottom is not detected -# BS_cross_section_averaged_SNR = np.array([[[]]]) # BS data averaged and filtered with SNR - bottom is not detected - -# BS_stream_bed_SNR_filter = np.array([]) # BS data filtered with SNR values (remove point if SNR < value) - bottom is detected -# BS_stream_bed_averaged = np.array([]) # BS data averaged - bottom is detected -# BS_stream_bed_averaged_SNR = np.array([]) # BS data averaged and filtered with SNR - bottom is detected - BS_raw_data_pre_process_SNR = [] BS_raw_data_pre_process_average = [] BS_raw_data_pre_process_SNR_average = [] @@ -99,16 +131,18 @@ BS_stream_bed_pre_process_SNR = [] # BS data filtered with SNR value BS_stream_bed_pre_process_average = [] # BS data averaged - bottom is detected BS_stream_bed_pre_process_SNR_average = [] # BS data averaged and filtered with SNR - bottom is detected -time_average = np.array([]) -SNR_data_average = np.array([]) # SNR data computed with BS signal averaged (not with BS raw signal) +# ---------------------------------------------------------------------------------------------------------------------- +# ========================================================= +# --- SAMPLE DATA TAB --- +# ========================================================= -sediment_attenuation = [] +# Variables names # Description # Type -FCB = [] -depth_real = [] -lin_reg = [] +# --- Fine sediment Data --- -# --- Sample Data --- + + +# --- Sand sediment Data --- sample_fine = [] @@ -158,19 +192,18 @@ Ctot_sand_per_cent = [] fine_sample_position = [] sand_sample_position = [] -# --- Acoustic inversion method --- -temperature = 0 -water_attenuation = [] -water_velocity = 0 +# ---------------------------------------------------------------------------------------------------------------------- +# ========================================================= +# --- SEDIMENT CALIBRATION TAB --- +# ========================================================= -# kt_corrected = np.array([]) -# kt_corrected_2D = np.array([]) -# kt_corrected_3D = np.array([]) +# Variables names # Description # Type -frequencies_to_compute_VBI = np.array([]) -VBI_cross_section = [] -# VBI_stream_bed = np.array([[[]]]) +sediment_attenuation = [] +FCB = [] +depth_real = [] +lin_reg = [] # --- Sediment Calibration frequencies_for_calibration = [] @@ -192,6 +225,18 @@ J_cross_section = [] frequency_for_inversion = tuple() + +# ---------------------------------------------------------------------------------------------------------------------- +# ========================================================= +# --- ACOUSTIC INVERSION TAB --- +# ========================================================= + +# Variables names # Description # Type + +frequencies_to_compute_VBI = np.array([]) +VBI_cross_section = [] +# VBI_stream_bed = np.array([[[]]]) + SSC_fine = [] SSC_sand = []