From 2aebdf3b9b4437c5eb0a281ddb2fe64e9f7fbdba Mon Sep 17 00:00:00 2001 From: brahim Date: Thu, 7 Nov 2024 09:37:32 +0100 Subject: [PATCH] The tabs are updated for UBSediFlow data. --- View/acoustic_data_tab.py | 182 +++++++------- View/acoustic_inversion_tab.py | 401 +++++++++++++++---------------- View/plot_noise_window.py | 2 + View/sediment_calibration_tab.py | 98 +++++--- View/signal_processing_tab.py | 40 ++- 5 files changed, 396 insertions(+), 327 deletions(-) diff --git a/View/acoustic_data_tab.py b/View/acoustic_data_tab.py index a5436ce..81f3a62 100644 --- a/View/acoustic_data_tab.py +++ b/View/acoustic_data_tab.py @@ -20,7 +20,7 @@ from os import path from copy import deepcopy import locale -from settings import depth_cross_section +from settings import depth_cross_section, kt_read locale.setlocale(locale.LC_ALL, '') @@ -293,6 +293,8 @@ class AcousticDataTab(QWidget): self.checkbox_kt = QCheckBox() self.checkbox_kt.setChecked(True) + self.checkbox_kt.setToolTip("Checkbox checked : calibration is computed with kt value from the file (see File -> Settings -> ABS constant calibration kt) \n" + "Checkbox unchecked : calibration is computed from kt values read from the ABS") self.label_sound_attenuation = QLabel("Sound attenuation : ") @@ -1668,89 +1670,89 @@ class AcousticDataTab(QWidget): self.gridLayout_groupbox_info.addWidget(self.combobox_ABS_name, 0, 2, 1, 2, Qt.AlignCenter) self.label_date_acoustic_file.show() - self.gridLayout_groupbox_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, Qt.AlignLeft) self.label_hour_acoustic_file.show() - self.gridLayout_groupbox_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, Qt.AlignLeft) 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.gridLayout_groupbox_info.addWidget(self.label_distance_from_ABS_to_free_surface, 2, 0, 1, 1, Qt.AlignLeft) 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.gridLayout_groupbox_info.addWidget(self.lineEdit_distance_from_ABS_to_free_surface, 2, 1, 1, 1, Qt.AlignLeft) 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.gridLayout_groupbox_info.addWidget(self.label_distance_from_ABS_to_free_surface_unit, 2, 2, 1, 1, Qt.AlignLeft) 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.gridLayout_groupbox_info.addWidget(self.pushbutton_distance_from_ABS_to_free_surface, 2, 3, 1, 1, Qt.AlignLeft) self.label_temperature.show() - self.gridLayout_groupbox_info.addWidget(self.label_temperature, 3, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_temperature, 3, 0, 1, 1, Qt.AlignLeft) # self.spinbox_temperature.show() self.lineEdit_temperature.show() - self.gridLayout_groupbox_info.addWidget(self.lineEdit_temperature, 3, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_temperature, 3, 1, 1, 1, Qt.AlignLeft) self.label_temperature_unit.show() 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_groupbox_info.addWidget(self.label_speed_of_sound, 4, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_speed_of_sound, 4, 0, 1, 1, Qt.AlignLeft) # self.spinbox_speed_of_sound.show() self.lineEdit_speed_of_sound.show() - self.gridLayout_groupbox_info.addWidget(self.lineEdit_speed_of_sound, 4, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_speed_of_sound, 4, 1, 1, 1, Qt.AlignLeft) self.label_speed_of_sound_unit.show() self.gridLayout_groupbox_info.addWidget(self.label_speed_of_sound_unit, 4, 2, 1, 1, Qt.AlignLeft) self.label_freq.show() - self.gridLayout_groupbox_info.addWidget(self.label_freq, 5, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_freq, 5, 0, 1, 1, Qt.AlignLeft) self.combobox_frequency_information.show() - self.gridLayout_groupbox_info.addWidget(self.combobox_frequency_information, 5, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.combobox_frequency_information, 5, 1, 1, 1, Qt.AlignLeft) self.label_kt.show() - self.gridLayout_groupbox_info.addWidget(self.label_kt, 6, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_kt, 6, 0, 1, 1, Qt.AlignLeft) # self.spinbox_kt.show() self.lineEdit_kt.show() - self.gridLayout_groupbox_info.addWidget(self.lineEdit_kt, 6, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_kt, 6, 1, 1, 1, Qt.AlignLeft) self.label_kt_unit.show() self.gridLayout_groupbox_info.addWidget(self.label_kt_unit, 6, 2, 1, 1, Qt.AlignLeft) self.checkbox_kt.show() - self.gridLayout_groupbox_info.addWidget(self.checkbox_kt, 6, 3, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_info.addWidget(self.checkbox_kt, 6, 3, 1, 1, Qt.AlignLeft) self.label_sound_attenuation.show() - self.gridLayout_groupbox_info.addWidget(self.label_sound_attenuation, 7, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_sound_attenuation, 7, 0, 1, 1, Qt.AlignLeft) # self.spinbox_sound_attenuation.show() self.lineEdit_sound_attenuation.show() - self.gridLayout_groupbox_info.addWidget(self.lineEdit_sound_attenuation, 7, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_sound_attenuation, 7, 1, 1, 1, Qt.AlignLeft) self.label_sound_attenuation_unit.show() self.gridLayout_groupbox_info.addWidget(self.label_sound_attenuation_unit, 7, 2, 1, 1, Qt.AlignLeft) self.label_profiles.show() - self.gridLayout_groupbox_info.addWidget(self.label_profiles, 8, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles, 8, 0, 1, 1, Qt.AlignLeft) self.label_profiles_per_sec.show() - self.gridLayout_groupbox_info.addWidget(self.label_profiles_per_sec, 9, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles_per_sec, 9, 0, 1, 1, Qt.AlignLeft) self.label_cells.show() - self.gridLayout_groupbox_info.addWidget(self.label_cells, 10, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cells, 10, 0, 1, 1, Qt.AlignLeft) self.label_cell_size.show() - self.gridLayout_groupbox_info.addWidget(self.label_cell_size, 11, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cell_size, 11, 0, 1, 1, Qt.AlignLeft) self.label_pulse_length.show() - self.gridLayout_groupbox_info.addWidget(self.label_pulse_length, 12, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pulse_length, 12, 0, 1, 1, Qt.AlignLeft) self.label_pings_per_sec.show() - self.gridLayout_groupbox_info.addWidget(self.label_pings_per_sec, 13, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_sec, 13, 0, 1, 1, Qt.AlignLeft) self.label_pings_per_profile.show() - self.gridLayout_groupbox_info.addWidget(self.label_pings_per_profile, 14, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_profile, 14, 0, 1, 1, Qt.AlignLeft) self.label_rx.show() - self.gridLayout_groupbox_info.addWidget(self.label_rx, 15, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_rx, 15, 0, 1, 1, Qt.AlignLeft) # self.spinbox_rx.show() self.lineEdit_rx.show() - self.gridLayout_groupbox_info.addWidget(self.lineEdit_rx, 15, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_rx, 15, 1, 1, 1, Qt.AlignLeft) self.checkbox_rx.show() - self.gridLayout_groupbox_info.addWidget(self.checkbox_rx, 15, 3, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_info.addWidget(self.checkbox_rx, 15, 3, 1, 1, Qt.AlignLeft) self.label_tx.show() - self.gridLayout_groupbox_info.addWidget(self.label_tx, 16, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_tx, 16, 0, 1, 1, Qt.AlignLeft) # self.spinbox_tx.show() self.lineEdit_tx.show() - self.gridLayout_groupbox_info.addWidget(self.lineEdit_tx, 16, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_tx, 16, 1, 1, 1, Qt.AlignLeft) self.checkbox_tx.show() - self.gridLayout_groupbox_info.addWidget(self.checkbox_tx, 16, 3, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_info.addWidget(self.checkbox_tx, 16, 3, 1, 1, Qt.AlignLeft) def groupbox_measurement_information_UBSediFlow(self): # --- Hide Aquascat information --- @@ -1824,88 +1826,88 @@ class AcousticDataTab(QWidget): self.gridLayout_groupbox_info.addWidget(self.combobox_ABS_name, 0, 2, 1, 2, Qt.AlignCenter) self.label_date_acoustic_file.show() - self.gridLayout_groupbox_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, Qt.AlignLeft) self.label_hour_acoustic_file.show() - self.gridLayout_groupbox_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, Qt.AlignLeft) 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.gridLayout_groupbox_info.addWidget(self.label_distance_from_ABS_to_free_surface, 2, 0, 1, 1, Qt.AlignLeft) 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.gridLayout_groupbox_info.addWidget(self.lineEdit_distance_from_ABS_to_free_surface, 2, 1, 1, 1, Qt.AlignLeft) 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.gridLayout_groupbox_info.addWidget(self.label_distance_from_ABS_to_free_surface_unit, 2, 2, 1, 1, Qt.AlignLeft) 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.gridLayout_groupbox_info.addWidget(self.pushbutton_distance_from_ABS_to_free_surface, 2, 3, 1, 1, Qt.AlignLeft) self.label_temperature.show() - self.gridLayout_groupbox_info.addWidget(self.label_temperature, 3, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_temperature, 3, 0, 1, 1, Qt.AlignLeft) # self.spinbox_temperature.show() self.lineEdit_temperature.show() - self.gridLayout_groupbox_info.addWidget(self.lineEdit_temperature, 3, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_temperature, 3, 1, 1, 1, Qt.AlignLeft) self.label_temperature_unit.show() self.gridLayout_groupbox_info.addWidget(self.label_temperature_unit, 3, 2, 1, 1, Qt.AlignLeft) self.label_speed_of_sound.show() - self.gridLayout_groupbox_info.addWidget(self.label_speed_of_sound, 4, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_speed_of_sound, 4, 0, 1, 1, Qt.AlignLeft) # self.spinbox_speed_of_sound.show() self.lineEdit_speed_of_sound.show() - self.gridLayout_groupbox_info.addWidget(self.lineEdit_speed_of_sound, 4, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_speed_of_sound, 4, 1, 1, 1, Qt.AlignLeft) self.label_speed_of_sound_unit.show() self.gridLayout_groupbox_info.addWidget(self.label_speed_of_sound_unit, 4, 2, 1, 1, Qt.AlignLeft) self.label_freq.show() - self.gridLayout_groupbox_info.addWidget(self.label_freq, 5, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_freq, 5, 0, 1, 1, Qt.AlignLeft) self.combobox_frequency_information.show() - self.gridLayout_groupbox_info.addWidget(self.combobox_frequency_information, 5, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.combobox_frequency_information, 5, 1, 1, 1, Qt.AlignLeft) self.label_kt.show() - self.gridLayout_groupbox_info.addWidget(self.label_kt, 6, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_kt, 6, 0, 1, 1, Qt.AlignLeft) # self.spinbox_kt.show() self.lineEdit_kt.show() - self.gridLayout_groupbox_info.addWidget(self.lineEdit_kt, 6, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_kt, 6, 1, 1, 1, Qt.AlignLeft) self.label_kt_unit.show() self.gridLayout_groupbox_info.addWidget(self.label_kt_unit, 6, 2, 1, 1, Qt.AlignLeft) self.checkbox_kt.show() - self.gridLayout_groupbox_info.addWidget(self.checkbox_kt, 6, 3, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_info.addWidget(self.checkbox_kt, 6, 3, 1, 1, Qt.AlignLeft) self.label_sound_attenuation.show() - self.gridLayout_groupbox_info.addWidget(self.label_sound_attenuation, 7, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_sound_attenuation, 7, 0, 1, 1, Qt.AlignLeft) # self.spinbox_sound_attenuation.show() self.lineEdit_sound_attenuation.show() - self.gridLayout_groupbox_info.addWidget(self.lineEdit_sound_attenuation, 7, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_sound_attenuation, 7, 1, 1, 1, Qt.AlignLeft) self.label_sound_attenuation_unit.show() self.gridLayout_groupbox_info.addWidget(self.label_sound_attenuation_unit, 7, 2, 1, 1, Qt.AlignLeft) self.label_profiles.show() - self.gridLayout_groupbox_info.addWidget(self.label_profiles, 8, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles, 8, 0, 1, 1, Qt.AlignLeft) self.label_profiles_per_sec.show() - self.gridLayout_groupbox_info.addWidget(self.label_profiles_per_sec, 9, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles_per_sec, 9, 0, 1, 1, Qt.AlignLeft) self.label_cells.show() - self.gridLayout_groupbox_info.addWidget(self.label_cells, 10, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cells, 10, 0, 1, 1, Qt.AlignLeft) self.label_cell_size.show() - self.gridLayout_groupbox_info.addWidget(self.label_cell_size, 11, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cell_size, 11, 0, 1, 1, Qt.AlignLeft) self.label_pulse_length.show() - self.gridLayout_groupbox_info.addWidget(self.label_pulse_length, 12, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pulse_length, 12, 0, 1, 1, Qt.AlignLeft) self.label_pings_per_sec.show() - self.gridLayout_groupbox_info.addWidget(self.label_pings_per_sec, 13, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_sec, 13, 0, 1, 1, Qt.AlignLeft) self.label_pings_per_profile.show() - self.gridLayout_groupbox_info.addWidget(self.label_pings_per_profile, 14, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_profile, 14, 0, 1, 1, Qt.AlignLeft) self.label_rx.show() - self.gridLayout_groupbox_info.addWidget(self.label_rx, 15, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_rx, 15, 0, 1, 1, Qt.AlignLeft) # self.spinbox_rx.show() - self.lineEdit_rx.hide() - self.gridLayout_groupbox_info.addWidget(self.lineEdit_rx, 15, 1, 1, 1) + self.lineEdit_rx.show() + self.gridLayout_groupbox_info.addWidget(self.lineEdit_rx, 15, 1, 1, 1, Qt.AlignLeft) self.checkbox_rx.show() - self.gridLayout_groupbox_info.addWidget(self.checkbox_rx, 15, 3, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_info.addWidget(self.checkbox_rx, 15, 2, 1, 1, Qt.AlignLeft) self.label_tx.show() - self.gridLayout_groupbox_info.addWidget(self.label_tx, 16, 0, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_tx, 16, 0, 1, 1, Qt.AlignLeft) # self.spinbox_tx.show() self.lineEdit_tx.show() - self.gridLayout_groupbox_info.addWidget(self.lineEdit_tx, 16, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.lineEdit_tx, 16, 1, 1, 1, Qt.AlignLeft) self.checkbox_tx.show() - self.gridLayout_groupbox_info.addWidget(self.checkbox_tx, 16, 2, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_info.addWidget(self.checkbox_tx, 16, 2, 1, 1, Qt.AlignLeft) def distance_from_ABS_to_free_surface(self): if self.fileListWidget.count() == 0: @@ -2113,12 +2115,19 @@ class AcousticDataTab(QWidget): print("stg.data_preprocessed ", stg.data_preprocessed) elif self.combobox_ABS_system_choice.currentIndex() == 2: - filename = QFileDialog.getOpenFileName(self, "UBSediFlow file", + filename = QFileDialog.getOpenFileNames(self, "UBSediFlow file", [stg.path_BS_raw_data[-1] if self.fileListWidget.count() > 0 else ""][0], - "UBSediFlow file (*.udt)") - dir_name = path.dirname(filename[0]) - name = path.basename(filename[0]) - print(f"dir name : {dir_name} & file name : {name}") + "UBSediFlow file (*.udt)", + options=QFileDialog.DontUseNativeDialog) + print("filename ", filename) + for n in filename[0]: + + stg.path_BS_raw_data.append(path.dirname(n)) + stg.filename_BS_raw_data.append(path.basename(n)) + stg.data_preprocessed.append(path.basename(n)) + # dir_name = path.dirname(filename[0]) + # name = path.basename(filename[0]) + print(f"dir name : {stg.path_BS_raw_data} & file name : {stg.filename_BS_raw_data}") # --- Fill lineEdit with path and file names + load acoustic data --- @@ -2514,7 +2523,9 @@ class AcousticDataTab(QWidget): stg.time.append(acoustic_data._time) stg.time_reshape.append(acoustic_data.reshape_t()) stg.freq.append(acoustic_data._freq) + print("stg.freq", stg.freq) stg.freq_text.append(acoustic_data._freq_text) + print("stg.freq text", stg.freq_text) stg.date.append(acoustic_data._date) stg.hour.append(acoustic_data._hour) stg.distance_from_ABS_to_free_surface.append(0.00) @@ -2525,7 +2536,10 @@ class AcousticDataTab(QWidget): stg.pulse_length.append(acoustic_data._cell_size) stg.nb_pings_per_sec.append(acoustic_data._nb_pings_per_sec) stg.nb_pings_averaged_per_profile.append(acoustic_data._nb_pings_averaged_per_profile) - stg.kt_read = acoustic_data._kt + if self.combobox_ABS_name.currentIndex() == 1: + stg.kt_read = acoustic_data._kt + else: + stg.kt_read = [0*i for i in range(acoustic_data._freq.shape[0])] # stg.kt_corrected.append([0]*len(stg.kt_read[-1])) stg.gain_rx.append(acoustic_data._gain_rx) stg.gain_tx.append(acoustic_data._gain_tx) @@ -2634,11 +2648,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_groupbox_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, Qt.AlignLeft) self.label_hour_acoustic_file.clear() self.label_hour_acoustic_file.setText("Hour: " + str(stg.hour[self.fileListWidget.currentRow()])) - self.gridLayout_groupbox_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, Qt.AlignLeft) self.combobox_frequency_information.clear() self.combobox_frequency_information.addItems(stg.freq_text[self.fileListWidget.currentRow()]) @@ -2649,31 +2663,31 @@ class AcousticDataTab(QWidget): self.label_profiles_value.setText(str(stg.nb_profiles[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()])) - self.gridLayout_groupbox_info.addWidget(self.label_profiles_value, 8, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles_value, 8, 1, 1, 1, Qt.AlignLeft) self.label_profiles_per_sec_value.setText(str(stg.nb_profiles_per_sec[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()]) + " Hz") - self.gridLayout_groupbox_info.addWidget(self.label_profiles_per_sec_value, 9, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles_per_sec_value, 9, 1, 1, 1, Qt.AlignLeft) self.label_cells_value.setText(str(stg.nb_cells[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()])) - self.gridLayout_groupbox_info.addWidget(self.label_cells_value, 10, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cells_value, 10, 1, 1, 1, Qt.AlignLeft) self.label_cell_size_value.setText(str(100*round(stg.cell_size[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()], 3)) + " cm") - self.gridLayout_groupbox_info.addWidget(self.label_cell_size_value, 11, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cell_size_value, 11, 1, 1, 1, Qt.AlignLeft) self.label_pulse_length_value.setText(str(round(stg.pulse_length[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()], 6)) + " sec") - self.gridLayout_groupbox_info.addWidget(self.label_pulse_length_value, 12, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pulse_length_value, 12, 1, 1, 1, Qt.AlignLeft) self.label_pings_per_sec_value.setText(str(stg.nb_pings_per_sec[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()]) + " Hz") - self.gridLayout_groupbox_info.addWidget(self.label_pings_per_sec_value, 13, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_sec_value, 13, 1, 1, 1, Qt.AlignLeft) self.label_pings_per_profile_value.setText(str(stg.nb_pings_averaged_per_profile[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()])) - self.gridLayout_groupbox_info.addWidget(self.label_pings_per_profile_value, 14, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_profile_value, 14, 1, 1, 1, Qt.AlignLeft) stg.kt_corrected.clear() for f in range(stg.freq[self.fileListWidget.currentRow()].shape[0]): @@ -2820,42 +2834,42 @@ class AcousticDataTab(QWidget): 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_groupbox_info.addWidget(self.label_profiles_value, 8, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles_value, 8, 1, 1, 1, Qt.AlignLeft) self.label_profiles_per_sec_value.clear() self.label_profiles_per_sec_value.setText( str(stg.nb_profiles_per_sec[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()]) + " Hz") - self.gridLayout_groupbox_info.addWidget(self.label_profiles_per_sec_value, 9, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_profiles_per_sec_value, 9, 1, 1, 1, Qt.AlignLeft) self.label_cells_value.clear() self.label_cells_value.setText(str(stg.nb_cells[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()])) - self.gridLayout_groupbox_info.addWidget(self.label_cells_value, 10, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cells_value, 10, 1, 1, 1, Qt.AlignLeft) self.label_cell_size_value.clear() 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_groupbox_info.addWidget(self.label_cell_size_value, 11, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_cell_size_value, 11, 1, 1, 1, Qt.AlignLeft) self.label_pulse_length_value.clear() self.label_pulse_length_value.setText( str(round(stg.pulse_length[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()], 6)) + " sec") - self.gridLayout_groupbox_info.addWidget(self.label_pulse_length_value, 12, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pulse_length_value, 12, 1, 1, 1, Qt.AlignLeft) self.label_pings_per_sec_value.clear() self.label_pings_per_sec_value.setText(str(stg.nb_pings_per_sec[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()]) + " Hz") - self.gridLayout_groupbox_info.addWidget(self.label_pings_per_sec_value, 13, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_sec_value, 13, 1, 1, 1, Qt.AlignLeft) self.label_pings_per_profile_value.clear() self.label_pings_per_profile_value.setText( str(stg.nb_pings_averaged_per_profile[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()])) - self.gridLayout_groupbox_info.addWidget(self.label_pings_per_profile_value, 14, 1, 1, 1) + self.gridLayout_groupbox_info.addWidget(self.label_pings_per_profile_value, 14, 1, 1, 1, Qt.AlignLeft) print("stg.kt_corrected ", stg.kt_corrected) print("self.combobox_frequency_information.currentText()", diff --git a/View/acoustic_inversion_tab.py b/View/acoustic_inversion_tab.py index c1d6d15..0ae7332 100644 --- a/View/acoustic_inversion_tab.py +++ b/View/acoustic_inversion_tab.py @@ -522,15 +522,10 @@ class AcousticInversionTab(QWidget): val_min = np.nanmin(stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()]) val_max = np.nanmax(stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()]) - print("ABS name ", stg.ABS_name) + # if stg.ABS_name[0] == "Aquascat 1000R": - if stg.ABS_name[0] == "Aquascat 1000R": + if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - print("hey !") - - if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - - print("hey hey !") # print("time cross section ", stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # stg.frequency_for_inversion[1]]) @@ -538,37 +533,37 @@ class AcousticInversionTab(QWidget): # stg.frequency_for_inversion[1]]) # print(stg.frequency_for_inversion[1]) - pcm_SSC_fine = self.axis_SSC_fine.pcolormesh( - stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()], - cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=15), shading='gouraud') + pcm_SSC_fine = self.axis_SSC_fine.pcolormesh( + stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()], + cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=15), shading='gouraud') - if stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - self.axis_SSC_fine.plot(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - -stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()], - color='black', linewidth=1, linestyle="solid") + if stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + self.axis_SSC_fine.plot(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + -stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()], + color='black', linewidth=1, linestyle="solid") - self.pcm_SSC_fine_vertical_line, = self.axis_SSC_fine.plot( - stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1], - self.slider_fine.value() - 1] * - np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]].shape), - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - linestyle="solid", color='r', linewidth=2) + self.pcm_SSC_fine_vertical_line, = self.axis_SSC_fine.plot( + stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1], + self.slider_fine.value() - 1] * + np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]].shape), + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + linestyle="solid", color='r', linewidth=2) - print("o+o+o+o+o+o") - print(stg.frequency_for_inversion[1]) - print([i for i, _ in stg.fine_sample_position]) - # print([stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - # stg.frequency_for_inversion[1], i] - # for i, _ in stg.fine_sample_position]) - print("o+o+o+o+o+o") + # print("o+o+o+o+o+o") + # print(stg.frequency_for_inversion[1]) + # print([i for i, _ in stg.fine_sample_position]) + # # print([stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + # # stg.frequency_for_inversion[1], i] + # # for i, _ in stg.fine_sample_position]) + # print("o+o+o+o+o+o") # self.pcm_SSC_fine_meas_vs_inv, = self.axis_SSC_fine.plot( # [stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ @@ -580,71 +575,71 @@ class AcousticInversionTab(QWidget): # ls=" ", marker="o", ms=5, mec="k", mfc="k") - else: + else: - pcm_SSC_fine = self.axis_SSC_fine.pcolormesh( - stg.time[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()], - cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=15), shading='gouraud') + pcm_SSC_fine = self.axis_SSC_fine.pcolormesh( + stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()], + cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=15), shading='gouraud') - self.pcm_SSC_fine_vertical_line, = self.axis_SSC_fine.plot( - stg.time[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1], - self.slider_fine.value() - 1] * - np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[ - 1]].shape), - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - linestyle="solid", color='r', linewidth=2) + self.pcm_SSC_fine_vertical_line, = self.axis_SSC_fine.plot( + stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1], + self.slider_fine.value() - 1] * + np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[ + 1]].shape), + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + linestyle="solid", color='r', linewidth=2) - if stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - self.axis_SSC_fine.plot(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - -stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()], - color='black', linewidth=1, linestyle="solid") + if stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + self.axis_SSC_fine.plot(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + -stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()], + color='black', linewidth=1, linestyle="solid") - # --- Plot samples of fine sediments --- - time_fine_temp = deepcopy(stg.time_fine) - depth_fine_temp = deepcopy(stg.depth_fine) - print("0 time_fine_temp, depth_fine_temp, ", time_fine_temp, depth_fine_temp) - for s in stg.fine_sample_profile: - print("s = ", s) - print(stg.time_fine[s[1]]) - print(stg.depth_fine[s[1]]) - time_fine_temp.remove(stg.time_fine[s[1]]) - depth_fine_temp.remove(stg.depth_fine[s[1]]) - print("1 time_fine_temp, depth_fine_temp, ", time_fine_temp, depth_fine_temp) - self.pcm_SSC_fine_meas_vs_inv, = self.axis_SSC_fine.plot( - time_fine_temp, depth_fine_temp, ls=" ", marker="o", ms=5, mec="k", mfc="k") + # --- Plot samples of fine sediments --- + time_fine_temp = deepcopy(stg.time_fine) + depth_fine_temp = deepcopy(stg.depth_fine) + print("0 time_fine_temp, depth_fine_temp, ", time_fine_temp, depth_fine_temp) + for s in stg.fine_sample_profile: + print("s = ", s) + print(stg.time_fine[s[1]]) + print(stg.depth_fine[s[1]]) + time_fine_temp.remove(stg.time_fine[s[1]]) + depth_fine_temp.remove(stg.depth_fine[s[1]]) + print("1 time_fine_temp, depth_fine_temp, ", time_fine_temp, depth_fine_temp) + self.pcm_SSC_fine_meas_vs_inv, = self.axis_SSC_fine.plot( + time_fine_temp, depth_fine_temp, ls=" ", marker="o", ms=5, mec="k", mfc="k") - time_fine_temp = deepcopy(stg.time_fine) - depth_fine_temp = deepcopy(stg.depth_fine) - sample_fine_temp = deepcopy(stg.sample_fine) - print("0 sample_fine_temp ", sample_fine_temp) - for s in stg.fine_sample_profile: - sample_fine_temp.remove(s) - time_fine_temp.remove(stg.time_fine[s[1]]) - depth_fine_temp.remove(stg.depth_fine[s[1]]) - print("1 sample_fine_temp ", sample_fine_temp) - for i in range(len(sample_fine_temp)): - self.pcm_SSC_fine_meas_vs_inv_text = self.axis_SSC_fine.text( - time_fine_temp[i], - depth_fine_temp[i], sample_fine_temp[i][0]) + time_fine_temp = deepcopy(stg.time_fine) + depth_fine_temp = deepcopy(stg.depth_fine) + sample_fine_temp = deepcopy(stg.sample_fine) + print("0 sample_fine_temp ", sample_fine_temp) + for s in stg.fine_sample_profile: + sample_fine_temp.remove(s) + time_fine_temp.remove(stg.time_fine[s[1]]) + depth_fine_temp.remove(stg.depth_fine[s[1]]) + print("1 sample_fine_temp ", sample_fine_temp) + for i in range(len(sample_fine_temp)): + self.pcm_SSC_fine_meas_vs_inv_text = self.axis_SSC_fine.text( + time_fine_temp[i], + depth_fine_temp[i], sample_fine_temp[i][0]) - time_fine_temp, depth_fine_temp = stg.time_fine, stg.depth_fine - self.pcm_SSC_fine_meas_vs_inv_sample_calibration, = self.axis_SSC_fine.plot( - [time_fine_temp[s[1]] for s in stg.fine_sample_profile], - [depth_fine_temp[s[1]] for s in stg.fine_sample_profile], - ls=" ", marker="*", ms=12, mec="r", mfc="r") + time_fine_temp, depth_fine_temp = stg.time_fine, stg.depth_fine + self.pcm_SSC_fine_meas_vs_inv_sample_calibration, = self.axis_SSC_fine.plot( + [time_fine_temp[s[1]] for s in stg.fine_sample_profile], + [depth_fine_temp[s[1]] for s in stg.fine_sample_profile], + ls=" ", marker="*", ms=12, mec="r", mfc="r") - time_fine_temp, depth_fine_temp = stg.time_fine, stg.depth_fine - for i, j in stg.fine_sample_profile: - self.pcm_SSC_fine_meas_vs_inv_sample_calibration_text = self.axis_SSC_fine.text( - time_fine_temp[j]+5, depth_fine_temp[j]+0.05, i, color='r', fontweight='bold') + time_fine_temp, depth_fine_temp = stg.time_fine, stg.depth_fine + for i, j in stg.fine_sample_profile: + self.pcm_SSC_fine_meas_vs_inv_sample_calibration_text = self.axis_SSC_fine.text( + time_fine_temp[j]+5, depth_fine_temp[j]+0.05, i, color='r', fontweight='bold') # self.pcm_SSC_fine_meas_vs_inv, = self.axis_SSC_fine.plot( # [stg.time[self.combobox_acoustic_data_choice.currentIndex()][ @@ -655,17 +650,17 @@ class AcousticInversionTab(QWidget): # for _, j in stg.fine_sample_position], # ls=" ", marker="o", ms=5, mec="k", mfc="k") - cbar_SSC_fine = self.figure_SSC_fine.colorbar(pcm_SSC_fine, ax=self.axis_SSC_fine, shrink=1, + cbar_SSC_fine = self.figure_SSC_fine.colorbar(pcm_SSC_fine, ax=self.axis_SSC_fine, shrink=1, location='right') - cbar_SSC_fine.set_label(label='Fine SSC (g/L', rotation=270, labelpad=15) + cbar_SSC_fine.set_label(label='Fine SSC (g/L', rotation=270, labelpad=15) - elif stg.ABS_name[0] == "UB-SediFlow": - pcm_SSC_fine = self.axis_SSC_fine.pcolormesh(stg.t[0, :], - -stg.r[0, :], - stg.SSC_fine, - cmap='rainbow', - norm=LogNorm(vmin=1e-2, vmax=10), - shading='gouraud') + # elif stg.ABS_name[0] == "UB-SediFlow": + # pcm_SSC_fine = self.axis_SSC_fine.pcolormesh(stg.t[0, :], + # -stg.r[0, :], + # stg.SSC_fine, + # cmap='rainbow', + # norm=LogNorm(vmin=1e-2, vmax=10), + # shading='gouraud') self.figure_SSC_fine.supxlabel("Time (sec)", fontsize=10) self.figure_SSC_fine.supylabel("Depth (m)", fontsize=10) @@ -1210,15 +1205,9 @@ class AcousticInversionTab(QWidget): val_min = np.nanmin(stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()]) val_max = np.nanmax(stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()]) - print("ABS name ", stg.ABS_name) + # if stg.ABS_name[0] == "Aquascat 1000R": - if stg.ABS_name[0] == "Aquascat 1000R": - - print("hey !") - - if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - - print("hey hey !") + if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): # print("time cross section ", stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # stg.frequency_for_inversion[1]]) @@ -1226,38 +1215,38 @@ class AcousticInversionTab(QWidget): # stg.frequency_for_inversion[1]]) # print(stg.frequency_for_inversion[1]) - pcm_SSC_sand = self.axis_SSC_sand.pcolormesh( - stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()], - cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=10), shading='gouraud') + pcm_SSC_sand = self.axis_SSC_sand.pcolormesh( + stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()], + cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=10), shading='gouraud') - if stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - self.axis_SSC_sand.plot(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - -stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()], - color='black', linewidth=1, linestyle="solid") + if stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + self.axis_SSC_sand.plot(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + -stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()], + color='black', linewidth=1, linestyle="solid") - self.pcm_SSC_sand_vertical_line, = self.axis_SSC_sand.plot( - stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1], - self.slider_sand.value() - 1] * - np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[ - 1]].shape), - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - linestyle="solid", color='r', linewidth=2) + self.pcm_SSC_sand_vertical_line, = self.axis_SSC_sand.plot( + stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1], + self.slider_sand.value() - 1] * + np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[ + 1]].shape), + -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + linestyle="solid", color='r', linewidth=2) - print("o+o+o+o+o+o") - print(stg.frequency_for_inversion[1]) - print([i for i, _ in stg.sand_sample_position]) + print("o+o+o+o+o+o") + print(stg.frequency_for_inversion[1]) + print([i for i, _ in stg.sand_sample_position]) # print([stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ # stg.frequency_for_inversion[1], i] # for i, _ in stg.fine_sample_position]) - print("o+o+o+o+o+o") + print("o+o+o+o+o+o") # self.pcm_SSC_fine_meas_vs_inv, = self.axis_SSC_fine.plot( # [stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ @@ -1268,7 +1257,7 @@ class AcousticInversionTab(QWidget): # for _, j in stg.fine_sample_position], # ls=" ", marker="o", ms=5, mec="k", mfc="k") - self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot(stg.time_sand, stg.depth_sand, + self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot(stg.time_sand, stg.depth_sand, ls=" ", marker="o", ms=5, mec="k", mfc="k") # print(stg.time_sand) @@ -1280,32 +1269,32 @@ class AcousticInversionTab(QWidget): # stg.depth_sand[j], # i) - else: + else: - pcm_SSC_sand = self.axis_SSC_sand.pcolormesh( - stg.time[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()], - cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=10), shading='gouraud') + pcm_SSC_sand = self.axis_SSC_sand.pcolormesh( + stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()], + cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=10), shading='gouraud') - if stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - self.axis_SSC_sand.plot(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - -stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()], - color='black', linewidth=1, linestyle="solid") + if stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + self.axis_SSC_sand.plot(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + -stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()], + color='black', linewidth=1, linestyle="solid") - self.pcm_SSC_sand_vertical_line, = self.axis_SSC_sand.plot( - stg.time[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1], - self.slider_sand.value() - 1] * - np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[ - 1]].shape), - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]], - linestyle="solid", color='r', linewidth=2) + self.pcm_SSC_sand_vertical_line, = self.axis_SSC_sand.plot( + stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1], + self.slider_sand.value() - 1] * + np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[ + 1]].shape), + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]], + linestyle="solid", color='r', linewidth=2) # self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot( # [stg.time[self.combobox_acoustic_data_choice.currentIndex()][ @@ -1316,59 +1305,59 @@ class AcousticInversionTab(QWidget): # for _, j in stg.sand_sample_position], # ls=" ", marker="o", ms=5, mec="k", mfc="k") - self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot(stg.time_sand, stg.depth_sand, - ls=" ", marker="o", ms=5, mec="k", mfc="k") + self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot(stg.time_sand, stg.depth_sand, + ls=" ", marker="o", ms=5, mec="k", mfc="k") - # --- Plot samples of fine sediments --- - time_sand_temp = deepcopy(stg.time_sand) - depth_sand_temp = deepcopy(stg.depth_sand) - print("0 time_sand_temp, depth_sand_temp, ", time_sand_temp, depth_sand_temp) - for s in stg.sand_sample_target: - print("s = ", s) - print(stg.time_sand[s[1]]) - print(stg.depth_sand[s[1]]) - time_sand_temp.remove(stg.time_sand[s[1]]) - depth_sand_temp.remove(stg.depth_sand[s[1]]) - print("1 time_sand_temp, depth_sand_temp, ", time_sand_temp, depth_sand_temp) - self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot( - time_sand_temp, depth_sand_temp, ls=" ", marker="o", ms=5, mec="k", mfc="k") + # --- Plot samples of fine sediments --- + time_sand_temp = deepcopy(stg.time_sand) + depth_sand_temp = deepcopy(stg.depth_sand) + print("0 time_sand_temp, depth_sand_temp, ", time_sand_temp, depth_sand_temp) + for s in stg.sand_sample_target: + print("s = ", s) + print(stg.time_sand[s[1]]) + print(stg.depth_sand[s[1]]) + time_sand_temp.remove(stg.time_sand[s[1]]) + depth_sand_temp.remove(stg.depth_sand[s[1]]) + print("1 time_sand_temp, depth_sand_temp, ", time_sand_temp, depth_sand_temp) + self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot( + time_sand_temp, depth_sand_temp, ls=" ", marker="o", ms=5, mec="k", mfc="k") - time_sand_temp = deepcopy(stg.time_sand) - depth_sand_temp = deepcopy(stg.depth_sand) - sample_sand_temp = deepcopy(stg.sample_sand) - print("0 sample_sand_temp ", sample_sand_temp) - for s in stg.sand_sample_target: - sample_sand_temp.remove(s) - time_sand_temp.remove(stg.time_sand[s[1]]) - depth_sand_temp.remove(stg.depth_sand[s[1]]) - print("1 sample_sand_temp ", sample_sand_temp) - for i in range(len(sample_sand_temp)): - self.pcm_SSC_sand_meas_vs_inv_text = self.axis_SSC_sand.text( - time_sand_temp[i], - depth_sand_temp[i], sample_sand_temp[i][0]) + time_sand_temp = deepcopy(stg.time_sand) + depth_sand_temp = deepcopy(stg.depth_sand) + sample_sand_temp = deepcopy(stg.sample_sand) + print("0 sample_sand_temp ", sample_sand_temp) + for s in stg.sand_sample_target: + sample_sand_temp.remove(s) + time_sand_temp.remove(stg.time_sand[s[1]]) + depth_sand_temp.remove(stg.depth_sand[s[1]]) + print("1 sample_sand_temp ", sample_sand_temp) + for i in range(len(sample_sand_temp)): + self.pcm_SSC_sand_meas_vs_inv_text = self.axis_SSC_sand.text( + time_sand_temp[i], + depth_sand_temp[i], sample_sand_temp[i][0]) - time_sand_temp, depth_sand_temp = stg.time_sand, stg.depth_sand - self.pcm_SSC_sand_meas_vs_inv_sample_calibration, = self.axis_SSC_sand.plot( - [time_sand_temp[s[1]] for s in stg.sand_sample_target], - [depth_sand_temp[s[1]] for s in stg.sand_sample_target], - ls=" ", marker="*", ms=12, mec="r", mfc="r") + time_sand_temp, depth_sand_temp = stg.time_sand, stg.depth_sand + self.pcm_SSC_sand_meas_vs_inv_sample_calibration, = self.axis_SSC_sand.plot( + [time_sand_temp[s[1]] for s in stg.sand_sample_target], + [depth_sand_temp[s[1]] for s in stg.sand_sample_target], + ls=" ", marker="*", ms=12, mec="r", mfc="r") - time_sand_temp, depth_sand_temp = stg.time_sand, stg.depth_sand - for i, j in stg.sand_sample_target: - self.pcm_SSC_sand_meas_vs_inv_sample_calibration_text = self.axis_SSC_sand.text( - time_sand_temp[j] + 5, depth_sand_temp[j] + 0.05, i, color='r', fontweight='bold') + time_sand_temp, depth_sand_temp = stg.time_sand, stg.depth_sand + for i, j in stg.sand_sample_target: + self.pcm_SSC_sand_meas_vs_inv_sample_calibration_text = self.axis_SSC_sand.text( + time_sand_temp[j] + 5, depth_sand_temp[j] + 0.05, i, color='r', fontweight='bold') - cbar_SSC_sand = self.figure_SSC_sand.colorbar(pcm_SSC_sand, ax=self.axis_SSC_sand, shrink=1, + cbar_SSC_sand = self.figure_SSC_sand.colorbar(pcm_SSC_sand, ax=self.axis_SSC_sand, shrink=1, location='right') - cbar_SSC_sand.set_label(label='Sand SSC (g/L', rotation=270, labelpad=15) + cbar_SSC_sand.set_label(label='Sand SSC (g/L', rotation=270, labelpad=15) - elif stg.ABS_name[0] == "UB-SediFlow": - pcm_SSC_sand = self.axis_SSC_sand.pcolormesh(stg.t[0, :], - -stg.r[0, :], - stg.SSC_sand, - cmap='rainbow', - norm=LogNorm(vmin=1e-2, vmax=10), - shading='gouraud') + # elif stg.ABS_name[0] == "UB-SediFlow": + # pcm_SSC_sand = self.axis_SSC_sand.pcolormesh(stg.t[0, :], + # -stg.r[0, :], + # stg.SSC_sand, + # cmap='rainbow', + # norm=LogNorm(vmin=1e-2, vmax=10), + # shading='gouraud') self.figure_SSC_sand.supxlabel("Time (sec)", fontsize=10) self.figure_SSC_sand.supylabel("Depth (m)", fontsize=10) diff --git a/View/plot_noise_window.py b/View/plot_noise_window.py index 8fdf911..590411d 100644 --- a/View/plot_noise_window.py +++ b/View/plot_noise_window.py @@ -51,6 +51,8 @@ class PlotNoiseWindow(QDialog): for freq_ind, freq_val in enumerate(stg.freq[i]): + eval("self.ax" + str(i) + "[" + str(freq_ind) + "]" + ".cla()") + val_min = np.nanmin(stg.BS_noise_raw_data[i][freq_ind, :, :]) val_max = np.nanmax(stg.BS_noise_raw_data[i][freq_ind, :, :]) diff --git a/View/sediment_calibration_tab.py b/View/sediment_calibration_tab.py index b0358f8..1437cd5 100644 --- a/View/sediment_calibration_tab.py +++ b/View/sediment_calibration_tab.py @@ -268,6 +268,7 @@ class SedimentCalibrationTab(QWidget): self.pushbutton_compute_calibration = QPushButton() self.pushbutton_compute_calibration.setText("Compute Calibration") + self.pushbutton_compute_calibration.setToolTip("Calibration is computed at abscissa 'sand target'") self.gridLayout_groupbox_sediment_calibration_compute.addWidget(self.pushbutton_compute_calibration, 0, 0, 1, 3) # --- Calibration parameter --- @@ -329,7 +330,7 @@ class SedimentCalibrationTab(QWidget): self.label_ks_freq1_unit = QLabel() self.label_ks_freq1_unit.setText("m.kg-0.5") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_ks_freq1_unit, 4, 2, 1, 1, + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_ks_freq1_unit, 5, 2, 1, 1, Qt.AlignLeft) # self.spinbox_ks_freq2 = QDoubleSpinBox() @@ -338,16 +339,16 @@ class SedimentCalibrationTab(QWidget): self.lineEdit_ks_freq2 = QLineEdit() self.lineEdit_ks_freq2.setMaximumWidth(100) self.lineEdit_ks_freq2.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_ks_freq2, 4, 3, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_ks_freq2, 5, 3, 1, 1) self.label_ks_freq2_unit = QLabel() self.label_ks_freq2_unit.setText("m.kg-0.5") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_ks_freq2_unit, 4, 4, 1, 1, + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_ks_freq2_unit, 5, 4, 1, 1, Qt.AlignLeft) self.label_sv = QLabel() self.label_sv.setText("sv") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_sv, 5, 0, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_sv, 6, 0, 1, 1, Qt.AlignCenter) # self.spinbox_sv_freq1 = QDoubleSpinBox() # self.spinbox_sv_freq1.setDecimals(8) @@ -355,11 +356,11 @@ class SedimentCalibrationTab(QWidget): self.lineEdit_sv_freq1 = QLineEdit() self.lineEdit_sv_freq1.setMaximumWidth(100) self.lineEdit_sv_freq1.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_sv_freq1, 5, 1, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_sv_freq1, 6, 1, 1, 1) self.label_sv_freq1_unit = QLabel() self.label_sv_freq1_unit.setText("m-1") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_sv_freq1_unit, 5, 2, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_sv_freq1_unit, 6, 2, 1, 1) # self.spinbox_sv_freq2 = QDoubleSpinBox() # self.spinbox_sv_freq2.setDecimals(8) @@ -367,26 +368,26 @@ class SedimentCalibrationTab(QWidget): self.lineEdit_sv_freq2 = QLineEdit() self.lineEdit_sv_freq2.setMaximumWidth(100) self.lineEdit_sv_freq2.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_sv_freq2, 5, 3, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_sv_freq2, 6, 3, 1, 1) self.label_sv_freq2_unit = QLabel() self.label_sv_freq2_unit.setText("m-1") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_sv_freq2_unit, 5, 4, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_sv_freq2_unit, 6, 4, 1, 1) self.label_X = QLabel() self.label_X.setText("X") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_X, 6, 0, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_X, 7, 0, 1, 1, Qt.AlignCenter) # self.spinbox_X = QDoubleSpinBox() # self.spinbox_X.setDecimals(2) self.lineEdit_X = QLineEdit() self.lineEdit_X.setMaximumWidth(100) self.lineEdit_X.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_X, 6, 2, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_X, 7, 2, 1, 1, Qt.AlignCenter) self.label_alphas = QLabel() self.label_alphas.setText("\u03B1s") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_alphas, 7, 0, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_alphas, 8, 0, 1, 1, Qt.AlignCenter) # self.spinbox_alphas_freq1 = QDoubleSpinBox() # self.spinbox_alphas_freq1.setDecimals(4) @@ -394,11 +395,11 @@ class SedimentCalibrationTab(QWidget): self.lineEdit_alphas_freq1 = QLineEdit() self.lineEdit_alphas_freq1.setMaximumWidth(100) self.lineEdit_alphas_freq1.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_alphas_freq1, 7, 1, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_alphas_freq1, 8, 1, 1, 1) self.label_alphas_freq1_unit = QLabel() self.label_alphas_freq1_unit.setText("m-1") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_alphas_freq1_unit, 7, 2, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_alphas_freq1_unit, 8, 2, 1, 1, Qt.AlignLeft) # self.spinbox_alphas_freq2 = QDoubleSpinBox() # self.spinbox_alphas_freq2.setDecimals(4) @@ -406,15 +407,15 @@ class SedimentCalibrationTab(QWidget): self.lineEdit_alphas_freq2 = QLineEdit() self.lineEdit_alphas_freq2.setMaximumWidth(100) self.lineEdit_alphas_freq2.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_alphas_freq2, 7, 3, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_alphas_freq2, 8, 3, 1, 1) self.label_alphas_freq2_unit = QLabel() self.label_alphas_freq2_unit.setText("m-1") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_alphas_freq2_unit, 7, 4, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_alphas_freq2_unit, 8, 4, 1, 1, Qt.AlignLeft) self.label_zeta = QLabel() self.label_zeta.setText("\u03B6") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_zeta, 8, 0, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_zeta, 9, 0, 1, 1, Qt.AlignCenter) # self.spinbox_zeta_freq1 = QDoubleSpinBox() # self.spinbox_zeta_freq1.setDecimals(4) @@ -422,11 +423,11 @@ class SedimentCalibrationTab(QWidget): self.lineEdit_zeta_freq1 = QLineEdit() self.lineEdit_zeta_freq1.setMaximumWidth(100) self.lineEdit_zeta_freq1.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_zeta_freq1, 8, 1, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_zeta_freq1, 9, 1, 1, 1) self.label_zeta_freq1_unit = QLabel() self.label_zeta_freq1_unit.setText("m-1") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_zeta_freq1_unit, 8, 2, 1, 1, + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_zeta_freq1_unit, 9, 2, 1, 1, Qt.AlignLeft) # self.spinbox_zeta_freq2 = QDoubleSpinBox() @@ -435,16 +436,16 @@ class SedimentCalibrationTab(QWidget): self.lineEdit_zeta_freq2 = QLineEdit() self.lineEdit_zeta_freq2.setMaximumWidth(100) self.lineEdit_zeta_freq2.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_zeta_freq2, 8, 3, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_zeta_freq2, 9, 3, 1, 1) self.label_zeta_freq2_unit = QLabel() self.label_zeta_freq2_unit.setText("m-1") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_zeta_freq2_unit, 8, 4, 1, 1, + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_zeta_freq2_unit, 9, 4, 1, 1, Qt.AlignLeft) self.pushbutton_save_calibration = QPushButton() self.pushbutton_save_calibration.setText("Save calibration") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.pushbutton_save_calibration,9, 5, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.pushbutton_save_calibration,10, 5, 1, 1) # self.groupbox_calibration_compute_size_change() @@ -487,16 +488,39 @@ class SedimentCalibrationTab(QWidget): "to the obtained by the sediment calibration computation.") self.verticalLayout_groupbox_FCB_text.addWidget(self.label_FCB_explanation) + self.gridLayout_groupbox_FCB_text_alphas = QGridLayout() + self.verticalLayout_groupbox_FCB_text.addLayout(self.gridLayout_groupbox_FCB_text_alphas) + + self.label_FCB_explanation_alphas_positive_icon = QLabel() + self.label_FCB_explanation_alphas_positive_icon.setPixmap( + QPixmap(self.path_icon + "approved.png").scaledToHeight(16, Qt.SmoothTransformation)) + self.gridLayout_groupbox_FCB_text_alphas.addWidget( + self.label_FCB_explanation_alphas_positive_icon, 0, 0, 1, 1, Qt.AlignCenter) + + self.label_FCB_explanation_alphas_positive = QLabel() + self.label_FCB_explanation_alphas_positive.setText("αs FCB > 0 : comparison with calibration") + self.label_FCB_explanation_alphas_positive.setFont(QFont('Ubuntu', 12)) + self.gridLayout_groupbox_FCB_text_alphas.addWidget(self.label_FCB_explanation_alphas_positive, 0, 1, 1, 1, Qt.AlignLeft) + + self.label_FCB_explanation_alphas_negative_icon = QLabel() + self.label_FCB_explanation_alphas_negative_icon.setPixmap(QPixmap(self.path_icon + "no_approved.png").scaledToHeight(16, Qt.SmoothTransformation)) + self.gridLayout_groupbox_FCB_text_alphas.addWidget(self.label_FCB_explanation_alphas_negative_icon, 1, 0, 1, 1, Qt.AlignCenter) + + self.label_FCB_explanation_alphas_negative = QLabel() + self.label_FCB_explanation_alphas_negative.setText("αs FCB < 0 : do not compare with calibration") + self.label_FCB_explanation_alphas_negative.setFont(QFont('Ubuntu', 12)) + self.gridLayout_groupbox_FCB_text_alphas.addWidget(self.label_FCB_explanation_alphas_negative, 1, 1, 1, 1, Qt.AlignLeft) + self.groupbox_FCB_compute = QGroupBox() self.gridLayout_groupbox_FCB_compute = QGridLayout(self.groupbox_FCB_compute) self.verticalLayout_groupbox_FCB_option.addWidget(self.groupbox_FCB_compute) self.label_frequency_FCB = QLabel() self.label_frequency_FCB.setText("Frequency ") - self.gridLayout_groupbox_FCB_compute.addWidget(self.label_frequency_FCB, 0, 0, 1, 2, Qt.AlignCenter) + self.gridLayout_groupbox_FCB_compute.addWidget(self.label_frequency_FCB, 0, 0, 1, 3, Qt.AlignCenter) self.combobox_frequency_FCB = QComboBox() - self.gridLayout_groupbox_FCB_compute.addWidget(self.combobox_frequency_FCB, 0, 2, 1, 2, Qt.AlignCenter) + self.gridLayout_groupbox_FCB_compute.addWidget(self.combobox_frequency_FCB, 0, 3, 1, 3, Qt.AlignCenter) self.label_from = QLabel() self.label_from.setText("From ") @@ -506,22 +530,30 @@ class SedimentCalibrationTab(QWidget): self.lineEdit_FCB_from.setMaximumWidth(100) self.gridLayout_groupbox_FCB_compute.addWidget(self.lineEdit_FCB_from, 1, 1, 1, 1, Qt.AlignCenter) + self.label_FCB_from_unit = QLabel() + self.label_FCB_from_unit.setText("m") + self.gridLayout_groupbox_FCB_compute.addWidget(self.label_FCB_from_unit, 1, 2, 1, 1, Qt.AlignLeft) + self.label_to = QLabel() self.label_to.setText("to ") - self.gridLayout_groupbox_FCB_compute.addWidget(self.label_to, 1, 2, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_FCB_compute.addWidget(self.label_to, 1, 3, 1, 1, Qt.AlignCenter) self.lineEdit_FCB_to = QLineEdit() self.lineEdit_FCB_to.setMaximumWidth(100) - self.gridLayout_groupbox_FCB_compute.addWidget(self.lineEdit_FCB_to, 1, 3, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_FCB_compute.addWidget(self.lineEdit_FCB_to, 1, 4, 1, 1, Qt.AlignCenter) + + self.label_FCB_to_unit = QLabel() + self.label_FCB_to_unit.setText("m") + self.gridLayout_groupbox_FCB_compute.addWidget(self.label_FCB_to_unit, 1, 5, 1, 1, Qt.AlignLeft) self.pushbutton_FCB_fit = QPushButton() - self.pushbutton_FCB_fit.setText("Compute & Plot Linear regression") - self.gridLayout_groupbox_FCB_compute.addWidget(self.pushbutton_FCB_fit, 2, 0, 1, 4, Qt.AlignCenter) + self.pushbutton_FCB_fit.setText("Compute and Plot Linear regression") + self.gridLayout_groupbox_FCB_compute.addWidget(self.pushbutton_FCB_fit, 2, 0, 1, 3, Qt.AlignCenter) self.label_alphaS_FCB = QLabel() - self.label_alphaS_FCB.setText("\u03B1s = " + "0.0" + "dB/m") + self.label_alphaS_FCB.setText("αs = " + "0.0" + "dB/m") self.label_alphaS_FCB.setFont(QFont("Ubuntu", 14, QFont.Normal)) - self.gridLayout_groupbox_FCB_compute.addWidget(self.label_alphaS_FCB, 3, 1, 1, 2) + self.gridLayout_groupbox_FCB_compute.addWidget(self.label_alphaS_FCB, 2, 4, 1, 2) # --- Groupbox FCB plot --- self.verticalLayout_groupbox_FCB_plot_and_slider_FCB = QVBoxLayout() @@ -1015,6 +1047,8 @@ class SedimentCalibrationTab(QWidget): def summary_samples_choices(self): + self.pushbutton_compute_calibration.setToolTip("Calibration is computed at abscissa " + str(self.combobox_sand_sample_choice.currentText())) + for i in reversed(range(self.gridLayout_groupbox_interpolate_info.count())): self.gridLayout_groupbox_interpolate_info.itemAt(i).widget().setParent(None) @@ -2389,7 +2423,9 @@ class SedimentCalibrationTab(QWidget): self.combobox_frequency_FCB.currentIndex()] * stg.depth_real) - print("FCB ", stg.FCB.shape) + print("FCB shape", stg.FCB.shape) + print("FCB ", stg.FCB) + self.plot_FCB() @@ -2609,7 +2645,7 @@ class SedimentCalibrationTab(QWidget): # --- Display the value of alphaS compute with FCB --- self.label_alphaS_FCB.clear() - self.label_alphaS_FCB.setText(f"\u03B1s = {-0.5*stg.lin_reg[0]:.4f} dB/m") + self.label_alphaS_FCB.setText(f"αs = {-0.5*stg.lin_reg[0]:.4f} dB/m") # if stg.FCB.size == 0: # msgBox = QMessageBox() diff --git a/View/signal_processing_tab.py b/View/signal_processing_tab.py index b0bf889..3b99c0c 100644 --- a/View/signal_processing_tab.py +++ b/View/signal_processing_tab.py @@ -1356,16 +1356,27 @@ class SignalProcessingTab(QWidget): print("0 plot SNR with SNR_stream_bed") val_min = np.nanmin(stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) val_max = np.nanmax(stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) - + print(f"val min = {val_min}, val max = {val_max}") if val_min == val_max: levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) + print("levels 0 = ", levels) + bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] + norm = BoundaryNorm(boundaries=bounds, ncolors=300) else: if val_min == 0: val_min = 1e-5 if val_max > 1000: levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) + print("levels 1 = ", levels) + bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] + print("bounds 1 = ", bounds) + norm = BoundaryNorm(boundaries=bounds, ncolors=300) else: levels = np.array([00.1, 1, 2, 10, 100, val_max]) + print("levels 2 = ", levels) + bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1000] + print("bounds 2 = ", bounds) + norm = BoundaryNorm(boundaries=bounds, ncolors=300) bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] norm = BoundaryNorm(boundaries=bounds, ncolors=300) @@ -1408,15 +1419,28 @@ class SignalProcessingTab(QWidget): print("1 plot SNR with SNR_cross_section") val_min = np.nanmin(stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) val_max = np.nanmax(stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) + print(f"val min = {val_min}, val max = {val_max}") if val_min == val_max: levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) + print("levels 0 = ", levels) + bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] + norm = BoundaryNorm(boundaries=bounds, ncolors=300) else: if val_min == 0: val_min = 1e-5 if val_max > 1000: levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) + print("levels 1 = ", levels) + bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] + print("bounds 1 = ", bounds) + norm = BoundaryNorm(boundaries=bounds, ncolors=300) + else: levels = np.array([00.1, 1, 2, 10, 100, val_max]) + print("levels 2 = ", levels) + bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1000] + print("bounds 2 = ", bounds) + norm = BoundaryNorm(boundaries=bounds, ncolors=300) bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] norm = BoundaryNorm(boundaries=bounds, ncolors=300) @@ -1434,29 +1458,33 @@ class SignalProcessingTab(QWidget): print("0 plot SNR with SNR_raw_data") val_min = np.nanmin(stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) val_max = np.nanmax(stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, :]) + print(f"val min = {val_min}, val max = {val_max}") if val_min == val_max: levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) + print("levels 0 = ", levels) + bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] + norm = BoundaryNorm(boundaries=bounds, ncolors=300) else: if val_min == 0: val_min = 1e-5 if val_max > 1000: levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) - print("levels = ", levels) + print("levels 1 = ", levels) bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] - print("bounds = ", bounds) + print("bounds 1 = ", bounds) norm = BoundaryNorm(boundaries=bounds, ncolors=300) else: levels = np.array([00.1, 1, 2, 10, 100, val_max]) - print("levels = ", levels) + print("levels 2 = ", levels) bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1000] - print("bounds = ", bounds) + print("bounds 2 = ", bounds) norm = BoundaryNorm(boundaries=bounds, ncolors=300) print("self.combobox_acoustic_data_choice.currentIndex() ", self.combobox_acoustic_data_choice.currentIndex()) print("x ", x.shape) print("y ", y.shape) print("stg.SNR_raw_data", stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape) - + print("levels before cf ", levels) cf = (self.axis_SNR[f].contourf(x, -y, stg.SNR_raw_data[ self.combobox_acoustic_data_choice.currentIndex()][f, :, :],