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, ID INTEGER PRIMARY KEY AUTOINCREMENT,
acoustic_data INTEGER, acoustic_data INTEGER,
temperature FLOAT, temperature FLOAT,
distance_to_free_surface FLOAT,
tmin_index FLOAT, tmin_value FLOAT, tmin_index FLOAT, tmin_value FLOAT,
tmax_index FLOAT, tmax_value FLOAT, tmax_index FLOAT, tmax_value FLOAT,
rmin_index FLOAT, rmin_value FLOAT, rmin_index FLOAT, rmin_value FLOAT,
@ -410,16 +411,17 @@ class CreateTableForSaveAs:
cur.execute( cur.execute(
""" """
INSERT into Settings( INSERT into Settings(
acoustic_data, temperature, acoustic_data, temperature, distance_to_free_surface,
tmin_index, tmin_value, tmax_index, tmax_value, tmin_index, tmin_value, tmax_index, tmax_value,
rmin_index, rmin_value, rmax_index, rmax_value, rmin_index, rmin_value, rmax_index, rmax_value,
freq_bottom_detection_index, freq_bottom_detection_value, freq_bottom_detection_index, freq_bottom_detection_value,
SNR_filter_value, Nb_cells_to_average_BS_signal SNR_filter_value, Nb_cells_to_average_BS_signal
) )
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
stg.acoustic_data[i], stg.temperature, stg.acoustic_data[i], stg.temperature,
stg.distance_from_ABS_to_free_surface[i],
stg.tmin[i][0], stg.tmin[i][1], stg.tmin[i][0], stg.tmin[i][1],
stg.tmax[i][0], stg.tmax[i][1], stg.tmax[i][0], stg.tmax[i][1],
stg.rmin[i][0], stg.rmin[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)): for s in range(len(stg.acoustic_data)):
query3 = f''' query3 = f'''
SELECT SELECT
acoustic_data, temperature, acoustic_data, temperature, distance_to_free_surface,
tmin_index, tmin_value, tmax_index, tmax_value, tmin_index, tmin_value, tmax_index, tmax_value,
rmin_index, rmin_value, rmax_index, rmax_value, rmin_index, rmin_value, rmax_index, rmax_value,
freq_bottom_detection_index, freq_bottom_detection_value, freq_bottom_detection_index, freq_bottom_detection_value,
@ -490,13 +490,14 @@ class ReadTableForOpen:
x = data[0] x = data[0]
stg.temperature = [x[1]][0] stg.temperature = [x[1]][0]
stg.tmin.append((x[2], x[3])) stg.distance_from_ABS_to_free_surface.append(x[2])
stg.tmax.append((x[4], x[5])) stg.tmin.append((x[3], x[4]))
stg.rmin.append((x[6], x[7])) stg.tmax.append((x[5], x[6]))
stg.rmax.append((x[8], x[9])) stg.rmin.append((x[7], x[8]))
stg.freq_bottom_detection.append((x[10], x[11])) stg.rmax.append((x[9], x[10]))
stg.SNR_filter_value.append(x[12]) stg.freq_bottom_detection.append((x[11], x[12]))
stg.Nb_cells_to_average_BS_signal.append(x[13]) 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.temperature: {stg.temperature}")
logger.debug(f"stg.tmin: {stg.tmin}") logger.debug(f"stg.tmin: {stg.tmin}")

View File

@ -245,28 +245,47 @@ class UpdateTableForSave:
cur.execute(''' DROP TABLE Settings''') cur.execute(''' DROP TABLE Settings''')
cur.execute('''CREATE TABLE Settings(ID INTEGER PRIMARY KEY AUTOINCREMENT, cur.execute('''
CREATE TABLE Settings(
ID INTEGER PRIMARY KEY AUTOINCREMENT,
acoustic_data INTEGER, acoustic_data INTEGER,
temperature FLOAT, temperature FLOAT,
tmin_index FLOAT, tmin_value FLOAT, tmax_index FLOAT, tmax_value FLOAT, distance_to_free_surface FLOAT,
rmin_index FLOAT, rmin_value FLOAT, rmax_index FLOAT, rmax_value FLOAT, tmin_index FLOAT, tmin_value FLOAT,
freq_bottom_detection_index FLOAT, freq_bottom_detection_value STRING, tmax_index FLOAT, tmax_value FLOAT,
SNR_filter_value FLOAT, Nb_cells_to_average_BS_signal 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: for i in stg.acoustic_data:
cur.execute('''INSERT into Settings(acoustic_data, temperature, cur.execute('''
INSERT into Settings(
acoustic_data, temperature,
distance_to_free_surface,
tmin_index, tmin_value, tmax_index, tmax_value, tmin_index, tmin_value, tmax_index, tmax_value,
rmin_index, rmin_value, rmax_index, rmax_value, rmin_index, rmin_value, rmax_index, rmax_value,
freq_bottom_detection_index, freq_bottom_detection_value, freq_bottom_detection_index, freq_bottom_detection_value,
SNR_filter_value, Nb_cells_to_average_BS_signal) SNR_filter_value, Nb_cells_to_average_BS_signal
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''', ) 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.acoustic_data[i], stg.temperature,
stg.freq_bottom_detection[i][0], stg.freq_bottom_detection[i][1], stg.distance_from_ABS_to_free_surface[i],
stg.SNR_filter_value[i], stg.Nb_cells_to_average_BS_signal[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() cnx.commit()

View File

@ -844,7 +844,6 @@ class AcousticDataTab(QWidget):
self.groupbox_measurement_information_UBSediFlow() self.groupbox_measurement_information_UBSediFlow()
def groupbox_measurement_information_no_ABS(self): def groupbox_measurement_information_no_ABS(self):
self.label_ABS_name.hide() self.label_ABS_name.hide()
self.combobox_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") self.lineEdit_distance_from_ABS_to_free_surface.setText("0.00")
else: else:
stg.distance_from_ABS_to_free_surface[self.fileListWidget\ stg.distance_from_ABS_to_free_surface[
.currentRow()] = ( self.fileListWidget.currentRow()
] = (
float( float(
self.lineEdit_distance_from_ABS_to_free_surface\ self.lineEdit_distance_from_ABS_to_free_surface\
.text().replace(",", ".") .text().replace(",", ".")
) )
) )
self.lineEdit_distance_from_ABS_to_free_surface.setText( 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): def refresh_distance_from_ABS_to_free_surface(self):
self.pushbutton_distance_from_ABS_to_free_surface.blockSignals(True) self.pushbutton_distance_from_ABS_to_free_surface.blockSignals(True)
@ -1779,6 +1785,10 @@ class AcousticDataTab(QWidget):
.currentIndexChanged\ .currentIndexChanged\
.connect(self.combobox_frequency_information_update) .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}") logger.debug(f"Set temperature = {stg.temperature}")
self.lineEdit_temperature.setText(str(stg.temperature)) self.lineEdit_temperature.setText(str(stg.temperature))