Acoustic data: Add 'distance_from_ABS_to_free_surface' in save DB.

dev-parouby
Pierre-Antoine 2025-03-26 09:58:06 +01:00
parent 29e826d34c
commit 0f3117477a
4 changed files with 65 additions and 33 deletions

View File

@ -99,6 +99,7 @@ class CreateTableForSaveAs:
ID INTEGER PRIMARY KEY AUTOINCREMENT,
acoustic_data INTEGER,
temperature FLOAT,
distance_to_free_surface FLOAT,
tmin_index FLOAT, tmin_value FLOAT,
tmax_index FLOAT, tmax_value FLOAT,
rmin_index FLOAT, rmin_value FLOAT,
@ -410,16 +411,17 @@ class CreateTableForSaveAs:
cur.execute(
"""
INSERT into Settings(
acoustic_data, temperature,
acoustic_data, temperature, distance_to_free_surface,
tmin_index, tmin_value, tmax_index, tmax_value,
rmin_index, rmin_value, rmax_index, rmax_value,
freq_bottom_detection_index, freq_bottom_detection_value,
SNR_filter_value, Nb_cells_to_average_BS_signal
)
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""",
(
stg.acoustic_data[i], stg.temperature,
stg.distance_from_ABS_to_free_surface[i],
stg.tmin[i][0], stg.tmin[i][1],
stg.tmax[i][0], stg.tmax[i][1],
stg.rmin[i][0], stg.rmin[i][1],

View File

@ -477,7 +477,7 @@ class ReadTableForOpen:
for s in range(len(stg.acoustic_data)):
query3 = f'''
SELECT
acoustic_data, temperature,
acoustic_data, temperature, distance_to_free_surface,
tmin_index, tmin_value, tmax_index, tmax_value,
rmin_index, rmin_value, rmax_index, rmax_value,
freq_bottom_detection_index, freq_bottom_detection_value,
@ -490,13 +490,14 @@ class ReadTableForOpen:
x = data[0]
stg.temperature = [x[1]][0]
stg.tmin.append((x[2], x[3]))
stg.tmax.append((x[4], x[5]))
stg.rmin.append((x[6], x[7]))
stg.rmax.append((x[8], x[9]))
stg.freq_bottom_detection.append((x[10], x[11]))
stg.SNR_filter_value.append(x[12])
stg.Nb_cells_to_average_BS_signal.append(x[13])
stg.distance_from_ABS_to_free_surface.append(x[2])
stg.tmin.append((x[3], x[4]))
stg.tmax.append((x[5], x[6]))
stg.rmin.append((x[7], x[8]))
stg.rmax.append((x[9], x[10]))
stg.freq_bottom_detection.append((x[11], x[12]))
stg.SNR_filter_value.append(x[13])
stg.Nb_cells_to_average_BS_signal.append(x[14])
logger.debug(f"stg.temperature: {stg.temperature}")
logger.debug(f"stg.tmin: {stg.tmin}")

View File

@ -245,29 +245,48 @@ class UpdateTableForSave:
cur.execute(''' DROP TABLE Settings''')
cur.execute('''CREATE TABLE Settings(ID INTEGER PRIMARY KEY AUTOINCREMENT,
acoustic_data INTEGER,
temperature FLOAT,
tmin_index FLOAT, tmin_value FLOAT, tmax_index FLOAT, tmax_value FLOAT,
rmin_index FLOAT, rmin_value FLOAT, rmax_index FLOAT, rmax_value FLOAT,
freq_bottom_detection_index FLOAT, freq_bottom_detection_value STRING,
SNR_filter_value FLOAT, Nb_cells_to_average_BS_signal FLOAT
)'''
cur.execute('''
CREATE TABLE Settings(
ID INTEGER PRIMARY KEY AUTOINCREMENT,
acoustic_data INTEGER,
temperature FLOAT,
distance_to_free_surface FLOAT,
tmin_index FLOAT, tmin_value FLOAT,
tmax_index FLOAT, tmax_value FLOAT,
rmin_index FLOAT, rmin_value FLOAT,
rmax_index FLOAT, rmax_value FLOAT,
freq_bottom_detection_index FLOAT,
freq_bottom_detection_value STRING,
SNR_filter_value FLOAT,
Nb_cells_to_average_BS_signal FLOAT
)
'''
)
for i in stg.acoustic_data:
cur.execute('''INSERT into Settings(acoustic_data, temperature,
tmin_index, tmin_value, tmax_index, tmax_value,
rmin_index, rmin_value, rmax_index, rmax_value,
freq_bottom_detection_index, freq_bottom_detection_value,
SNR_filter_value, Nb_cells_to_average_BS_signal)
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
(stg.acoustic_data[i], stg.temperature,
stg.tmin[i][0], stg.tmin[i][1], stg.tmax[i][0], stg.tmax[i][1],
stg.rmin[i][0], stg.rmin[i][1], stg.rmax[i][0], stg.rmax[i][1],
stg.freq_bottom_detection[i][0], stg.freq_bottom_detection[i][1],
stg.SNR_filter_value[i], stg.Nb_cells_to_average_BS_signal[i])
cur.execute('''
INSERT into Settings(
acoustic_data, temperature,
distance_to_free_surface,
tmin_index, tmin_value, tmax_index, tmax_value,
rmin_index, rmin_value, rmax_index, rmax_value,
freq_bottom_detection_index, freq_bottom_detection_value,
SNR_filter_value, Nb_cells_to_average_BS_signal
) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
''',
(
stg.acoustic_data[i], stg.temperature,
stg.distance_from_ABS_to_free_surface[i],
stg.tmin[i][0], stg.tmin[i][1],
stg.tmax[i][0], stg.tmax[i][1],
stg.rmin[i][0], stg.rmin[i][1],
stg.rmax[i][0], stg.rmax[i][1],
stg.freq_bottom_detection[i][0],
stg.freq_bottom_detection[i][1],
stg.SNR_filter_value[i],
stg.Nb_cells_to_average_BS_signal[i]
)
)
cnx.commit()

View File

@ -844,7 +844,6 @@ class AcousticDataTab(QWidget):
self.groupbox_measurement_information_UBSediFlow()
def groupbox_measurement_information_no_ABS(self):
self.label_ABS_name.hide()
self.combobox_ABS_name.hide()
@ -1192,15 +1191,22 @@ class AcousticDataTab(QWidget):
self.lineEdit_distance_from_ABS_to_free_surface.setText("0.00")
else:
stg.distance_from_ABS_to_free_surface[self.fileListWidget\
.currentRow()] = (
stg.distance_from_ABS_to_free_surface[
self.fileListWidget.currentRow()
] = (
float(
self.lineEdit_distance_from_ABS_to_free_surface\
.text().replace(",", ".")
)
)
self.lineEdit_distance_from_ABS_to_free_surface.setText(
str("%4s" % stg.distance_from_ABS_to_free_surface[self.fileListWidget.currentRow()]))
str(
"%4s" % stg.distance_from_ABS_to_free_surface[
self.fileListWidget.currentRow()
]
)
)
def refresh_distance_from_ABS_to_free_surface(self):
self.pushbutton_distance_from_ABS_to_free_surface.blockSignals(True)
@ -1779,6 +1785,10 @@ class AcousticDataTab(QWidget):
.currentIndexChanged\
.connect(self.combobox_frequency_information_update)
self.lineEdit_distance_from_ABS_to_free_surface.setText(
str(stg.distance_from_ABS_to_free_surface[file_id])
)
logger.debug(f"Set temperature = {stg.temperature}")
self.lineEdit_temperature.setText(str(stg.temperature))