Correction of the red cross button (if no acoustic data) #33

dev-brahim
brahim 2025-03-13 14:19:44 +01:00
parent 3c78777179
commit eef048b197
1 changed files with 61 additions and 55 deletions

View File

@ -730,82 +730,88 @@ class SignalProcessingTab(QWidget):
def clear_noise_data(self):
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.time_noise[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] = 0
stg.SNR_filter_value[self.combobox_acoustic_data_choice.currentIndex()] = 0
if len(stg.filename_BS_raw_data) == 0:
stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
pass
stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
else:
stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.time_noise[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] = 0
stg.SNR_filter_value[self.combobox_acoustic_data_choice.currentIndex()] = 0
if stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 0:
self.lineEdit_noise_file.clear()
stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
elif stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 1:
self.lineEdit_val1.clear()
self.lineEdit_val1.setText("0.00")
stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
self.lineEdit_val2.clear()
self.lineEdit_val2.setText("0.00")
stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
self.lineEdit_profile_tail_value.clear()
self.lineEdit_profile_tail_value.setText("0.0000")
if stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 0:
self.lineEdit_noise_file.clear()
self.verticalLayout_groupbox_plot_profile_tail.removeWidget(self.canvas_profile_tail)
self.canvas_profile_tail = FigureCanvas()
self.verticalLayout_groupbox_plot_profile_tail.addWidget(self.canvas_profile_tail)
elif stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 1:
self.lineEdit_val1.clear()
self.lineEdit_val1.setText("0.00")
self.lineEdit_SNR_criterion.setText("0.00")
self.lineEdit_horizontal_average.setText("0.00")
self.lineEdit_val2.clear()
self.lineEdit_val2.setText("0.00")
# --- Clear SNR plot ---
self.verticalLayout_groupbox_plot_SNR.removeWidget(self.toolbar_SNR)
self.verticalLayout_groupbox_plot_SNR.removeWidget(self.scroll_SNR)
self.lineEdit_profile_tail_value.clear()
self.lineEdit_profile_tail_value.setText("0.0000")
self.canvas_SNR = FigureCanvas()
self.toolbar_SNR = NavigationToolBar(self.canvas_SNR, self)
self.scroll_SNR.setWidget(self.canvas_SNR)
self.verticalLayout_groupbox_plot_profile_tail.removeWidget(self.canvas_profile_tail)
self.canvas_profile_tail = FigureCanvas()
self.verticalLayout_groupbox_plot_profile_tail.addWidget(self.canvas_profile_tail)
self.verticalLayout_groupbox_plot_SNR.addWidget(self.toolbar_SNR)
self.verticalLayout_groupbox_plot_SNR.addWidget(self.scroll_SNR)
self.lineEdit_SNR_criterion.setText("0.00")
self.lineEdit_horizontal_average.setText("0.00")
# --- Clear BS plot ---
self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.removeWidget(self.toolbar_BS)
self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.removeWidget(self.scroll_BS)
# --- Clear SNR plot ---
self.verticalLayout_groupbox_plot_SNR.removeWidget(self.toolbar_SNR)
self.verticalLayout_groupbox_plot_SNR.removeWidget(self.scroll_SNR)
self.canvas_BS = FigureCanvas()
self.toolbar_BS = NavigationToolBar(self.canvas_BS, self)
self.scroll_BS.setWidget(self.canvas_BS)
self.canvas_SNR = FigureCanvas()
self.toolbar_SNR = NavigationToolBar(self.canvas_SNR, self)
self.scroll_SNR.setWidget(self.canvas_SNR)
self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.addWidget(self.toolbar_BS)
self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.addWidget(self.scroll_BS)
self.verticalLayout_groupbox_plot_SNR.addWidget(self.toolbar_SNR)
self.verticalLayout_groupbox_plot_SNR.addWidget(self.scroll_SNR)
self.combobox_frequency_profile.clear()
# --- Clear BS plot ---
self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.removeWidget(self.toolbar_BS)
self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.removeWidget(self.scroll_BS)
self.verticalLayout_groupbox_plot_profile.removeWidget(self.toolbar_profile)
self.verticalLayout_groupbox_plot_profile.removeWidget(self.canvas_profile)
self.canvas_BS = FigureCanvas()
self.toolbar_BS = NavigationToolBar(self.canvas_BS, self)
self.scroll_BS.setWidget(self.canvas_BS)
self.canvas_profile = FigureCanvas()
self.toolbar_profile = NavigationToolBar(self.canvas_profile, self)
self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.addWidget(self.toolbar_BS)
self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.addWidget(self.scroll_BS)
self.verticalLayout_groupbox_plot_profile.addWidget(self.toolbar_profile)
self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_profile)
self.combobox_frequency_profile.clear()
self.slider.setValue(1)
self.slider.setMaximum(10)
self.verticalLayout_groupbox_plot_profile.removeWidget(self.toolbar_profile)
self.verticalLayout_groupbox_plot_profile.removeWidget(self.canvas_profile)
self.slider.setValue(0)
self.slider.setMaximum(10)
self.canvas_profile = FigureCanvas()
self.toolbar_profile = NavigationToolBar(self.canvas_profile, self)
self.verticalLayout_groupbox_plot_profile.addWidget(self.toolbar_profile)
self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_profile)
self.slider.setValue(1)
self.slider.setMaximum(10)
self.slider.setValue(0)
self.slider.setMaximum(10)
def open_dialog_box(self):