From 50efdbfd57ff9411b50e84ffb0179f0506a4baed Mon Sep 17 00:00:00 2001 From: brahim Date: Tue, 4 Jun 2024 11:27:46 +0200 Subject: [PATCH] The parameter kt is divided in two parameter kt_read and kt_modified. In the measurement information groupbox, if checkbox is unchecked, spinbox is disabled and value is kt_read. If checkbox is checked, spinbox is enabled and value is kt_modified, and can be changed. --- View/acoustic_data_tab.py | 162 +++++++++++++++++++++++++------------- settings.py | 9 ++- 2 files changed, 112 insertions(+), 59 deletions(-) diff --git a/View/acoustic_data_tab.py b/View/acoustic_data_tab.py index 1b83d99..b9cff3a 100644 --- a/View/acoustic_data_tab.py +++ b/View/acoustic_data_tab.py @@ -1561,7 +1561,7 @@ class AcousticDataTab(QWidget): list_to_pop1 = ["stg.acoustic_data", "stg.date", "stg.hour", "stg.freq", "stg.freq_text", "stg.temperature", "stg.nb_profiles", "stg.nb_profiles_per_sec", "stg.nb_cells", "stg.cell_size", "stg.pulse_length", "stg.nb_pings_per_sec", "stg.nb_pings_averaged_per_profile", - "stg.kt", "stg.gain_rx", "stg.gain_tx", + "stg.kt_read", "stg.kt_corrected", "stg.gain_rx", "stg.gain_tx", "stg.BS_raw_data", "stg.time", "stg.depth", "stg.BS_raw_data_reshape", "stg.time_reshape", "stg.depth_reshape"] @@ -1639,7 +1639,7 @@ class AcousticDataTab(QWidget): list_to_clear = ["stg.acoustic_data", "stg.date", "stg.hour", "stg.freq", "stg.freq_text", "stg.temperature", "stg.nb_profiles", "stg.nb_profiles_per_sec", "stg.nb_cells", "stg.cell_size", "stg.pulse_length", "stg.nb_pings_per_sec", "stg.nb_pings_averaged_per_profile", - "stg.kt", "stg.gain_rx", "stg.gain_tx", + "stg.kt_read", "stg.kt_corrected", "stg.gain_rx", "stg.gain_tx", "stg.BS_raw_data", "stg.time", "stg.depth", "stg.BS_raw_data_reshape", "stg.time_reshape", "stg.depth_reshape", "stg.rmin", "stg.rmax", "stg.tmin", "stg.tmax", @@ -1740,29 +1740,30 @@ class AcousticDataTab(QWidget): print("Je suis dans le load_BS_acoustic_raw_data - 1") acoustic_data = AcousticDataLoader(stg.path_BS_raw_data[-1] + "/" + stg.filename_BS_raw_data[-1]) - stg.ABS_name.append(self.combobox_ABS_system_choice.currentText()) - stg.BS_raw_data.append(acoustic_data._BS_raw_data) - stg.BS_raw_data_reshape.append(acoustic_data.reshape_BS_raw_data()) - stg.depth.append(acoustic_data._r) - stg.depth_2D.append(acoustic_data.compute_r_2D()) - stg.depth_reshape.append(acoustic_data.reshape_r()) - stg.time.append(acoustic_data._time) - stg.time_reshape.append(acoustic_data.reshape_time()) - stg.freq.append(acoustic_data._freq) - stg.freq_text.append(acoustic_data._freq_text) - stg.date.append(acoustic_data._date) - stg.hour.append(acoustic_data._hour) - 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) - stg.cell_size.append(acoustic_data._cell_size) - 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.append(acoustic_data._kt) - stg.gain_rx.append(acoustic_data._gain_rx) - stg.gain_tx.append(acoustic_data._gain_tx) - stg.temperature.append(self.spinbox_temperature.value()) + # stg.ABS_name.append(self.combobox_ABS_system_choice.currentText()) + # stg.BS_raw_data.append(acoustic_data._BS_raw_data) + # stg.BS_raw_data_reshape.append(acoustic_data.reshape_BS_raw_data()) + # stg.depth.append(acoustic_data._r) + # stg.depth_2D.append(acoustic_data.compute_r_2D()) + # stg.depth_reshape.append(acoustic_data.reshape_r()) + # stg.time.append(acoustic_data._time) + # stg.time_reshape.append(acoustic_data.reshape_time()) + # stg.freq.append(acoustic_data._freq) + # stg.freq_text.append(acoustic_data._freq_text) + # stg.date.append(acoustic_data._date) + # stg.hour.append(acoustic_data._hour) + # 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) + # stg.cell_size.append(acoustic_data._cell_size) + # 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.append(acoustic_data._kt) + # stg.kt_corrected.append(acoustic_data._kt) + # stg.gain_rx.append(acoustic_data._gain_rx) + # stg.gain_tx.append(acoustic_data._gain_tx) + # stg.temperature.append(self.spinbox_temperature.value()) # if self.fileListWidget.count() == 0: # @@ -1821,29 +1822,55 @@ class AcousticDataTab(QWidget): acoustic_data = AcousticDataLoaderUBSediFlow(stg.path_BS_raw_data[-1] + "/" + stg.filename_BS_raw_data[-1]) - stg.ABS_name.append(self.combobox_ABS_system_choice.currentText()) - stg.BS_raw_data.append(acoustic_data._BS_raw_data) - stg.BS_raw_data_reshape.append(acoustic_data.reshape_BS_raw_data()) - stg.depth.append(acoustic_data._r) - stg.depth_2D.append(acoustic_data.compute_r_2D()) - stg.depth_reshape.append(acoustic_data.reshape_r()) - stg.time.append(acoustic_data._time) - stg.time_reshape.append(acoustic_data.reshape_t()) - stg.freq.append(acoustic_data._freq) - stg.freq_text.append(acoustic_data._freq_text) - stg.date.append(acoustic_data._date) - stg.hour.append(acoustic_data._hour) - 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) - stg.cell_size.append(acoustic_data._cell_size) - 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.append(acoustic_data._kt) - stg.gain_rx.append(acoustic_data._gain_rx) - stg.gain_tx.append(acoustic_data._gain_tx) - stg.temperature.append(self.spinbox_temperature.value()) + # stg.ABS_name.append(self.combobox_ABS_system_choice.currentText()) + # stg.BS_raw_data.append(acoustic_data._BS_raw_data) + # stg.BS_raw_data_reshape.append(acoustic_data.reshape_BS_raw_data()) + # stg.depth.append(acoustic_data._r) + # stg.depth_2D.append(acoustic_data.compute_r_2D()) + # stg.depth_reshape.append(acoustic_data.reshape_r()) + # stg.time.append(acoustic_data._time) + # stg.time_reshape.append(acoustic_data.reshape_t()) + # stg.freq.append(acoustic_data._freq) + # stg.freq_text.append(acoustic_data._freq_text) + # stg.date.append(acoustic_data._date) + # stg.hour.append(acoustic_data._hour) + # 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) + # stg.cell_size.append(acoustic_data._cell_size) + # 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.append(acoustic_data._kt) + # stg.kt_corrected.append(acoustic_data._kt) + # stg.gain_rx.append(acoustic_data._gain_rx) + # stg.gain_tx.append(acoustic_data._gain_tx) + # stg.temperature.append(self.spinbox_temperature.value()) + + stg.ABS_name.append(self.combobox_ABS_system_choice.currentText()) + stg.BS_raw_data.append(acoustic_data._BS_raw_data) + stg.BS_raw_data_reshape.append(acoustic_data.reshape_BS_raw_data()) + stg.depth.append(acoustic_data._r) + stg.depth_2D.append(acoustic_data.compute_r_2D()) + stg.depth_reshape.append(acoustic_data.reshape_r()) + stg.time.append(acoustic_data._time) + stg.time_reshape.append(acoustic_data.reshape_t()) + stg.freq.append(acoustic_data._freq) + stg.freq_text.append(acoustic_data._freq_text) + stg.date.append(acoustic_data._date) + stg.hour.append(acoustic_data._hour) + 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) + stg.cell_size.append(acoustic_data._cell_size) + 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.append(acoustic_data._kt) + # stg.kt_corrected.append(acoustic_data._kt) + stg.gain_rx.append(acoustic_data._gain_rx) + stg.gain_tx.append(acoustic_data._gain_tx) + stg.temperature.append(self.spinbox_temperature.value()) # if self.fileListWidget.count() == 0: # @@ -1988,7 +2015,13 @@ class AcousticDataTab(QWidget): [self.combobox_frequency_information.currentIndex()])) self.gridLayout_goupbox_info.addWidget(self.label_pings_per_profile_value, 10, 1, 1, 1) - self.spinbox_kt.setValue(stg.kt[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()]) + stg.kt_corrected = deepcopy(stg.kt_read) + # if self.checkbox_kt.isChecked(): + # self.spinbox_kt.setValue( + # stg.kt_corrected[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()]) + # else: + self.spinbox_kt.setValue( + stg.kt_read[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()]) self.spinbox_kt.setSuffix(f" V.m^{1.5}") self.spinbox_kt.setEnabled(False) self.checkbox_kt.stateChanged.connect(self.activate_unactivate_spinbox_kt) @@ -2136,9 +2169,15 @@ class AcousticDataTab(QWidget): self.gridLayout_goupbox_info.addWidget(self.label_pings_per_profile_value, 10, 1, 1, 1) self.spinbox_kt.clear() - self.spinbox_kt.setValue(stg.kt[self.fileListWidget.currentRow()] - [self.combobox_frequency_information.currentIndex()]) - self.spinbox_kt.setSuffix(f"V.m^{1.5}") + if self.checkbox_kt.isChecked(): + print("combobox information update : checkbox checked") + self.spinbox_kt.setValue(stg.kt_corrected[self.fileListWidget.currentRow()] + [self.combobox_frequency_information.currentIndex()]) + else: + print("combobox information update : checkbox unchecked") + self.spinbox_kt.setValue(stg.kt_read[self.fileListWidget.currentRow()] + [self.combobox_frequency_information.currentIndex()]) + self.spinbox_kt.setSuffix(f" V.m^{1.5}") self.spinbox_rx.clear() self.spinbox_rx.setValue(stg.gain_rx[self.fileListWidget.currentRow()] @@ -2150,10 +2189,18 @@ class AcousticDataTab(QWidget): def activate_unactivate_spinbox_kt(self): if self.checkbox_kt.isChecked(): + print(f"checkbox checked : kt corrected {stg.kt_corrected}") + self.spinbox_kt.setValue(stg.kt_corrected[self.fileListWidget.currentRow()] + [self.combobox_frequency_information.currentIndex()]) self.spinbox_kt.setEnabled(True) + else: + print(f"checkbox unchecked : kt read {stg.kt_read}") + self.spinbox_kt.setValue(stg.kt_read[self.fileListWidget.currentRow()] + [self.combobox_frequency_information.currentIndex()]) self.spinbox_kt.setDisabled(True) + def activate_unactivate_spinbox_rx(self): if self.checkbox_rx.isChecked(): self.spinbox_rx.setEnabled(True) @@ -2163,13 +2210,18 @@ class AcousticDataTab(QWidget): def activate_unactivate_spinbox_tx(self): if self.checkbox_tx.isChecked(): self.spinbox_tx.setEnabled(True) + else: self.spinbox_tx.setDisabled(True) def kt_value(self): - stg.kt[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()] =\ - self.spinbox_kt.value() - # print(f"stg.kt : {stg.kt}") + print(f"0 stg.kt_read : {stg.kt_read}") + print(f"0 stg.kt_corrected {stg.kt_corrected}") + if self.checkbox_kt.isChecked(): + stg.kt_corrected[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()] = ( + self.spinbox_kt.value()) + print(f"1 stg.kt_read : {stg.kt_read}") + print(f"1 stg.kt_corrected {stg.kt_corrected}") def gain_rx_value(self): stg.gain_rx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()] =\ diff --git a/settings.py b/settings.py index d80a436..e7a3488 100644 --- a/settings.py +++ b/settings.py @@ -33,7 +33,8 @@ cell_size = [] pulse_length = [] nb_pings_per_sec = [] nb_pings_averaged_per_profile = [] -kt = [] +kt_read = [] +kt_corrected = [] gain_rx = [] gain_tx = [] @@ -139,9 +140,9 @@ X_exponent = np.array([]) zeta = np.array([]) -kt_corrected = np.array([]) -kt_corrected_2D = np.array([]) -kt_corrected_3D = np.array([]) +# kt_corrected = np.array([]) +# kt_corrected_2D = np.array([]) +# kt_corrected_3D = np.array([]) J_cross_section = np.array([]) J_stream_bed = np.array([[[]]])