diff --git a/Model/acoustic_data_loader.py b/Model/acoustic_data_loader.py index e068bfd..423185e 100644 --- a/Model/acoustic_data_loader.py +++ b/Model/acoustic_data_loader.py @@ -48,6 +48,9 @@ class AcousticDataLoader: self._gain_rx = self._data_BS.RxGain.tolist() self._gain_tx = self._data_BS.TxGain.tolist() + # print((self._cell_size)) + # print((self._nb_pings_averaged_per_profile)) + # print(self._r[0, :][1] - self._r[1, :][0]) # print(type(self._nb_cells), self._nb_cells) @@ -113,7 +116,7 @@ class AcousticDataLoader: def compute_r_2D(self): r2D = np.zeros((self._freq.shape[0], self._r.shape[1], self._time.shape[1])) for f, _ in enumerate(self._freq): - r2D[f, :, :] = np.repeat(np.transpose(self._r[0, :])[:, np.newaxis], self._time.shape[1], axis=1) + r2D[f, :, :] = np.repeat(np.transpose(self._r[f, :])[:, np.newaxis], self._time.shape[1], axis=1) print(r2D.shape) return r2D diff --git a/View/acoustic_data_tab.py b/View/acoustic_data_tab.py index c81e823..f1acdb6 100644 --- a/View/acoustic_data_tab.py +++ b/View/acoustic_data_tab.py @@ -4,7 +4,7 @@ from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout, QGroupBox, QPush QGridLayout, QSpinBox, QDoubleSpinBox, QTableView, QTableWidget, QSpacerItem, QSizePolicy, QAbstractScrollArea, QFileDialog, QTableWidgetItem, QMessageBox, QScrollBar, QScrollArea, QProgressBar, QRadioButton, QFormLayout, QSlider, QAbstractItemView, QMenu, QItemDelegate, - QCheckBox, QAbstractSpinBox) + QCheckBox, QAbstractSpinBox, QTabWidget) from PyQt5.QtGui import QPixmap, QIcon, QFont, QMouseEvent, QIntValidator, QDoubleValidator from PyQt5.QtCore import Qt, QCoreApplication, pyqtSignal, pyqtSlot, QEvent, QSize, QPropertyAnimation @@ -89,6 +89,7 @@ class AcousticDataTab(QWidget): ### --- General layout of widgets --- self.verticalLayoutMain = QVBoxLayout(tab_widget) + # self.setLayout(self.verticalLayoutMain) self.horizontalLayoutTop = QHBoxLayout() self.verticalLayoutMain.addLayout(self.horizontalLayoutTop, 5) # 1O units is 100% , 1 units is 10% @@ -2181,6 +2182,7 @@ class AcousticDataTab(QWidget): self.water_attenuation() stg.acoustic_data = list(range(self.fileListWidget.count())) + print("acoustic data ", stg.acoustic_data) def rename_file_in_ListWidget(self, event): @@ -2244,7 +2246,7 @@ class AcousticDataTab(QWidget): self.label_hour_acoustic_file.clear() self.label_hour_acoustic_file.setText("Hour: ") # self.spinbox_temperature.setValue(0) - self.lineEdit_temperature.setText("0.00") + # self.lineEdit_temperature.setText("0.00") # self.spinbox_speed_of_sound.setValue(0) # self.spinbox_sound_attenuation.setValue(0) self.lineEdit_sound_attenuation.setText("0.00") @@ -2356,7 +2358,7 @@ class AcousticDataTab(QWidget): self.label_hour_acoustic_file.clear() self.label_hour_acoustic_file.setText("Hour: ") # self.spinbox_temperature.setValue(0) - self.lineEdit_temperature.setText("0.00") + # self.lineEdit_temperature.setText("0.00") # self.spinbox_speed_of_sound.setValue(0) # self.spinbox_sound_attenuation.setValue(0) self.lineEdit_sound_attenuation.setText("0.00") @@ -2517,8 +2519,9 @@ class AcousticDataTab(QWidget): 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_2D.append(np.array([])) + stg.depth_2D.append(acoustic_data.compute_r_2D()) + print("stg.depth_2D ", len(stg.depth_2D), stg.depth_2D[0].shape) + # stg.depth_2D.append(np.array([])) stg.depth_reshape.append(acoustic_data.reshape_r()) stg.time.append(acoustic_data._time) stg.time_reshape.append(acoustic_data.reshape_t()) @@ -2564,7 +2567,7 @@ class AcousticDataTab(QWidget): stg.val_bottom.append([]) stg.ind_bottom.append([]) stg.freq_bottom_detection.append(()) - stg.depth_bottom_detection_1st_int_area.append([]) + # stg.depth_bottom_detection_1st_int_area.append([]) stg.BS_mean.append(np.array([])) stg.BS_noise_raw_data.append(np.array([])) @@ -2583,15 +2586,12 @@ class AcousticDataTab(QWidget): stg.BS_raw_data_pre_process_SNR.append(np.array([])) stg.BS_raw_data_pre_process_average.append(np.array([])) - stg.BS_raw_data_pre_process_SNR_average.append(np.array([])) stg.BS_cross_section_pre_process_SNR.append(np.array([])) stg.BS_cross_section_pre_process_average.append(np.array([])) - stg.BS_cross_section_pre_process_SNR_average.append(np.array([])) stg.BS_stream_bed_pre_process_SNR.append(np.array([])) stg.BS_stream_bed_pre_process_average.append(np.array([])) - stg.BS_stream_bed_pre_process_SNR_average.append(np.array([])) # stg.FCB.append([]) # stg.depth_real.append([]) @@ -2603,6 +2603,7 @@ class AcousticDataTab(QWidget): # stg.fine_sample_position.append([]) # stg.sand_sample_position.append([]) + stg.J_cross_section.append([]) stg.VBI_cross_section.append(np.array([])) stg.SSC_fine.append(np.array([])) stg.SSC_sand.append(np.array([])) @@ -2659,7 +2660,7 @@ class AcousticDataTab(QWidget): self.combobox_frequency_information.currentIndexChanged.connect(self.combobox_frequency_information_update) # self.spinbox_temperature.setValue(0) - self.lineEdit_temperature.setText("0.00") + self.lineEdit_temperature.setText(str(stg.temperature)) self.label_profiles_value.setText(str(stg.nb_profiles[self.fileListWidget.currentRow()] [self.combobox_frequency_information.currentIndex()])) diff --git a/View/acoustic_inversion_tab.py b/View/acoustic_inversion_tab.py index 0ae7332..2a69f26 100644 --- a/View/acoustic_inversion_tab.py +++ b/View/acoustic_inversion_tab.py @@ -424,7 +424,8 @@ class AcousticInversionTab(QWidget): stg.frequencies_for_calibration[1][0]) print(stg.frequency_for_inversion) print(stg.zeta[0], stg.zeta[1]) - print(stg.J_cross_section[0].shape, stg.J_cross_section[0].shape) + print(stg.J_cross_section[self.combobox_acoustic_data_choice.currentIndex()][0].shape, + stg.J_cross_section[self.combobox_acoustic_data_choice.currentIndex()][1].shape) print(stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()].shape) print(stg.alpha_s[0], stg.alpha_s[1]) print(stg.X_exponent[0]) @@ -433,7 +434,8 @@ class AcousticInversionTab(QWidget): freq1=stg.frequencies_for_calibration[0][0], freq2=stg.frequencies_for_calibration[1][0], zeta_freq1=stg.zeta[0], zeta_freq2=stg.zeta[1], - j_cross_section_freq1=stg.J_cross_section[0], j_cross_section_freq2=stg.J_cross_section[1], + j_cross_section_freq1=stg.J_cross_section[self.combobox_acoustic_data_choice.currentIndex()][0], + j_cross_section_freq2=stg.J_cross_section[self.combobox_acoustic_data_choice.currentIndex()][1], r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][ stg.frequency_for_inversion[1]], water_attenuation_freq1=stg.alpha_s[0], water_attenuation_freq2=stg.alpha_s[1], @@ -452,7 +454,7 @@ class AcousticInversionTab(QWidget): # print(stg.VBI_cross_section.shape) print(stg.frequencies_for_calibration[1][0]) print(stg.X_exponent[0]) - print(stg.J_cross_section[1].shape) + print(stg.J_cross_section[self.combobox_acoustic_data_choice.currentIndex()][1].shape) print(stg.water_attenuation) print(np.full(shape=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][ stg.frequency_for_inversion[1]].shape, @@ -466,7 +468,7 @@ class AcousticInversionTab(QWidget): VBI=stg.VBI_cross_section[self.combobox_acoustic_data_choice.currentIndex()], freq=stg.frequencies_for_calibration[1][0], X=stg.X_exponent[0], - j_cross_section=stg.J_cross_section[1], + j_cross_section=stg.J_cross_section[self.combobox_acoustic_data_choice.currentIndex()][1], alpha_w=np.full(shape=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][ stg.frequency_for_inversion[1]].shape, fill_value=stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][ diff --git a/View/sediment_calibration_tab.py b/View/sediment_calibration_tab.py index 1437cd5..9fa1f65 100644 --- a/View/sediment_calibration_tab.py +++ b/View/sediment_calibration_tab.py @@ -24,6 +24,9 @@ from os import path from View.checkable_combobox import CheckableComboBox from Model.acoustic_inversion_method_high_concentration import AcousticInversionMethodHighConcentration +from settings import J_cross_section + + # from settings import depth_cross_section, BS_raw_data_pre_process_average, BS_raw_data_pre_process_SNR, BS_raw_data, \ # path_calibration_file @@ -641,7 +644,7 @@ class SedimentCalibrationTab(QWidget): def function_pushbutton_update_acoustic_file(self): self.update_acoustic_data() - self.compute_depth_2D() + # self.compute_depth_2D() def function_pushbutton_plot_sample(self): self.sample_choice_for_calibration() @@ -1490,7 +1493,7 @@ class SedimentCalibrationTab(QWidget): # stg.zeta = [self.spinbox_zeta_freq1.value(), self.spinbox_zeta_freq2.value()] stg.zeta = [float(self.lineEdit_zeta_freq1.text()), float(self.lineEdit_zeta_freq2.text())] - self.compute_depth_2D() + # self.compute_depth_2D() self.compute_kt2D_kt3D() self.compute_J_cross_section() @@ -1844,42 +1847,47 @@ class SedimentCalibrationTab(QWidget): def compute_J_cross_section(self): - kt2D, kt3D = self.compute_kt2D_kt3D() + for i in range(self.combobox_acoustic_data_choice.count()): - # --- Compute J --- - if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + kt2D, kt3D = self.compute_kt2D_kt3D() - J_cross_section_freq1 = self.inv_hc.j_cross_section( - BS=stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[0][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], - :, :], - kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) + J_cross_section_freq1 = np.array([]) + J_cross_section_freq2 = np.array([]) - J_cross_section_freq2 = self.inv_hc.j_cross_section( - BS=stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[1][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], - :, :], - kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) + # --- Compute J --- + if stg.BS_stream_bed_pre_process_average[i].shape != (0,): - elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + J_cross_section_freq1 = self.inv_hc.j_cross_section( + BS=stg.BS_stream_bed_pre_process_average[i][ + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1], + :, :], + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) - J_cross_section_freq1 = self.inv_hc.j_cross_section( - BS=stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[0][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], - :, :], - kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) + J_cross_section_freq2 = self.inv_hc.j_cross_section( + BS=stg.BS_stream_bed_pre_process_average[i][ + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1], + :, :], + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) - J_cross_section_freq2 = self.inv_hc.j_cross_section( - BS=stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[1][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], - :, :], - kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) + elif stg.BS_stream_bed_pre_process_SNR[i].shape != (0,): - elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + J_cross_section_freq1 = self.inv_hc.j_cross_section( + BS=stg.BS_stream_bed_pre_process_SNR[i][ + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1], + :, :], + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) + + J_cross_section_freq2 = self.inv_hc.j_cross_section( + BS=stg.BS_stream_bed_pre_process_SNR[i][ + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1], + :, :], + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) + + elif stg.BS_stream_bed[i].shape != (0,): # stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = ( # np.zeros(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape)) @@ -1912,152 +1920,152 @@ class SedimentCalibrationTab(QWidget): # print("kt3D shape ", kt3D.shape) # print("kt3D ", kt3D) - J_cross_section_freq1 = self.inv_hc.j_cross_section( - BS=stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], :, :], - kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) + J_cross_section_freq1 = self.inv_hc.j_cross_section( + BS=stg.BS_stream_bed[i][stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) - J_cross_section_freq2 = self.inv_hc.j_cross_section( - BS=stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[1][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], :, :], - kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) + J_cross_section_freq2 = self.inv_hc.j_cross_section( + BS=stg.BS_stream_bed[i][ + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) - elif stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_cross_section_pre_process_average[i].shape != (0,): - J_cross_section_freq1 = self.inv_hc.j_cross_section( - BS=stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[0][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], - :, :], - kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) + J_cross_section_freq1 = self.inv_hc.j_cross_section( + BS=stg.BS_cross_section_pre_process_average[i][ + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1], + :, :], + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) - J_cross_section_freq2 = self.inv_hc.j_cross_section( - BS=stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[1][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], - :, :], - kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) + J_cross_section_freq2 = self.inv_hc.j_cross_section( + BS=stg.BS_cross_section_pre_process_average[i][ + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1], + :, :], + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) - elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_cross_section_pre_process_SNR[i].shape != (0,): - J_cross_section_freq1 = self.inv_hc.j_cross_section( - BS=stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[0][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], - :, :], - kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) + J_cross_section_freq1 = self.inv_hc.j_cross_section( + BS=stg.BS_cross_section_pre_process_SNR[i][ + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1], + :, :], + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) - J_cross_section_freq2 = self.inv_hc.j_cross_section( - BS=stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[1][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], - :, :], - kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) + J_cross_section_freq2 = self.inv_hc.j_cross_section( + BS=stg.BS_cross_section_pre_process_SNR[i][ + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1], + :, :], + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) - elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_cross_section[i].shape != (0,): - # stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = np.zeros(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape) - # for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): - # stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] = np.repeat( - # np.transpose(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()] - # [self.combobox_freq1.currentIndex()])[:, np.newaxis], - # stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], - # axis=1) - # - # if stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]: - # kt2D = np.repeat(np.array(stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]), - # stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], - # axis=1) - # kt3D = np.repeat(kt2D[:, :, np.newaxis], - # stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2) - # else: - # kt2D = np.repeat(np.array(stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]), - # stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], - # axis=1) - # kt3D = np.repeat(kt2D[:, :, np.newaxis], - # stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2) + # stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = np.zeros(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape) + # for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + # stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] = np.repeat( + # np.transpose(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()] + # [self.combobox_freq1.currentIndex()])[:, np.newaxis], + # stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], + # axis=1) + # + # if stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]: + # kt2D = np.repeat(np.array(stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]), + # stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], + # axis=1) + # kt3D = np.repeat(kt2D[:, :, np.newaxis], + # stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2) + # else: + # kt2D = np.repeat(np.array(stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]), + # stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], + # axis=1) + # kt3D = np.repeat(kt2D[:, :, np.newaxis], + # stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2) - J_cross_section_freq1 = self.inv_hc.j_cross_section( - BS=stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[0][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex(), :, :][stg.frequencies_for_calibration[0][1], :, :], - kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) + J_cross_section_freq1 = self.inv_hc.j_cross_section( + BS=stg.BS_cross_section[i][ + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[i, :, :][stg.frequencies_for_calibration[0][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) - J_cross_section_freq2 = self.inv_hc.j_cross_section( - BS=stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[1][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex(), :, :][stg.frequencies_for_calibration[1][1], :, :], - kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) + J_cross_section_freq2 = self.inv_hc.j_cross_section( + BS=stg.BS_cross_section[i][ + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[i, :, :][stg.frequencies_for_calibration[1][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) - elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_raw_data_pre_process_average[i].shape != (0,): - J_cross_section_freq1 = self.inv_hc.j_cross_section( - BS=stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[0][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], :, :], - kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) + J_cross_section_freq1 = self.inv_hc.j_cross_section( + BS=stg.BS_raw_data_pre_process_average[i][ + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) - J_cross_section_freq2 = self.inv_hc.j_cross_section( - BS=stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[1][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], :, :], - kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) + J_cross_section_freq2 = self.inv_hc.j_cross_section( + BS=stg.BS_raw_data_pre_process_average[i][ + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) - elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_raw_data_pre_process_SNR[i].shape != (0,): - J_cross_section_freq1 = self.inv_hc.j_cross_section( - BS=stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[0][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], :, :], - kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) + J_cross_section_freq1 = self.inv_hc.j_cross_section( + BS=stg.BS_raw_data_pre_process_SNR[i][ + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) - J_cross_section_freq2 = self.inv_hc.j_cross_section( - BS=stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[1][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], :, :], - kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) + J_cross_section_freq2 = self.inv_hc.j_cross_section( + BS=stg.BS_raw_data_pre_process_SNR[i][ + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) - elif stg.BS_raw_data: + elif stg.BS_raw_data: - # stg.depth_2D = np.zeros(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape) - # for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): - # stg.depth_2D[f, :, :] = np.repeat( - # np.transpose(stg.depth[self.combobox_acoustic_data_choice.currentIndex()] - # [self.combobox_freq1.currentIndex()])[:, np.newaxis], - # stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1], - # axis=1) - # - # if stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]: - # kt2D = np.repeat(np.array(stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]), - # stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1], - # axis=1) - # kt3D = np.repeat(kt2D[:, :, np.newaxis], - # stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2) - # else: - # kt2D = np.repeat(np.array(stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]), - # stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1], - # axis=1) - # kt3D = np.repeat(kt2D[:, :, np.newaxis], - # stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2) + # stg.depth_2D = np.zeros(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape) + # for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + # stg.depth_2D[f, :, :] = np.repeat( + # np.transpose(stg.depth[self.combobox_acoustic_data_choice.currentIndex()] + # [self.combobox_freq1.currentIndex()])[:, np.newaxis], + # stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1], + # axis=1) + # + # if stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]: + # kt2D = np.repeat(np.array(stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]), + # stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1], + # axis=1) + # kt3D = np.repeat(kt2D[:, :, np.newaxis], + # stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2) + # else: + # kt2D = np.repeat(np.array(stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]), + # stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1], + # axis=1) + # kt3D = np.repeat(kt2D[:, :, np.newaxis], + # stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2) - J_cross_section_freq1 = self.inv_hc.j_cross_section( - BS=stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[0][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1], :, :], - kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) + J_cross_section_freq1 = self.inv_hc.j_cross_section( + BS=stg.BS_raw_data[i][ + stg.frequencies_for_calibration[0][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[0][1], :, :]) - J_cross_section_freq2 = self.inv_hc.j_cross_section( - BS=stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequencies_for_calibration[1][1], :, :], - r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1], :, :], - kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) + J_cross_section_freq2 = self.inv_hc.j_cross_section( + BS=stg.BS_raw_data[i][ + stg.frequencies_for_calibration[1][1], :, :], + r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1], :, :], + kt=kt3D[stg.frequencies_for_calibration[1][1], :, :]) - stg.J_cross_section.append(J_cross_section_freq1) - stg.J_cross_section.append(J_cross_section_freq2) + stg.J_cross_section[i].append(J_cross_section_freq1) + stg.J_cross_section[i].append(J_cross_section_freq2) - print("J_cross_section_freq1.shape ", J_cross_section_freq1.shape) - print("J_cross_section_freq2.shape ", J_cross_section_freq2.shape) + print(f"J_cross_section {str(i)} freq1 shape ", J_cross_section_freq1.shape, J_cross_section[i][0].shape) + print(f"J_cross_section {str(i)} freq2 shape ", J_cross_section_freq2.shape, J_cross_section[i][1].shape) def compute_alpha_s(self): @@ -2066,8 +2074,8 @@ class SedimentCalibrationTab(QWidget): alpha_s_freq1 = self.inv_hc.alpha_s( sv=stg.sv[0], - j_cross_section=stg.J_cross_section[0][stg.sand_sample_target_indice[0][0], - stg.sand_sample_target_indice[0][1]], + j_cross_section=stg.J_cross_section[self.combobox_acoustic_data_choice.currentIndex()][0][ + stg.sand_sample_target_indice[0][0], stg.sand_sample_target_indice[0][1]], depth=stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_freq1.currentIndex(), stg.sand_sample_target_indice[0][0]], alpha_w=stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][ @@ -2075,8 +2083,8 @@ class SedimentCalibrationTab(QWidget): alpha_s_freq2 = self.inv_hc.alpha_s( sv=stg.sv[1], - j_cross_section=stg.J_cross_section[1][stg.sand_sample_target_indice[1][0], - stg.sand_sample_target_indice[1][1]], + j_cross_section=stg.J_cross_section[self.combobox_acoustic_data_choice.currentIndex()][1][ + stg.sand_sample_target_indice[1][0], stg.sand_sample_target_indice[1][1]], depth=stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_freq2.currentIndex(), stg.sand_sample_target_indice[1][0]], alpha_w=stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][ @@ -2086,8 +2094,8 @@ class SedimentCalibrationTab(QWidget): alpha_s_freq1 = self.inv_hc.alpha_s( sv=stg.sv[0], - j_cross_section=stg.J_cross_section[0][stg.sand_sample_target_indice[0][0], - stg.sand_sample_target_indice[0][1]], + j_cross_section=stg.J_cross_section[self.combobox_acoustic_data_choice.currentIndex()][0][ + stg.sand_sample_target_indice[0][0], stg.sand_sample_target_indice[0][1]], depth=stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_freq1.currentIndex(), stg.sand_sample_target_indice[0][0]], alpha_w=stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][ @@ -2095,8 +2103,8 @@ class SedimentCalibrationTab(QWidget): alpha_s_freq2 = self.inv_hc.alpha_s( sv=stg.sv[1], - j_cross_section=stg.J_cross_section[1][stg.sand_sample_target_indice[1][0], - stg.sand_sample_target_indice[1][1]], + j_cross_section=stg.J_cross_section[self.combobox_acoustic_data_choice.currentIndex()][1][ + stg.sand_sample_target_indice[1][0], stg.sand_sample_target_indice[1][1]], depth=stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_freq2.currentIndex(), stg.sand_sample_target_indice[1][0]], alpha_w=stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][