From 714be6491554e27941cede34e8233804037d7f27 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby Date: Wed, 26 Mar 2025 15:27:42 +0100 Subject: [PATCH] SQL: Fix save study after open. --- Model/create_table_for_save_as.py | 3 ++- Model/update_table_for_save.py | 38 +++++++++++++++++++------------ View/sample_data_tab.py | 6 +++-- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/Model/create_table_for_save_as.py b/Model/create_table_for_save_as.py index 3ee9696..4f8a2b2 100644 --- a/Model/create_table_for_save_as.py +++ b/Model/create_table_for_save_as.py @@ -543,7 +543,8 @@ class CreateTableForSaveAs: np.array(stg.X_exponent).tobytes(), np.array(stg.alpha_s).tobytes(), np.array(stg.zeta).tobytes(), - stg.FCB.tobytes(), stg.depth_real.tobytes(), + np.array(stg.FCB).tobytes(), + np.array(stg.depth_real).tobytes(), np.array(stg.lin_reg).tobytes() ) ) diff --git a/Model/update_table_for_save.py b/Model/update_table_for_save.py index 97d887c..7382f1b 100644 --- a/Model/update_table_for_save.py +++ b/Model/update_table_for_save.py @@ -207,21 +207,29 @@ class UpdateTableForSave: BS_mean) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''', (stg.acoustic_data[i], stg.time[i].tobytes(), stg.depth[i].tobytes(), stg.BS_raw_data[i].tobytes(), - stg.time_reshape[i].tobytes(), stg.depth_reshape[i].tobytes(), stg.BS_raw_data_reshape[i].tobytes(), - stg.time_cross_section[i].tobytes(), stg.depth_cross_section[i].tobytes(), stg.BS_cross_section[i].tobytes(), - stg.BS_stream_bed[i].tobytes(), - stg.depth_bottom[i].tobytes(), stg.val_bottom[i].tobytes(), np.array(stg.ind_bottom[i]).tobytes(), - stg.time_noise[i].tobytes(), stg.depth_noise[i].tobytes(), - stg.BS_noise_raw_data[i].tobytes(), - stg.SNR_raw_data[i].tobytes(), stg.SNR_cross_section[i].tobytes(), - stg.SNR_stream_bed[i].tobytes(), - stg.BS_raw_data_pre_process_SNR[i].tobytes(), - stg.BS_raw_data_pre_process_average[i].tobytes(), - stg.BS_cross_section_pre_process_SNR[i].tobytes(), - stg.BS_cross_section_pre_process_average[i].tobytes(), - stg.BS_stream_bed_pre_process_SNR[i].tobytes(), - stg.BS_stream_bed_pre_process_average[i].tobytes(), - stg.BS_mean[i].tobytes() + stg.time_reshape[i].tobytes(), + stg.depth_reshape[i].tobytes(), + stg.BS_raw_data_reshape[i].tobytes(), + stg.time_cross_section[i].tobytes(), + stg.depth_cross_section[i].tobytes(), + stg.BS_cross_section[i].tobytes(), + np.array(stg.BS_stream_bed[i]).tobytes(), + np.array(stg.depth_bottom[i]).tobytes(), + np.array(stg.val_bottom[i]).tobytes(), + np.array(stg.ind_bottom[i]).tobytes(), + np.array(stg.time_noise[i]).tobytes(), + np.array(stg.depth_noise[i]).tobytes(), + np.array(stg.BS_noise_raw_data[i]).tobytes(), + np.array(stg.SNR_raw_data[i]).tobytes(), + np.array(stg.SNR_cross_section[i]).tobytes(), + np.array(stg.SNR_stream_bed[i]).tobytes(), + np.array(stg.BS_raw_data_pre_process_SNR[i]).tobytes(), + np.array(stg.BS_raw_data_pre_process_average[i]).tobytes(), + np.array(stg.BS_cross_section_pre_process_SNR[i]).tobytes(), + np.array(stg.BS_cross_section_pre_process_average[i]).tobytes(), + np.array(stg.BS_stream_bed_pre_process_SNR[i]).tobytes(), + np.array(stg.BS_stream_bed_pre_process_average[i]).tobytes(), + np.array(stg.BS_mean[i]).tobytes() ) ) diff --git a/View/sample_data_tab.py b/View/sample_data_tab.py index 9b97070..deb50da 100644 --- a/View/sample_data_tab.py +++ b/View/sample_data_tab.py @@ -469,7 +469,8 @@ class SampleDataTab(QWidget): self.item_checkbox_fine.setCheckState(Qt.Checked) self.tableWidget_fine.setItem(i, 1, self.item_checkbox_fine) self.item_checkbox_fine.setText("F" + str(i + 1)) - stg.sample_fine.append(("F" + str(i + 1), i)) + if len(stg.sample_fine) <= i: + stg.sample_fine.append(("F" + str(i + 1), i)) # --- Fill table with data --- for i in range(stg.frac_vol_fine.shape[0]): @@ -562,7 +563,8 @@ class SampleDataTab(QWidget): self.item_checkbox_sand.setCheckState(Qt.Checked) self.tableWidget_sand.setItem(i, 1, self.item_checkbox_sand) self.item_checkbox_sand.setText("S" + str(i + 1)) - stg.sample_sand.append(("S" + str(i + 1), i)) + if len(stg.sample_sand) <= i: + stg.sample_sand.append(("S" + str(i + 1), i)) # --- Fill table with data --- for i in range(stg.frac_vol_sand.shape[0]):