By default, FCB groupbox is disabled. A sentence, is added in FCB option to explain when to use FCB.

dev-brahim
brahim 2024-10-22 10:55:29 +02:00
parent f4b2ade6d5
commit 5b012d0265
1 changed files with 49 additions and 27 deletions

View File

@ -24,8 +24,8 @@ from os import path
from View.checkable_combobox import CheckableComboBox
from Model.acoustic_inversion_method_high_concentration import AcousticInversionMethodHighConcentration
from settings import depth_cross_section, BS_raw_data_pre_process_average, BS_raw_data_pre_process_SNR, BS_raw_data, \
path_calibration_file
# from settings import depth_cross_section, BS_raw_data_pre_process_average, BS_raw_data_pre_process_SNR, BS_raw_data, \
# path_calibration_file
# from virtual_env.bin.odfimg import directory
@ -449,39 +449,60 @@ class SedimentCalibrationTab(QWidget):
self.groupbox_FCB.setTitle("Step 3 (optional) : Fluid Corrected Backscatter")
self.horizontalLayout_groupbox_FCB = QHBoxLayout(self.groupbox_FCB)
self.groupbox_FCB.setCheckable(True)
self.groupbox_FCB.setChecked(False)
# --- Groupbox FCB option ---
self.groupbox_FCB_option = QGroupBox()
self.gridLayout_groupbox_FCB_option = QGridLayout(self.groupbox_FCB_option)
self.verticalLayout_groupbox_FCB_option = QVBoxLayout(self.groupbox_FCB_option)
self.horizontalLayout_groupbox_FCB.addWidget(self.groupbox_FCB_option, 4)
self.groupbox_FCB_text = QGroupBox()
self.verticalLayout_groupbox_FCB_text = QVBoxLayout(self.groupbox_FCB_text)
self.verticalLayout_groupbox_FCB_option.addWidget(self.groupbox_FCB_text)
self.label_FCB_explanation = QLabel()
self.label_FCB_explanation.setText("When fine sediments concentration is constant \n "
"and effect on sound attenuation on sand is negligible, \n "
"this sediment attenuation alphas can be compared \n "
"to the obtained by the sediment calibration computation.")
self.verticalLayout_groupbox_FCB_text.addWidget(self.label_FCB_explanation)
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_option.addWidget(self.label_frequency_FCB, 0, 0, 1, 2)
self.gridLayout_groupbox_FCB_compute.addWidget(self.label_frequency_FCB, 0, 0, 1, 2, Qt.AlignCenter)
self.combobox_frequency_FCB = QComboBox()
self.gridLayout_groupbox_FCB_option.addWidget(self.combobox_frequency_FCB, 0, 2, 1, 2)
self.gridLayout_groupbox_FCB_compute.addWidget(self.combobox_frequency_FCB, 0, 2, 1, 2, Qt.AlignCenter)
self.label_from = QLabel()
self.label_from.setText("From ")
self.gridLayout_groupbox_FCB_option.addWidget(self.label_from, 1, 0, 1, 1)
self.gridLayout_groupbox_FCB_compute.addWidget(self.label_from, 1, 0, 1, 1, Qt.AlignCenter)
self.spinbox_FCB_from = QDoubleSpinBox()
self.gridLayout_groupbox_FCB_option.addWidget(self.spinbox_FCB_from, 1, 1, 1, 1)
self.lineEdit_FCB_from = QLineEdit()
self.lineEdit_FCB_from.setMaximumWidth(100)
self.gridLayout_groupbox_FCB_compute.addWidget(self.lineEdit_FCB_from, 1, 1, 1, 1, Qt.AlignCenter)
self.label_to = QLabel()
self.label_to.setText(" to ")
self.gridLayout_groupbox_FCB_option.addWidget(self.label_to, 1, 2, 1, 1)
self.label_to.setText("to ")
self.gridLayout_groupbox_FCB_compute.addWidget(self.label_to, 1, 2, 1, 1, Qt.AlignCenter)
self.spinbox_FCB_to = QDoubleSpinBox()
self.gridLayout_groupbox_FCB_option.addWidget(self.spinbox_FCB_to, 1, 3, 1, 1)
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.pushbutton_FCB_fit = QPushButton()
self.gridLayout_groupbox_FCB_option.addWidget(self.pushbutton_FCB_fit, 2, 1, 1, 2)
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.label_alphaS_FCB = QLabel()
self.label_alphaS_FCB.setText("\u03B1s = " + "0.0" + "dB/m")
self.label_alphaS_FCB.setFont(QFont("Ubuntu", 14, QFont.Normal))
self.gridLayout_groupbox_FCB_option.addWidget(self.label_alphaS_FCB, 3, 1, 1, 2)
self.gridLayout_groupbox_FCB_compute.addWidget(self.label_alphaS_FCB, 3, 1, 1, 2)
# --- Groupbox FCB plot ---
self.verticalLayout_groupbox_FCB_plot_and_slider_FCB = QVBoxLayout()
@ -560,6 +581,7 @@ class SedimentCalibrationTab(QWidget):
self.lineEdit_slider_FCB.returnPressed.connect(self.profile_number_on_lineEdit_FCB)
self.slider_FCB.valueChanged.connect(self.update_lineEdit_by_moving_slider_FCB)
self.pushbutton_FCB_fit.clicked.connect(self.fit_FCB_profile_with_linear_regression_and_compute_alphaS)
# ==============================================================================================================
@ -751,7 +773,7 @@ class SedimentCalibrationTab(QWidget):
self.combobox_freq2.currentIndex(), :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
val_min = np.nanmin(stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :])
@ -767,7 +789,7 @@ class SedimentCalibrationTab(QWidget):
self.combobox_freq2.currentIndex(), :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
val_min = np.nanmin(stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :])
@ -836,7 +858,7 @@ class SedimentCalibrationTab(QWidget):
# --- Plot vertical red line for position of FCB profile ---
if stg.sand_sample_target_indice:
if depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
@ -2313,7 +2335,7 @@ class SedimentCalibrationTab(QWidget):
self.combobox_frequency_FCB.currentIndex()] *
stg.depth_real)
elif BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
elif stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.FCB = \
(np.log(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()]) +
@ -2421,7 +2443,7 @@ class SedimentCalibrationTab(QWidget):
if stg.sand_sample_target_indice:
if depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
@ -2484,10 +2506,10 @@ class SedimentCalibrationTab(QWidget):
x = x0[np.where(np.isnan(y0) == False)]
# --- Find the indices of the values between which the linear regression is fitted ---
value1 = np.where(np.round(np.abs(x - self.spinbox_FCB_from.value()), 2) ==
np.min(np.round(np.abs(x - self.spinbox_FCB_from.value()), 2)))[0][0]
value2 = np.where(np.round(np.abs(x - self.spinbox_FCB_to.value()), 2) ==
np.min(np.round(np.abs(x - self.spinbox_FCB_to.value()), 2)))[0][0]
value1 = np.where(np.round(np.abs(x - float(self.lineEdit_FCB_from.text().replace(',','.'))), 2) ==
np.min(np.round(np.abs(x - float(self.lineEdit_FCB_from.text().replace(',','.'))), 2)))[0][0]
value2 = np.where(np.round(np.abs(x - float(self.lineEdit_FCB_to.text().replace(',', '.'))), 2) ==
np.min(np.round(np.abs(x - float(self.lineEdit_FCB_to.text().replace(',', '.'))), 2)))[0][0]
print("value1 ", value1)
print("value2 ", value2)
@ -2515,10 +2537,10 @@ class SedimentCalibrationTab(QWidget):
x = x0[np.where(np.isnan(y0) == False)]
# --- Find the indices of the values between which the linear regression is fitted ---
value1 = np.where(np.round(np.abs(x - self.spinbox_FCB_from.value()), 2) ==
np.min(np.round(np.abs(x - self.spinbox_FCB_from.value()), 2)))[0][0]
value2 = np.where(np.round(np.abs(x - self.spinbox_FCB_to.value()), 2) ==
np.min(np.round(np.abs(x - self.spinbox_FCB_to.value()), 2)))[0][0]
value1 = np.where(np.round(np.abs(x - float(self.lineEdit_FCB_from.text().replace(',','.'))), 2) ==
np.min(np.round(np.abs(x - float(self.lineEdit_FCB_from.text().replace(',','.'))), 2)))[0][0]
value2 = np.where(np.round(np.abs(x - float(self.lineEdit_FCB_to.text().replace(',', '.'))), 2) ==
np.min(np.round(np.abs(x - float(self.lineEdit_FCB_to.text().replace(',', '.'))), 2)))[0][0]
print("value1 ", value1)
print("value2 ", value2)