User can import calibration to compute inversion
parent
fa479e1dc8
commit
86c831e126
|
|
@ -175,39 +175,46 @@ class SedimentCalibrationTab(QWidget):
|
|||
|
||||
self.pushbutton_interpolate_Mfine_profile = QPushButton()
|
||||
self.pushbutton_interpolate_Mfine_profile.setText("Interpolate")
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.pushbutton_interpolate_Mfine_profile, 0, 0, 1, 4)
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.pushbutton_interpolate_Mfine_profile, 0, 0, 1, 4, Qt.AlignCenter)
|
||||
|
||||
self.label_sample_fine = QLabel()
|
||||
self.label_sample_fine.setText("Sample")
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_sample_fine, 1, 0, 1, 1)
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_sample_fine, 1, 0, 1, 1, Qt.AlignCenter)
|
||||
|
||||
self.label_depth_fine = QLabel()
|
||||
self.label_depth_fine.setText("Depth (m)")
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_depth_fine, 1, 1, 1, 1)
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_depth_fine, 1, 1, 1, 1, Qt.AlignCenter)
|
||||
|
||||
self.label_time_fine = QLabel()
|
||||
self.label_time_fine.setText("time")
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_time_fine, 1, 2, 1, 1)
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_time_fine, 1, 2, 1, 1, Qt.AlignCenter)
|
||||
|
||||
self.label_concentration_fine = QLabel()
|
||||
self.label_concentration_fine.setText("Cfine (g/L)")
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_concentration_fine, 1, 3, 1, 1)
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_concentration_fine, 1, 3, 1, 1, Qt.AlignCenter)
|
||||
|
||||
self.double_horizontal_line = QFrame()
|
||||
self.double_horizontal_line.setFrameShape(QFrame.HLine)
|
||||
self.double_horizontal_line.setFrameShadow(QFrame.Sunken)
|
||||
self.double_horizontal_line.setLineWidth(1)
|
||||
self.double_horizontal_line.setMidLineWidth(3)
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.double_horizontal_line, 4, 0, 1, 4, Qt.AlignCenter)
|
||||
|
||||
self.label_sample_sand = QLabel()
|
||||
self.label_sample_sand.setText("Sample")
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_sample_sand, 5, 0, 1, 1)
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_sample_sand, 5, 0, 1, 1, Qt.AlignCenter)
|
||||
|
||||
self.label_depth_sand = QLabel()
|
||||
self.label_depth_sand.setText("Depth (m)")
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_depth_sand, 5, 1, 1, 1)
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_depth_sand, 5, 1, 1, 1, Qt.AlignCenter)
|
||||
|
||||
self.label_time_sand = QLabel()
|
||||
self.label_time_sand.setText("time")
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_time_sand, 5, 2, 1, 1)
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_time_sand, 5, 2, 1, 1, Qt.AlignCenter)
|
||||
|
||||
self.label_concentration_sand = QLabel()
|
||||
self.label_concentration_sand.setText("Csand (g/L)")
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_concentration_sand, 5, 3, 1, 1)
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.label_concentration_sand, 5, 3, 1, 1, Qt.AlignCenter)
|
||||
|
||||
# --- Groupbox interpolate plot ---
|
||||
self.verticalLayout_groupbox_interpolate_plot = QVBoxLayout(self.groupbox_interpolate_plot)
|
||||
|
|
@ -284,16 +291,28 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_kt, 2, 0, 1, 1, Qt.AlignCenter)
|
||||
|
||||
self.label_kt_freq1 = QLabel()
|
||||
self.label_kt_freq1.setText("0.00 V.m^1.5")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_kt_freq1, 2, 1, 1, 2, Qt.AlignCenter)
|
||||
self.label_kt_freq1.setText("0.00")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_kt_freq1, 2, 1, 1, 1, Qt.AlignRight)
|
||||
|
||||
self.label_kt_freq1_unit = QLabel()
|
||||
self.label_kt_freq1_unit.setText("V.m<sup>1.5</sup>")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_kt_freq1_unit, 2, 2, 1, 1,
|
||||
Qt.AlignLeft)
|
||||
|
||||
self.label_kt_freq2 = QLabel()
|
||||
self.label_kt_freq2.setText("0.00 V.m^1.5")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_kt_freq2, 2, 3, 1, 2, Qt.AlignCenter)
|
||||
self.label_kt_freq2.setText("0.00 V.m<sup>1.5</sup>")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_kt_freq2, 2, 3, 1, 1, Qt.AlignRight)
|
||||
|
||||
self.label_kt_freq2_unit = QLabel()
|
||||
self.label_kt_freq2_unit.setText("V.m<sup>1.5</sup>")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_kt_freq2_unit, 2, 4, 1, 1,
|
||||
Qt.AlignLeft)
|
||||
|
||||
self.horizontalLine = QFrame()
|
||||
self.horizontalLine.setFrameShape(QFrame.HLine)
|
||||
self.horizontalLine.setFrameShadow(QFrame.Sunken)
|
||||
self.horizontalLine.setLineWidth(1)
|
||||
self.horizontalLine.setMidLineWidth(0)
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.horizontalLine, 3, 0, 1, 6)
|
||||
|
||||
self.label_ks = QLabel()
|
||||
|
|
@ -309,7 +328,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_ks_freq1, 4, 1, 1, 1)
|
||||
|
||||
self.label_ks_freq1_unit = QLabel()
|
||||
self.label_ks_freq1_unit.setText("m/kg^0.5")
|
||||
self.label_ks_freq1_unit.setText("m.kg<sup>-0.5</sup>")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_ks_freq1_unit, 4, 2, 1, 1,
|
||||
Qt.AlignLeft)
|
||||
|
||||
|
|
@ -322,7 +341,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_ks_freq2, 4, 3, 1, 1)
|
||||
|
||||
self.label_ks_freq2_unit = QLabel()
|
||||
self.label_ks_freq2_unit.setText("m/kg^0.5")
|
||||
self.label_ks_freq2_unit.setText("m.kg<sup>-0.5</sup>")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_ks_freq2_unit, 4, 4, 1, 1,
|
||||
Qt.AlignLeft)
|
||||
|
||||
|
|
@ -339,7 +358,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_sv_freq1, 5, 1, 1, 1)
|
||||
|
||||
self.label_sv_freq1_unit = QLabel()
|
||||
self.label_sv_freq1_unit.setText("/m")
|
||||
self.label_sv_freq1_unit.setText("m<sup>-1</sup>")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_sv_freq1_unit, 5, 2, 1, 1)
|
||||
|
||||
# self.spinbox_sv_freq2 = QDoubleSpinBox()
|
||||
|
|
@ -351,7 +370,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_sv_freq2, 5, 3, 1, 1)
|
||||
|
||||
self.label_sv_freq2_unit = QLabel()
|
||||
self.label_sv_freq2_unit.setText("/m")
|
||||
self.label_sv_freq2_unit.setText("m<sup>-1</sup>")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_sv_freq2_unit, 5, 4, 1, 1)
|
||||
|
||||
self.label_X = QLabel()
|
||||
|
|
@ -378,7 +397,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_alphas_freq1, 7, 1, 1, 1)
|
||||
|
||||
self.label_alphas_freq1_unit = QLabel()
|
||||
self.label_alphas_freq1_unit.setText("/m")
|
||||
self.label_alphas_freq1_unit.setText("m<sup>-1</sup>")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_alphas_freq1_unit, 7, 2, 1, 1, Qt.AlignLeft)
|
||||
|
||||
# self.spinbox_alphas_freq2 = QDoubleSpinBox()
|
||||
|
|
@ -390,7 +409,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_alphas_freq2, 7, 3, 1, 1)
|
||||
|
||||
self.label_alphas_freq2_unit = QLabel()
|
||||
self.label_alphas_freq2_unit.setText("/m")
|
||||
self.label_alphas_freq2_unit.setText("m<sup>-1</sup>")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_alphas_freq2_unit, 7, 4, 1, 1, Qt.AlignLeft)
|
||||
|
||||
self.label_zeta = QLabel()
|
||||
|
|
@ -406,7 +425,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_zeta_freq1, 8, 1, 1, 1)
|
||||
|
||||
self.label_zeta_freq1_unit = QLabel()
|
||||
self.label_zeta_freq1_unit.setText("/m")
|
||||
self.label_zeta_freq1_unit.setText("m<sup>-1</sup>")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_zeta_freq1_unit, 8, 2, 1, 1,
|
||||
Qt.AlignLeft)
|
||||
|
||||
|
|
@ -419,7 +438,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_zeta_freq2, 8, 3, 1, 1)
|
||||
|
||||
self.label_zeta_freq2_unit = QLabel()
|
||||
self.label_zeta_freq2_unit.setText("/m")
|
||||
self.label_zeta_freq2_unit.setText("m<sup>-1</sup>")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_zeta_freq2_unit, 8, 4, 1, 1,
|
||||
Qt.AlignLeft)
|
||||
|
||||
|
|
@ -446,7 +465,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
# ++++++++++++++++++++
|
||||
# +++ Groupbox FCB +++
|
||||
|
||||
self.groupbox_FCB.setTitle("Step 3 (optional) : Fluid Corrected Backscatter")
|
||||
self.groupbox_FCB.setTitle("Step 3 (for information) : Fluid Corrected Backscatter")
|
||||
self.horizontalLayout_groupbox_FCB = QHBoxLayout(self.groupbox_FCB)
|
||||
|
||||
self.groupbox_FCB.setCheckable(True)
|
||||
|
|
@ -623,6 +642,10 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.combobox_sand_sample_choice.addItems([s[0] for s in stg.sample_sand])
|
||||
|
||||
self.plot_acoustic_recording()
|
||||
|
||||
self.label_temperature.clear()
|
||||
self.label_temperature.setText("T = " + str(stg.temperature) + " °C")
|
||||
|
||||
self.update_label_freq1_for_calibration()
|
||||
self.update_label_freq2_for_calibration()
|
||||
self.update_label_kt_value_for_calibration()
|
||||
|
|
@ -995,7 +1018,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
for i in reversed(range(self.gridLayout_groupbox_interpolate_info.count())):
|
||||
self.gridLayout_groupbox_interpolate_info.itemAt(i).widget().setParent(None)
|
||||
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.pushbutton_interpolate_Mfine_profile, 0, 0, 1, 4)
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.pushbutton_interpolate_Mfine_profile, 0, 0, 1, 4, Qt.AlignCenter)
|
||||
|
||||
fine_head = ["Sample", "Depth (m)", "time", "Cfine (g/L)"]
|
||||
fine_label = [self.label_sample_fine, self.label_depth_fine, self.label_time_fine,
|
||||
|
|
@ -1004,8 +1027,8 @@ class SedimentCalibrationTab(QWidget):
|
|||
for j in range(len(fine_head)):
|
||||
exec("fine_label[" + str(j) + "] = QLabel()")
|
||||
eval("fine_label[" + str(j) + "].setText(fine_head[" + str(j) + "])")
|
||||
print((f"self.gridLayout_groupbox_interpolate_info.addWidget(fine_label[{j}], 1, {j}, 1, 1)"))
|
||||
eval(f"self.gridLayout_groupbox_interpolate_info.addWidget(fine_label[{j}], 1, {j}, 1, 1)")
|
||||
print((f"self.gridLayout_groupbox_interpolate_info.addWidget(fine_label[{j}], 1, {j}, 1, 1, Qt.AlignCenter)"))
|
||||
eval(f"self.gridLayout_groupbox_interpolate_info.addWidget(fine_label[{j}], 1, {j}, 1, 1, Qt.AlignCenter)")
|
||||
|
||||
fine_data = []
|
||||
for k in range(len(stg.fine_sample_profile)):
|
||||
|
|
@ -1017,7 +1040,15 @@ class SedimentCalibrationTab(QWidget):
|
|||
# exec("fine_label[" + str(p) + "]_" + "stg.fine_sample_profile[" + str(p) + "][0]" + " = QLabel()")
|
||||
# eval("fine_label[" + str(p) + "]_" + "stg.fine_sample_profile[" + str(p) + "][0]" + ".setText(" + "fine_data[" + str(p) + "][" + str(q) + "])")
|
||||
# eval("self.gridLayout_groupbox_interpolate_info.addWidget(" + "fine_label[" + str(p) + "]_" + "stg.fine_sample_profile[" + str(p) + "], " + str(1+p) + ", " + str(q) + ", 1, 1)")
|
||||
eval(f"self.gridLayout_groupbox_interpolate_info.addWidget(QLabel(fine_data[{p}][{q}]), {2 + p}, {q}, 1, 1)")
|
||||
print(f"self.gridLayout_groupbox_interpolate_info.addWidget(QLabel(fine_data[{p}][{q}]), {2 + p}, {q}, 1, 1, Qt.AlignCenter)")
|
||||
eval(f"self.gridLayout_groupbox_interpolate_info.addWidget(QLabel(fine_data[{p}][{q}]), {2 + p}, {q}, 1, 1, Qt.AlignCenter)")
|
||||
|
||||
# self.double_horizontal_line = QFrame()
|
||||
# self.double_horizontal_line.setFrameShape(QFrame.HLine)
|
||||
# self.double_horizontal_line.setFrameShadow(QFrame.Sunken)
|
||||
# self.double_horizontal_line.setLineWidth(1)
|
||||
# self.double_horizontal_line.setMidLineWidth(3)
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.double_horizontal_line, 2 + len(fine_data), 0, 1, 4, Qt.AlignCenter)
|
||||
|
||||
sand_head = ["Sample", "Depth (m)", "time", "Csand (g/L)"]
|
||||
sand_label = [self.label_sample_sand, self.label_depth_sand, self.label_time_sand,
|
||||
|
|
@ -1026,8 +1057,8 @@ class SedimentCalibrationTab(QWidget):
|
|||
for s in range(len(sand_head)):
|
||||
exec("sand_label[" + str(s) + "] = QLabel()")
|
||||
eval("sand_label[" + str(s) + "].setText(sand_head[" + str(s) + "])")
|
||||
# print((f"self.gridLayout_groupbox_interpolate_info.addWidget(sand_label[{s}], 0, {s + 1}, 1, 1)"))
|
||||
eval(f"self.gridLayout_groupbox_interpolate_info.addWidget(sand_label[{s}], {2 + len(fine_data)}, {s}, 1, 1)")
|
||||
print(f"self.gridLayout_groupbox_interpolate_info.addWidget(sand_label[{s}], {3 + len(fine_data)}, {s}, 1, 1, Qt.AlignCenter)")
|
||||
eval(f"self.gridLayout_groupbox_interpolate_info.addWidget(sand_label[{s}], {3 + len(fine_data)}, {s}, 1, 1, Qt.AlignCenter)")
|
||||
|
||||
sand_data = [stg.sand_sample_target[0][0],
|
||||
str(stg.depth_sand[stg.sand_sample_target[0][1]]),
|
||||
|
|
@ -1035,7 +1066,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
str(stg.Ctot_sand[stg.sand_sample_target[0][1]])]
|
||||
|
||||
for t in range(len(sand_data)):
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(QLabel(sand_data[t]), 3 + len(fine_data), t, 1, 1)
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(QLabel(sand_data[t]), 4 + len(fine_data), t, 1, 1, Qt.AlignCenter)
|
||||
|
||||
|
||||
def plot_profile_of_concentration_fine(self):
|
||||
|
|
@ -1277,8 +1308,8 @@ class SedimentCalibrationTab(QWidget):
|
|||
dir_name = path.dirname(filename[0])
|
||||
name = path.basename(filename[0])
|
||||
|
||||
stg.path_calibration_import_file = dir_name
|
||||
stg.filename_calibration_import_file = name
|
||||
stg.path_calibration_file = dir_name
|
||||
stg.filename_calibration_file = name
|
||||
|
||||
self.lineEdit_import_calibration.clear()
|
||||
self.lineEdit_import_calibration.setText(name)
|
||||
|
|
@ -1298,121 +1329,136 @@ class SedimentCalibrationTab(QWidget):
|
|||
def update_label_kt_value_for_calibration(self):
|
||||
self.label_kt_freq1.clear()
|
||||
print("self.combobox_freq1.currentIndex() ", self.combobox_freq1.currentIndex(), self.combobox_freq1.currentText())
|
||||
if stg.kt_corrected[self.combobox_freq1.currentText()] != stg.kt_read[self.combobox_freq1.currentIndex()]:
|
||||
self.label_kt_freq1.setText(str('%.4f' % stg.kt_corrected[self.combobox_freq1.currentText()]))
|
||||
if stg.kt_corrected[self.combobox_freq1.currentIndex()] != stg.kt_read[self.combobox_freq1.currentIndex()]:
|
||||
self.label_kt_freq1.setText(str('%.4f' % stg.kt_corrected[self.combobox_freq1.currentIndex()]))
|
||||
else:
|
||||
self.label_kt_freq1.setText(str('%.4f' % stg.kt_read[self.combobox_freq1.currentIndex()]))
|
||||
|
||||
self.label_kt_freq2.clear()
|
||||
if stg.kt_corrected[self.combobox_freq2.currentText()] != stg.kt_read[self.combobox_freq2.currentIndex()]:
|
||||
self.label_kt_freq2.setText(str('%.4f' % stg.kt_corrected[self.combobox_freq2.currentText()]))
|
||||
if stg.kt_corrected[self.combobox_freq2.currentIndex()] != stg.kt_read[self.combobox_freq2.currentIndex()]:
|
||||
self.label_kt_freq2.setText(str('%.4f' % stg.kt_corrected[self.combobox_freq2.currentIndex()]))
|
||||
else:
|
||||
self.label_kt_freq2.setText(str('%.4f' % stg.kt_read[self.combobox_freq2.currentIndex()]))
|
||||
|
||||
def read_calibration_file_and_fill_parameter(self):
|
||||
# --- Read calibration file ---
|
||||
data = pd.read_csv(stg.calibration_file[0] + "/" + stg.calibration_file[1], header=0, index_col=0)
|
||||
print(data.head())
|
||||
print(data.iloc[0][0])
|
||||
print(type(data.iloc[0][0]))
|
||||
if self.combobox_acoustic_data_choice.count() == 0:
|
||||
|
||||
# --- Fill spinboxes of calibration parameter ---
|
||||
self.label_freq1.clear()
|
||||
self.label_freq1.setText(data.columns[0])
|
||||
print(stg.freq_text)
|
||||
print(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()])
|
||||
print(data.columns[0])
|
||||
print("index freq1 ", np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) == data.columns[0]))
|
||||
index_freq1 = np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) ==
|
||||
data.columns[0])[0][0]
|
||||
stg.frequencies_for_calibration.clear()
|
||||
stg.frequencies_for_calibration.append((stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
index_freq1],
|
||||
index_freq1))
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setWindowTitle("Calibration import error")
|
||||
msgBox.setIconPixmap(
|
||||
QPixmap(self.path_icon + "no_approved.png").scaledToHeight(32, Qt.SmoothTransformation))
|
||||
msgBox.setText("Update data before importing calibration")
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
|
||||
self.label_freq2.clear()
|
||||
self.label_freq2.setText(data.columns[1])
|
||||
print("index freq2 ",
|
||||
np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) == data.columns[1]))
|
||||
index_freq2 = np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) ==
|
||||
data.columns[1])[0][0]
|
||||
# stg.frequencies_for_calibration.clear()
|
||||
stg.frequencies_for_calibration.append((stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
index_freq2],
|
||||
index_freq2))
|
||||
else:
|
||||
|
||||
stg.frequency_for_inversion = tuple()
|
||||
stg.frequency_for_inversion = (stg.freq[self.combobox_acoustic_data_choice.currentIndex()][index_freq2],
|
||||
index_freq2)
|
||||
# --- Read calibration file ---
|
||||
data = pd.read_csv(stg.path_calibration_file + "/" + stg.filename_calibration_file, header=0, index_col=0)
|
||||
print(data.head())
|
||||
print(data.iloc[0][0])
|
||||
print(type(data.iloc[0][0]))
|
||||
|
||||
# self.spinbox_ks_freq1.clear()
|
||||
# self.spinbox_ks_freq1.setValue()
|
||||
self.lineEdit_ks_freq1.clear()
|
||||
self.lineEdit_ks_freq1.setText(str("%.5f" % float(data.iloc[0][0])) + " m/kg^0.5")
|
||||
# --- Fill spinboxes of calibration parameter ---
|
||||
self.label_temperature.clear()
|
||||
self.label_temperature.setText("T = " + str(stg.temperature) + " °C")
|
||||
|
||||
# self.spinbox_ks_freq2.clear()
|
||||
# self.spinbox_ks_freq2.setValue(float(data.iloc[0][1]))
|
||||
self.lineEdit_ks_freq2.clear()
|
||||
self.lineEdit_ks_freq2.setText(str("%.5f" % float(data.iloc[0][1])) + " m/kg^0.5")
|
||||
self.label_freq1.clear()
|
||||
self.label_freq1.setText(data.columns[0])
|
||||
print(stg.freq_text)
|
||||
print(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()])
|
||||
print(data.columns[0])
|
||||
print("index freq1 ", np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) == data.columns[0]))
|
||||
index_freq1 = np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) ==
|
||||
data.columns[0])[0][0]
|
||||
stg.frequencies_for_calibration.clear()
|
||||
stg.frequencies_for_calibration.append((stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
index_freq1],
|
||||
index_freq1))
|
||||
|
||||
stg.ks.clear()
|
||||
# stg.ks = [self.spinbox_ks_freq1.value(), self.spinbox_ks_freq2.value()]
|
||||
stg.ks = [float(self.lineEdit_ks_freq1.text()), float(self.lineEdit_ks_freq2.text())]
|
||||
self.label_freq2.clear()
|
||||
self.label_freq2.setText(data.columns[1])
|
||||
print("index freq2 ",
|
||||
np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) == data.columns[1]))
|
||||
index_freq2 = np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) ==
|
||||
data.columns[1])[0][0]
|
||||
# stg.frequencies_for_calibration.clear()
|
||||
stg.frequencies_for_calibration.append((stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
index_freq2],
|
||||
index_freq2))
|
||||
|
||||
# self.spinbox_sv_freq1.clear()
|
||||
# self.spinbox_sv_freq1.setValue(float(data.iloc[1][0]))
|
||||
self.lineEdit_sv_freq1.clear()
|
||||
self.lineEdit_sv_freq1.setText(str("%.5f" % float(data.iloc[1][0])) + " /m")
|
||||
stg.frequency_for_inversion = tuple()
|
||||
stg.frequency_for_inversion = (stg.freq[self.combobox_acoustic_data_choice.currentIndex()][index_freq2],
|
||||
index_freq2)
|
||||
|
||||
# self.spinbox_sv_freq2.clear()
|
||||
# self.spinbox_sv_freq2.setValue(float(data.iloc[1][1]))
|
||||
self.lineEdit_sv_freq2.clear()
|
||||
self.lineEdit_sv_freq2.setText(str("%.5f" % float(data.iloc[1][1])) + " /m")
|
||||
# self.spinbox_ks_freq1.clear()
|
||||
# self.spinbox_ks_freq1.setValue()
|
||||
self.lineEdit_ks_freq1.clear()
|
||||
self.lineEdit_ks_freq1.setText(str("%.5f" % float(data.iloc[0][0])))
|
||||
|
||||
stg.sv.clear()
|
||||
# stg.sv = [self.spinbox_sv_freq1.value(), self.spinbox_sv_freq2.value()]
|
||||
stg.sv = [float(self.lineEdit_sv_freq1.text()), float(self.lineEdit_sv_freq2.text())]
|
||||
# self.spinbox_ks_freq2.clear()
|
||||
# self.spinbox_ks_freq2.setValue(float(data.iloc[0][1]))
|
||||
self.lineEdit_ks_freq2.clear()
|
||||
self.lineEdit_ks_freq2.setText(str("%.5f" % float(data.iloc[0][1])))
|
||||
|
||||
# self.spinbox_X.clear()
|
||||
# self.spinbox_X.setValue(float(data.iloc[2][0]))
|
||||
self.lineEdit_X.clear()
|
||||
self.lineEdit_X.setText(str("%.2f" % float(data.iloc[2][0])))
|
||||
stg.ks.clear()
|
||||
# stg.ks = [self.spinbox_ks_freq1.value(), self.spinbox_ks_freq2.value()]
|
||||
stg.ks = [float(self.lineEdit_ks_freq1.text()), float(self.lineEdit_ks_freq2.text())]
|
||||
|
||||
stg.X_exponent.clear()
|
||||
# stg.X_exponent.append(self.spinbox_X.value())
|
||||
stg.X_exponent.append(float(self.lineEdit_X.text()))
|
||||
# self.spinbox_sv_freq1.clear()
|
||||
# self.spinbox_sv_freq1.setValue(float(data.iloc[1][0]))
|
||||
self.lineEdit_sv_freq1.clear()
|
||||
self.lineEdit_sv_freq1.setText(str("%.5f" % float(data.iloc[1][0])))
|
||||
|
||||
# self.spinbox_alphas_freq1.clear()
|
||||
# self.spinbox_alphas_freq1.setValue(float(data.iloc[3][0]))
|
||||
self.lineEdit_alphas_freq1.clear()
|
||||
self.lineEdit_alphas_freq1.setText(str("%.5f" % float(data.iloc[3][0])))
|
||||
# self.spinbox_sv_freq2.clear()
|
||||
# self.spinbox_sv_freq2.setValue(float(data.iloc[1][1]))
|
||||
self.lineEdit_sv_freq2.clear()
|
||||
self.lineEdit_sv_freq2.setText(str("%.5f" % float(data.iloc[1][1])))
|
||||
|
||||
# self.spinbox_alphas_freq2.clear()
|
||||
# self.spinbox_alphas_freq2.setValue(float(data.iloc[3][1]))
|
||||
self.lineEdit_alphas_freq2.clear()
|
||||
self.lineEdit_alphas_freq2.setText(str("%.5f" % float(data.iloc[3][1])))
|
||||
stg.sv.clear()
|
||||
# stg.sv = [self.spinbox_sv_freq1.value(), self.spinbox_sv_freq2.value()]
|
||||
stg.sv = [float(self.lineEdit_sv_freq1.text()), float(self.lineEdit_sv_freq2.text())]
|
||||
|
||||
stg.alpha_s.clear()
|
||||
# stg.alpha_s = [self.spinbox_alphas_freq1.value(), self.spinbox_alphas_freq2.value()]
|
||||
stg.alpha_s = [float(self.lineEdit_alphas_freq1.text()), float(self.lineEdit_alphas_freq2.text())]
|
||||
# self.spinbox_X.clear()
|
||||
# self.spinbox_X.setValue(float(data.iloc[2][0]))
|
||||
self.lineEdit_X.clear()
|
||||
self.lineEdit_X.setText(str("%.2f" % float(data.iloc[2][0])))
|
||||
|
||||
# self.spinbox_zeta_freq1.clear()
|
||||
# self.spinbox_zeta_freq1.setValue(float(data.iloc[4][0]))
|
||||
self.lineEdit_zeta_freq1.clear()
|
||||
self.lineEdit_zeta_freq1.setText(str("%.5f" % float(data.iloc[4][0])))
|
||||
stg.X_exponent.clear()
|
||||
# stg.X_exponent.append(self.spinbox_X.value())
|
||||
stg.X_exponent.append(float(self.lineEdit_X.text()))
|
||||
|
||||
# self.spinbox_zeta_freq2.clear()
|
||||
# self.spinbox_zeta_freq2.setValue(float(data.iloc[4][1]))
|
||||
self.lineEdit_zeta_freq2.clear()
|
||||
self.lineEdit_zeta_freq2.setText(str("%.5f" % float(data.iloc[4][1])))
|
||||
# self.spinbox_alphas_freq1.clear()
|
||||
# self.spinbox_alphas_freq1.setValue(float(data.iloc[3][0]))
|
||||
self.lineEdit_alphas_freq1.clear()
|
||||
self.lineEdit_alphas_freq1.setText(str("%.5f" % float(data.iloc[3][0])))
|
||||
|
||||
stg.zeta.clear()
|
||||
# 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.spinbox_alphas_freq2.clear()
|
||||
# self.spinbox_alphas_freq2.setValue(float(data.iloc[3][1]))
|
||||
self.lineEdit_alphas_freq2.clear()
|
||||
self.lineEdit_alphas_freq2.setText(str("%.5f" % float(data.iloc[3][1])))
|
||||
|
||||
self.compute_depth_2D()
|
||||
self.compute_kt2D_kt3D()
|
||||
self.compute_J_cross_section()
|
||||
stg.alpha_s.clear()
|
||||
# stg.alpha_s = [self.spinbox_alphas_freq1.value(), self.spinbox_alphas_freq2.value()]
|
||||
stg.alpha_s = [float(self.lineEdit_alphas_freq1.text()), float(self.lineEdit_alphas_freq2.text())]
|
||||
|
||||
# self.spinbox_zeta_freq1.clear()
|
||||
# self.spinbox_zeta_freq1.setValue(float(data.iloc[4][0]))
|
||||
self.lineEdit_zeta_freq1.clear()
|
||||
self.lineEdit_zeta_freq1.setText(str("%.5f" % float(data.iloc[4][0])))
|
||||
|
||||
# self.spinbox_zeta_freq2.clear()
|
||||
# self.spinbox_zeta_freq2.setValue(float(data.iloc[4][1]))
|
||||
self.lineEdit_zeta_freq2.clear()
|
||||
self.lineEdit_zeta_freq2.setText(str("%.5f" % float(data.iloc[4][1])))
|
||||
|
||||
stg.zeta.clear()
|
||||
# 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_kt2D_kt3D()
|
||||
self.compute_J_cross_section()
|
||||
|
||||
def compute_depth_2D(self):
|
||||
print("self.combobox_acoustic_data_choice.count() ", self.combobox_acoustic_data_choice.count())
|
||||
|
|
@ -1488,6 +1534,9 @@ class SedimentCalibrationTab(QWidget):
|
|||
|
||||
def function_pushbutton_compute_calibration(self):
|
||||
|
||||
self.label_temperature.clear()
|
||||
self.label_temperature.setText("T = " + str(stg.temperature) + " °C")
|
||||
|
||||
self.compute_ks()
|
||||
self.compute_sv()
|
||||
self.compute_X()
|
||||
|
|
@ -1589,11 +1638,10 @@ class SedimentCalibrationTab(QWidget):
|
|||
# print("kt cor ", stg.kt_corrected)
|
||||
# print("kt read", stg.kt_read)
|
||||
|
||||
if ([stg.kt_corrected[key] for key in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]] !=
|
||||
stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]):
|
||||
if stg.kt_corrected != stg.kt_read:
|
||||
|
||||
kt2D = np.repeat(
|
||||
np.array([[stg.kt_corrected[key] for key in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]]]).transpose(),
|
||||
np.array([stg.kt_corrected]).transpose(),
|
||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
|
||||
axis=1)
|
||||
kt3D = np.repeat(
|
||||
|
|
@ -1604,7 +1652,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
else:
|
||||
|
||||
kt2D = np.repeat(
|
||||
np.array([stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
|
||||
np.array([stg.kt_read]).transpose(),
|
||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
|
||||
axis=1)
|
||||
print(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape)
|
||||
|
|
@ -1636,11 +1684,10 @@ class SedimentCalibrationTab(QWidget):
|
|||
print("kt cor ", stg.kt_corrected)
|
||||
print("kt read", stg.kt_read)
|
||||
|
||||
if ([stg.kt_corrected[key] for key in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]] !=
|
||||
stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]):
|
||||
if (stg.kt_corrected != stg.kt_read):
|
||||
|
||||
kt2D = np.repeat(
|
||||
np.array([[stg.kt_corrected[key] for key in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]]]).transpose(),
|
||||
np.array([stg.kt_corrected]).transpose(),
|
||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
|
||||
axis=1)
|
||||
kt3D = np.repeat(
|
||||
|
|
@ -1651,7 +1698,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
else:
|
||||
|
||||
kt2D = np.repeat(
|
||||
np.array([stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
|
||||
np.array([stg.kt_read]).transpose(),
|
||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
|
||||
axis=1)
|
||||
print(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape)
|
||||
|
|
@ -1685,11 +1732,10 @@ class SedimentCalibrationTab(QWidget):
|
|||
print("kt cor ", stg.kt_corrected)
|
||||
print("kt read", stg.kt_read)
|
||||
|
||||
if ([stg.kt_corrected[key] for key in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]] !=
|
||||
stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]):
|
||||
if (stg.kt_corrected != stg.kt_read):
|
||||
|
||||
kt2D = np.repeat(
|
||||
np.array([[stg.kt_corrected[key] for key in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]]]).transpose(),
|
||||
np.array([stg.kt_corrected]).transpose(),
|
||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
|
||||
axis=1)
|
||||
kt3D = np.repeat(
|
||||
|
|
@ -1700,7 +1746,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
else:
|
||||
|
||||
kt2D = np.repeat(
|
||||
np.array([stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
|
||||
np.array([stg.kt_read]).transpose(),
|
||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
|
||||
axis=1)
|
||||
print(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape)
|
||||
|
|
@ -1732,11 +1778,10 @@ class SedimentCalibrationTab(QWidget):
|
|||
print("kt cor ", stg.kt_corrected)
|
||||
print("kt read", stg.kt_read)
|
||||
|
||||
if ([stg.kt_corrected[key] for key in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]] !=
|
||||
stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]):
|
||||
print([stg.kt_corrected[key] for key in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]])
|
||||
if (stg.kt_corrected != stg.kt_read):
|
||||
# print([stg.kt_corrected[key] for key in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]])
|
||||
kt2D = np.repeat(
|
||||
np.array([[stg.kt_corrected[key] for key in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]]]).transpose(),
|
||||
np.array([stg.kt_corrected]).transpose(),
|
||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
|
||||
axis=1)
|
||||
kt3D = np.repeat(
|
||||
|
|
@ -1747,7 +1792,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
else:
|
||||
|
||||
kt2D = np.repeat(
|
||||
np.array([stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
|
||||
np.array([stg.kt_read]).transpose(),
|
||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
|
||||
axis=1)
|
||||
print(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape)
|
||||
|
|
@ -2110,10 +2155,10 @@ class SedimentCalibrationTab(QWidget):
|
|||
|
||||
dir_save_cal = QFileDialog.getExistingDirectory(
|
||||
caption="Save calibration",
|
||||
directory=[stg.path_calibration_save_file if stg.path_calibration_save_file else stg.path_BS_raw_data[-1] if self.combobox_acoustic_data_choice.count() > 0 else ""][0],
|
||||
directory=[stg.path_calibration_file if stg.path_calibration_file else stg.path_BS_raw_data[-1] if self.combobox_acoustic_data_choice.count() > 0 else ""][0],
|
||||
options=QFileDialog.DontUseNativeDialog)
|
||||
|
||||
stg.path_calibration_save_file = path.dirname(dir_save_cal)
|
||||
stg.path_calibration_file = path.dirname(dir_save_cal)
|
||||
|
||||
cal_array = [[' ', stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1]],
|
||||
stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1]]],
|
||||
|
|
|
|||
|
|
@ -213,9 +213,8 @@ frequencies_for_calibration = []
|
|||
range_lin_interp = []
|
||||
M_profile_fine = []
|
||||
|
||||
path_calibration_save_file = ""
|
||||
path_calibration_import_file = ""
|
||||
filename_calibration_import_file = ""
|
||||
path_calibration_file = ""
|
||||
filename_calibration_file = ""
|
||||
|
||||
ks = []
|
||||
sv = []
|
||||
|
|
|
|||
Loading…
Reference in New Issue