mirror of
https://forgemia.inra.fr/theophile.terraz/acoused.git
synced 2026-10-30 03:10:40 +01:00
SQL: Add calibration parameters table.
This commit is contained in:
1 parent
e300cfe643
commit
0a60088596
7 files changed
+265
-131
No files matched your search
@@ -438,18 +438,21 @@ class AcousticInversionTab(QWidget):
|
||||
self.plot_measured_vs_inverted_SSC_sand()
|
||||
|
||||
def compute_VBI(self):
|
||||
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||
|
||||
stg.VBI_cross_section[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
|
||||
stg.VBI_cross_section[data_id] = np.array([])
|
||||
|
||||
stg.VBI_cross_section[self.combobox_acoustic_data_choice.currentIndex()] = self.inv_hc.VBI_cross_section(
|
||||
stg.VBI_cross_section[data_id] = self.inv_hc.VBI_cross_section(
|
||||
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[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],
|
||||
j_cross_section_freq1=stg.J_cross_section[data_id][0],
|
||||
j_cross_section_freq2=stg.J_cross_section[data_id][1],
|
||||
r2D=stg.depth_2D[data_id][
|
||||
stg.frequency_for_inversion[1]
|
||||
],
|
||||
water_attenuation_freq1=stg.alpha_s[0],
|
||||
water_attenuation_freq2=stg.alpha_s[1],
|
||||
X=stg.X_exponent[0]
|
||||
)
|
||||
|
||||
|
||||
@@ -121,6 +121,13 @@ class CheckableComboBox(QComboBox):
|
||||
res.append(self.model().item(i).data())
|
||||
return res
|
||||
|
||||
def currentIndexes(self):
|
||||
# Return the list of selected items id
|
||||
res = []
|
||||
for i in range(self.model().rowCount()):
|
||||
if self.model().item(i).checkState() == Qt.Checked:
|
||||
res.append(i)
|
||||
return res
|
||||
|
||||
# class CheckableComboBox(QComboBox):
|
||||
# def __init__(self):
|
||||
@@ -151,4 +158,3 @@ class CheckableComboBox(QComboBox):
|
||||
# def itemChecked(self, index):
|
||||
# item = self.model().item(index, self.modelColumn())
|
||||
# return item.checkState() == Qt.Checked
|
||||
|
||||
+5
-2
@@ -266,7 +266,9 @@ class Ui_MainWindow(object):
|
||||
self.centralwidget.addAction(self.actionDB_Browser_for_SQLite)
|
||||
|
||||
def save_as(self):
|
||||
CreateTableForSaveAs()
|
||||
db = CreateTableForSaveAs()
|
||||
db.save_as()
|
||||
|
||||
self.mainwindow.setWindowTitle(
|
||||
"AcouSed - " +
|
||||
stg.filename_save_as
|
||||
@@ -274,7 +276,8 @@ class Ui_MainWindow(object):
|
||||
|
||||
def save(self):
|
||||
if stg.dirname_save_as:
|
||||
UpdateTableForSave()
|
||||
db = CreateTableForSaveAs()
|
||||
db.save()
|
||||
else:
|
||||
self.save_as()
|
||||
|
||||
|
||||
+124
-112
@@ -937,23 +937,27 @@ class SedimentCalibrationTab(QWidget):
|
||||
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||
|
||||
# --- Record frequencies for calibration ---
|
||||
stg.calib_acoustic_data = data_id
|
||||
|
||||
index_freq1 = self.combobox_freq1.currentIndex()
|
||||
index_freq2 = self.combobox_freq2.currentIndex()
|
||||
|
||||
stg.frequencies_for_calibration.clear()
|
||||
stg.frequencies_for_calibration.append(
|
||||
(
|
||||
stg.freq[data_id][
|
||||
self.combobox_freq1.currentIndex()
|
||||
],
|
||||
self.combobox_freq1.currentIndex()
|
||||
stg.freq[data_id][index_freq1],
|
||||
index_freq1
|
||||
)
|
||||
)
|
||||
stg.calib_freq_1 = index_freq1
|
||||
|
||||
stg.frequencies_for_calibration.append(
|
||||
(
|
||||
stg.freq[data_id][
|
||||
self.combobox_freq2.currentIndex()
|
||||
],
|
||||
self.combobox_freq2.currentIndex()
|
||||
stg.freq[data_id][index_freq2],
|
||||
index_freq2
|
||||
)
|
||||
)
|
||||
stg.calib_freq_2 = index_freq2
|
||||
|
||||
stg.frequency_for_inversion = tuple()
|
||||
stg.frequency_for_inversion = (
|
||||
@@ -1427,11 +1431,13 @@ class SedimentCalibrationTab(QWidget):
|
||||
def sample_choice_for_calibration(self):
|
||||
# --- List selected fine samples ---
|
||||
stg.fine_sample_profile = [(f, int(f[1:]) - 1) for f in self.combobox_fine_sample_choice.currentData()]
|
||||
stg.calib_fine_profiles = self.combobox_fine_sample_choice.currentIndexes()
|
||||
|
||||
# --- List selected sand samples ---
|
||||
# stg.sand_sample_target = [(s, int(s[1:]) - 1) for s in self.combobox_sand_sample_choice.currentData()]
|
||||
stg.sand_sample_target = [(self.combobox_sand_sample_choice.currentText(),
|
||||
self.combobox_sand_sample_choice.currentIndex())]
|
||||
stg.calib_sand_target = self.combobox_sand_sample_choice.currentIndex()
|
||||
|
||||
# --- Find index in time (along acoustic recording) of sand sample target ---
|
||||
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
@@ -1813,136 +1819,142 @@ class SedimentCalibrationTab(QWidget):
|
||||
)
|
||||
|
||||
def read_calibration_file_and_fill_parameter(self):
|
||||
|
||||
if stg.filename_calibration_file == "":
|
||||
return
|
||||
|
||||
pass
|
||||
# --- Read calibration file ---
|
||||
data = pd.read_csv(
|
||||
os.path.join(
|
||||
stg.path_calibration_file,
|
||||
stg.filename_calibration_file
|
||||
), header=0, index_col=0
|
||||
)
|
||||
|
||||
else:
|
||||
# --- Read calibration file ---
|
||||
data = pd.read_csv(os.path.join(stg.path_calibration_file, stg.filename_calibration_file), header=0, index_col=0)
|
||||
# --- Fill spinboxes of calibration parameter ---
|
||||
self.label_temperature.clear()
|
||||
self.label_temperature.setText(
|
||||
"T = " + str(stg.temperature) + " °C"
|
||||
)
|
||||
|
||||
# --- Fill spinboxes of calibration parameter ---
|
||||
self.label_temperature.clear()
|
||||
self.label_temperature.setText(
|
||||
"T = " + str(stg.temperature) + " °C"
|
||||
self.label_freq1.clear()
|
||||
self.label_freq1.setText(data.columns[0])
|
||||
|
||||
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||
|
||||
stg.calib_acoustic_data = data_id
|
||||
|
||||
index_freq1 = np.where(
|
||||
np.asarray(
|
||||
stg.freq_text[data_id]
|
||||
) == data.columns[0]
|
||||
)[0][0]
|
||||
|
||||
stg.frequencies_for_calibration.clear()
|
||||
stg.frequencies_for_calibration.append(
|
||||
(
|
||||
stg.freq[data_id][index_freq1],
|
||||
index_freq1
|
||||
)
|
||||
)
|
||||
stg.calib_freq_1 = index_freq1
|
||||
|
||||
self.label_freq1.clear()
|
||||
self.label_freq1.setText(data.columns[0])
|
||||
self.label_freq2.clear()
|
||||
self.label_freq2.setText(data.columns[1])
|
||||
|
||||
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||
index_freq2 = np.where(
|
||||
np.asarray(
|
||||
stg.freq_text[data_id]
|
||||
) == data.columns[1]
|
||||
)[0][0]
|
||||
|
||||
index_freq1 = np.where(
|
||||
np.asarray(
|
||||
stg.freq_text[data_id]
|
||||
) == data.columns[0]
|
||||
)[0][0]
|
||||
|
||||
stg.frequencies_for_calibration.clear()
|
||||
stg.frequencies_for_calibration.append(
|
||||
(
|
||||
stg.freq[data_id][index_freq1],
|
||||
index_freq1
|
||||
)
|
||||
)
|
||||
|
||||
self.label_freq2.clear()
|
||||
self.label_freq2.setText(data.columns[1])
|
||||
|
||||
index_freq2 = np.where(
|
||||
np.asarray(
|
||||
stg.freq_text[data_id]
|
||||
) == data.columns[1]
|
||||
)[0][0]
|
||||
|
||||
stg.frequencies_for_calibration.append(
|
||||
(
|
||||
stg.freq[data_id][index_freq2],
|
||||
index_freq2
|
||||
)
|
||||
)
|
||||
|
||||
stg.frequency_for_inversion = tuple()
|
||||
stg.frequency_for_inversion = (
|
||||
stg.frequencies_for_calibration.append(
|
||||
(
|
||||
stg.freq[data_id][index_freq2],
|
||||
index_freq2
|
||||
)
|
||||
)
|
||||
stg.calib_freq_2 = index_freq2
|
||||
|
||||
self.lineEdit_ks_freq1.clear()
|
||||
self.lineEdit_ks_freq1.setText(
|
||||
str("%.5f" % float(data.iloc[0][0]))
|
||||
)
|
||||
stg.frequency_for_inversion = tuple()
|
||||
stg.frequency_for_inversion = (
|
||||
stg.freq[data_id][index_freq2],
|
||||
index_freq2
|
||||
)
|
||||
|
||||
self.lineEdit_ks_freq2.clear()
|
||||
self.lineEdit_ks_freq2.setText(
|
||||
str("%.5f" % float(data.iloc[0][1]))
|
||||
)
|
||||
self.lineEdit_ks_freq1.clear()
|
||||
self.lineEdit_ks_freq1.setText(
|
||||
str("%.5f" % float(data.iloc[0][0]))
|
||||
)
|
||||
|
||||
stg.ks.clear()
|
||||
stg.ks = [
|
||||
float(self.lineEdit_ks_freq1.text()),
|
||||
float(self.lineEdit_ks_freq2.text())
|
||||
]
|
||||
self.lineEdit_ks_freq2.clear()
|
||||
self.lineEdit_ks_freq2.setText(
|
||||
str("%.5f" % float(data.iloc[0][1]))
|
||||
)
|
||||
|
||||
self.lineEdit_sv_freq1.clear()
|
||||
self.lineEdit_sv_freq1.setText(
|
||||
str("%.5f" % float(data.iloc[1][0]))
|
||||
)
|
||||
stg.ks.clear()
|
||||
stg.ks = [
|
||||
float(self.lineEdit_ks_freq1.text()),
|
||||
float(self.lineEdit_ks_freq2.text())
|
||||
]
|
||||
|
||||
self.lineEdit_sv_freq2.clear()
|
||||
self.lineEdit_sv_freq2.setText(
|
||||
str("%.5f" % float(data.iloc[1][1]))
|
||||
)
|
||||
self.lineEdit_sv_freq1.clear()
|
||||
self.lineEdit_sv_freq1.setText(
|
||||
str("%.5f" % float(data.iloc[1][0]))
|
||||
)
|
||||
|
||||
stg.sv.clear()
|
||||
stg.sv = [
|
||||
float(self.lineEdit_sv_freq1.text()),
|
||||
float(self.lineEdit_sv_freq2.text())
|
||||
]
|
||||
self.lineEdit_sv_freq2.clear()
|
||||
self.lineEdit_sv_freq2.setText(
|
||||
str("%.5f" % float(data.iloc[1][1]))
|
||||
)
|
||||
|
||||
self.lineEdit_X.clear()
|
||||
self.lineEdit_X.setText(
|
||||
str("%.2f" % float(data.iloc[2][0]))
|
||||
)
|
||||
stg.sv.clear()
|
||||
stg.sv = [
|
||||
float(self.lineEdit_sv_freq1.text()),
|
||||
float(self.lineEdit_sv_freq2.text())
|
||||
]
|
||||
|
||||
stg.X_exponent.clear()
|
||||
stg.X_exponent.append(float(self.lineEdit_X.text()))
|
||||
self.lineEdit_X.clear()
|
||||
self.lineEdit_X.setText(
|
||||
str("%.2f" % float(data.iloc[2][0]))
|
||||
)
|
||||
|
||||
self.lineEdit_alphas_freq1.clear()
|
||||
self.lineEdit_alphas_freq1.setText(
|
||||
str("%.5f" % float(data.iloc[3][0]))
|
||||
)
|
||||
stg.X_exponent.clear()
|
||||
stg.X_exponent.append(float(self.lineEdit_X.text()))
|
||||
|
||||
self.lineEdit_alphas_freq2.clear()
|
||||
self.lineEdit_alphas_freq2.setText(
|
||||
str("%.5f" % float(data.iloc[3][1]))
|
||||
)
|
||||
self.lineEdit_alphas_freq1.clear()
|
||||
self.lineEdit_alphas_freq1.setText(
|
||||
str("%.5f" % float(data.iloc[3][0]))
|
||||
)
|
||||
|
||||
stg.alpha_s.clear()
|
||||
stg.alpha_s = [
|
||||
float(self.lineEdit_alphas_freq1.text()),
|
||||
float(self.lineEdit_alphas_freq2.text())
|
||||
]
|
||||
self.lineEdit_alphas_freq2.clear()
|
||||
self.lineEdit_alphas_freq2.setText(
|
||||
str("%.5f" % float(data.iloc[3][1]))
|
||||
)
|
||||
|
||||
self.lineEdit_zeta_freq1.clear()
|
||||
self.lineEdit_zeta_freq1.setText(
|
||||
str("%.5f" % float(data.iloc[4][0]))
|
||||
)
|
||||
stg.alpha_s.clear()
|
||||
stg.alpha_s = [
|
||||
float(self.lineEdit_alphas_freq1.text()),
|
||||
float(self.lineEdit_alphas_freq2.text())
|
||||
]
|
||||
|
||||
self.lineEdit_zeta_freq2.clear()
|
||||
self.lineEdit_zeta_freq2.setText(
|
||||
str("%.5f" % float(data.iloc[4][1]))
|
||||
)
|
||||
self.lineEdit_zeta_freq1.clear()
|
||||
self.lineEdit_zeta_freq1.setText(
|
||||
str("%.5f" % float(data.iloc[4][0]))
|
||||
)
|
||||
|
||||
stg.zeta.clear()
|
||||
stg.zeta = [
|
||||
float(self.lineEdit_zeta_freq1.text()),
|
||||
float(self.lineEdit_zeta_freq2.text())
|
||||
]
|
||||
self.lineEdit_zeta_freq2.clear()
|
||||
self.lineEdit_zeta_freq2.setText(
|
||||
str("%.5f" % float(data.iloc[4][1]))
|
||||
)
|
||||
|
||||
self.compute_kt2D_kt3D()
|
||||
self.compute_J_cross_section()
|
||||
stg.zeta.clear()
|
||||
stg.zeta = [
|
||||
float(self.lineEdit_zeta_freq1.text()),
|
||||
float(self.lineEdit_zeta_freq2.text())
|
||||
]
|
||||
|
||||
self.compute_kt2D_kt3D()
|
||||
self.compute_J_cross_section()
|
||||
|
||||
def compute_depth_2D(self):
|
||||
if self.combobox_acoustic_data_choice.count() > 0:
|
||||
|
||||
Reference in new issue
Block a user