From 31e145fd74604a620c57aac81b20d6f04ec51e85 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby Date: Tue, 29 Apr 2025 16:42:45 +0200 Subject: [PATCH] Acoustic data: Fix data removing from saved study. --- View/acoustic_data_tab.py | 125 +++++++++++++++++++++++++++----------- 1 file changed, 88 insertions(+), 37 deletions(-) diff --git a/View/acoustic_data_tab.py b/View/acoustic_data_tab.py index fe1fc57..8283494 100644 --- a/View/acoustic_data_tab.py +++ b/View/acoustic_data_tab.py @@ -1351,7 +1351,6 @@ class AcousticDataTab(QWidget): ("UBSediFlow file", "UBSediFlow file (*.udt)"), ] - system = self.combobox_ABS_system_choice.currentIndex() if system == 0: @@ -1454,42 +1453,7 @@ class AcousticDataTab(QWidget): del current_item # --- Clear variables --- - list_to_pop1 = [ - stg.acoustic_data, stg.date, stg.hour, - stg.freq, stg.freq_text, - stg.nb_profiles, stg.nb_profiles_per_sec, - stg.nb_cells, stg.cell_size, - stg.pulse_length, stg.nb_pings_per_sec, - stg.nb_pings_averaged_per_profile, - stg.kt_read, stg.kt_corrected, stg.gain_rx, stg.gain_tx, - stg.filename_BS_raw_data, stg.path_BS_raw_data, - stg.BS_raw_data, stg.time, stg.depth, - stg.BS_raw_data_reshape, stg.time_reshape, stg.depth_reshape - ] - - for p in list_to_pop1: - if isinstance(p, list): - p.pop(current_row) - - if stg.BS_cross_section: - list_to_pop2 = [ - stg.rmin, stg.rmax, stg.tmin, stg.tmax, - stg.time_cross_section, stg.depth_cross_section, - stg.BS_cross_section - ] - - for k in list_to_pop2: - k.pop(current_row) - - if stg.BS_stream_bed: - list_to_pop3 = [ - stg.BS_stream_bed, stg.depth_bottom, - stg.val_bottom, stg.ind_bottom, - stg.freq_bottom_detection - ] - - for s in list_to_pop3: - s.pop(current_row) + self.pop_setting_parameters(current_row) if self.fileListWidget.count() == 0: self.clear_files_from_ListWidget_reset() @@ -1727,6 +1691,93 @@ class AcousticDataTab(QWidget): stg.SSC_fine.append(np.array([])) stg.SSC_sand.append(np.array([])) + def pop_setting_parameters(self, data_id): + stg.acoustic_data = list( + range( + self.fileListWidget.count() + ) + ) + + stg.path_BS_raw_data.pop(data_id) + stg.filename_BS_raw_data.pop(data_id) + + stg.ABS_name.pop(data_id) + stg.BS_raw_data.pop(data_id) + stg.BS_raw_data_reshape.pop(data_id) + stg.depth.pop(data_id) + stg.depth_2D.pop(data_id) + stg.depth_reshape.pop(data_id) + stg.time.pop(data_id) + stg.time_reshape.pop(data_id) + stg.freq.pop(data_id) + stg.freq_text.pop(data_id) + stg.date.pop(data_id) + stg.hour.pop(data_id) + stg.distance_from_ABS_to_free_surface.pop(data_id) + stg.nb_profiles.pop(data_id) + stg.nb_profiles_per_sec.pop(data_id) + stg.nb_cells.pop(data_id) + stg.cell_size.pop(data_id) + stg.pulse_length.pop(data_id) + stg.nb_pings_per_sec.pop(data_id) + stg.nb_pings_averaged_per_profile.pop(data_id) + + stg.gain_rx.pop(data_id) + stg.gain_tx.pop(data_id) + stg.water_attenuation.pop(data_id) + + self.pop_setting_parameters_others(data_id) + + def pop_setting_parameters_others(self, data_id): + stg.BS_cross_section.pop(data_id) + stg.depth_cross_section.pop(data_id) + stg.time_cross_section.pop(data_id) + + stg.tmin.pop(data_id) + stg.tmax.pop(data_id) + stg.rmin.pop(data_id) + stg.rmax.pop(data_id) + + stg.BS_stream_bed.pop(data_id) + stg.depth_bottom.pop(data_id) + stg.val_bottom.pop(data_id) + stg.ind_bottom.pop(data_id) + stg.freq_bottom_detection.pop(data_id) + stg.depth_bottom_detection_min.pop(data_id) + stg.depth_bottom_detection_max.pop(data_id) + stg.depth_bottom_detection_interval.pop(data_id) + + stg.BS_mean.pop(data_id) + stg.BS_noise_raw_data.pop(data_id) + stg.BS_noise_averaged_data.pop(data_id) + stg.SNR_raw_data.pop(data_id) + stg.SNR_cross_section.pop(data_id) + stg.SNR_stream_bed.pop(data_id) + stg.time_noise.pop(data_id) + stg.depth_noise.pop(data_id) + stg.noise_method.pop(data_id) + stg.noise_value.pop(data_id) + stg.SNR_filter_value.pop(data_id) + stg.Nb_cells_to_average_BS_signal.pop(data_id) + stg.filename_BS_noise_data.pop(data_id) + stg.path_BS_noise_data.pop(data_id) + + stg.BS_raw_data_pre_process_SNR.pop(data_id) + stg.BS_raw_data_pre_process_average.pop(data_id) + + stg.BS_cross_section_pre_process_SNR.pop(data_id) + stg.BS_cross_section_pre_process_average.pop(data_id) + + stg.BS_stream_bed_pre_process_SNR.pop(data_id) + stg.BS_stream_bed_pre_process_average.pop(data_id) + + stg.kt2D.pop(data_id) + stg.kt3D.pop(data_id) + stg.J_cross_section.pop(data_id) + stg.VBI_cross_section.pop(data_id) + stg.SSC_fine.pop(data_id) + stg.SSC_sand.pop(data_id) + def fill_measurements_information_groupbox(self): if self.fileListWidget.currentRow() == -1: return