From 225c40c6c1c49612528defaa3a5f3a1d58163a7c Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby Date: Wed, 19 Mar 2025 16:12:55 +0100 Subject: [PATCH] Signal processing: Some minor refactoring. --- View/signal_processing_tab.py | 400 +++++++++++++++++----------------- 1 file changed, 201 insertions(+), 199 deletions(-) diff --git a/View/signal_processing_tab.py b/View/signal_processing_tab.py index 47cc4ee..47929f9 100644 --- a/View/signal_processing_tab.py +++ b/View/signal_processing_tab.py @@ -1520,112 +1520,113 @@ class SignalProcessingTab(QWidget): msgBox.exec() else: - + data_id = self.combobox_acoustic_data_choice.currentIndex() kernel_avg = np.ones(2 * int(float(self.lineEdit_horizontal_average.text().replace(",", "."))) + 1) print(kernel_avg) - stg.Nb_cells_to_average_BS_signal[self.combobox_acoustic_data_choice.currentIndex()] = ( + stg.Nb_cells_to_average_BS_signal[data_id] = ( float(self.lineEdit_horizontal_average.text().replace(",", "."))) - if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.time_cross_section[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): - x_time = stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()] - y_depth = stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()] + x_time = stg.time_cross_section[data_id] + y_depth = stg.depth_cross_section[data_id] - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): - x_time = stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()] - y_depth = stg.depth[self.combobox_acoustic_data_choice.currentIndex()] + x_time = stg.time_cross_section[data_id] + y_depth = stg.depth[data_id] else: - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): - x_time = stg.time[self.combobox_acoustic_data_choice.currentIndex()] - y_depth = stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()] + x_time = stg.time[data_id] + y_depth = stg.depth_cross_section[data_id] - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): - x_time = stg.time[self.combobox_acoustic_data_choice.currentIndex()] - y_depth = stg.depth[self.combobox_acoustic_data_choice.currentIndex()] + x_time = stg.time[data_id] + y_depth = stg.depth[data_id] - if stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.BS_stream_bed_pre_process_SNR[data_id].shape != (0,): - stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( - stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()])) + stg.BS_stream_bed_pre_process_average[data_id] = (deepcopy( + stg.BS_stream_bed_pre_process_SNR[data_id])) - for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + for f, _ in enumerate(stg.freq[data_id]): for i in range(y_depth.shape[1]): - stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( - convolve(stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], + stg.BS_stream_bed_pre_process_average[data_id][f, i, :] = ( + convolve(stg.BS_stream_bed_pre_process_SNR[data_id][f, i, :], kernel_avg)) - elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_cross_section_pre_process_SNR[data_id].shape != (0,): - stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( - stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()])) + stg.BS_cross_section_pre_process_average[data_id] = (deepcopy( + stg.BS_cross_section_pre_process_SNR[data_id])) - for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + for f, _ in enumerate(stg.freq[data_id]): for i in range(y_depth.shape[1]): - stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( - convolve(stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], + stg.BS_cross_section_pre_process_average[data_id][f, i, :] = ( + convolve(stg.BS_cross_section_pre_process_SNR[data_id][f, i, :], kernel_avg)) - elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_raw_data_pre_process_SNR[data_id].shape != (0,): - stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( - stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()])) + stg.BS_raw_data_pre_process_average[data_id] = (deepcopy( + stg.BS_raw_data_pre_process_SNR[data_id])) - for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + for f, _ in enumerate(stg.freq[data_id]): for i in range(y_depth.shape[1]): - stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( - convolve(stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], + stg.BS_raw_data_pre_process_average[data_id][f, i, :] = ( + convolve(stg.BS_raw_data_pre_process_SNR[data_id][f, i, :], kernel_avg)) - elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_stream_bed[data_id].shape != (0,): - stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( - stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()])) + stg.BS_stream_bed_pre_process_average[data_id] = (deepcopy( + stg.BS_stream_bed[data_id])) - for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + for f, _ in enumerate(stg.freq[data_id]): for i in range(y_depth.shape[1]): - stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( - convolve(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], kernel_avg)) + stg.BS_stream_bed_pre_process_average[data_id][f, i, :] = ( + convolve(stg.BS_stream_bed[data_id][f, i, :], kernel_avg)) - elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_cross_section[data_id].shape != (0,): - stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( - stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()])) + stg.BS_cross_section_pre_process_average[data_id] = (deepcopy( + stg.BS_cross_section[data_id])) - for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + for f, _ in enumerate(stg.freq[data_id]): for i in range(y_depth.shape[1]): - stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( - convolve(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], + stg.BS_cross_section_pre_process_average[data_id][f, i, :] = ( + convolve(stg.BS_cross_section[data_id][f, i, :], kernel_avg)) - elif stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_raw_data[data_id].shape != (0,): - stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( - stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()])) + stg.BS_raw_data_pre_process_average[data_id] = (deepcopy( + stg.BS_raw_data[data_id])) - for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): + for f, _ in enumerate(stg.freq[data_id]): for i in range(y_depth.shape[1]): - stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( - convolve(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], kernel_avg)) + stg.BS_raw_data_pre_process_average[data_id][f, i, :] = ( + convolve(stg.BS_raw_data[data_id][f, i, :], kernel_avg)) self.plot_pre_processed_BS_signal() self.update_plot_pre_processed_profile() @trace def plot_pre_processed_profile(self, *args): + data_id = self.combobox_acoustic_data_choice.currentIndex() - if ((self.combobox_acoustic_data_choice.currentIndex() != -1) and - (stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))): + if ((data_id != -1) and + (stg.BS_noise_raw_data[data_id].shape != (0,))): self.verticalLayout_groupbox_plot_profile.removeWidget(self.toolbar_profile) self.verticalLayout_groupbox_plot_profile.removeWidget(self.canvas_profile) @@ -1639,188 +1640,188 @@ class SignalProcessingTab(QWidget): # --- PLot profile --- - if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.BS_stream_bed_pre_process_average[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_stream_bed_pre_process_average[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_stream_bed_pre_process_average[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) elif stg.BS_cross_section_pre_process_average[self.combobox_frequency_profile.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_cross_section_pre_process_average[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_cross_section_pre_process_average[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_raw_data_pre_process_average[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_raw_data_pre_process_average[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_raw_data_pre_process_average[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_stream_bed_pre_process_SNR[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_stream_bed_pre_process_SNR[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_stream_bed_pre_process_SNR[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) elif stg.BS_cross_section_pre_process_SNR[self.combobox_frequency_profile.currentIndex()].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_cross_section_pre_process_SNR[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_cross_section_pre_process_SNR[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_raw_data_pre_process_SNR[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_raw_data_pre_process_SNR[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_raw_data_pre_process_SNR[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_stream_bed[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_stream_bed[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_stream_bed[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_cross_section[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_raw_data[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_raw_data[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_raw_data[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) self.axis_profile.text( - .95, .05, stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][ + .95, .05, stg.freq_text[data_id][ self.combobox_frequency_profile.currentIndex()], fontsize=10, fontweight='bold', fontname="DejaVu Sans", fontstyle="normal", c="black", alpha=0.2, @@ -1849,196 +1850,197 @@ class SignalProcessingTab(QWidget): self.slider.setMaximum(10) def update_plot_pre_processed_profile(self): + data_id = self.combobox_acoustic_data_choice.currentIndex() - if ((self.combobox_acoustic_data_choice.currentIndex() != -1) and - (stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))): + if ((data_id != -1) and + (stg.BS_noise_raw_data[data_id].shape != (0,))): self.axis_profile.cla() # --- PLot profile --- - if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.BS_stream_bed_pre_process_average[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_stream_bed_pre_process_average[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_stream_bed_pre_process_average[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_cross_section_pre_process_average[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_cross_section_pre_process_average[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_cross_section_pre_process_average[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_raw_data_pre_process_average[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_raw_data_pre_process_average[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_raw_data_pre_process_average[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_stream_bed_pre_process_SNR[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_stream_bed_pre_process_SNR[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_stream_bed_pre_process_SNR[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_cross_section_pre_process_SNR[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_cross_section_pre_process_SNR[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_cross_section_pre_process_SNR[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_raw_data_pre_process_SNR[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_raw_data_pre_process_SNR[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_raw_data_pre_process_SNR[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_stream_bed[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_stream_bed[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_stream_bed[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_cross_section[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.BS_raw_data[data_id].shape != (0,): - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_raw_data[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): self.axis_profile.plot( - stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][ + stg.BS_raw_data[data_id][ self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1], - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :], linestyle='solid', color='k', linewidth=1) self.axis_profile.text( - .95, .05, stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][ + .95, .05, stg.freq_text[data_id][ self.combobox_frequency_profile.currentIndex()], fontsize=10, fontweight='bold', fontname="DejaVu Sans", fontstyle="normal", c="black", alpha=0.2, @@ -2051,44 +2053,44 @@ class SignalProcessingTab(QWidget): self.figure_profile.canvas.draw_idle() # --- Update red line position on transect --- - if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.depth_cross_section[data_id].shape != (0,): - if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.time_cross_section[data_id].shape != (0,): self.red_line_return.set_data( - stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.time_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), self.slider.value()-1] * - np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1]), - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + np.ones(stg.depth_cross_section[data_id].shape[1]), + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :]) - elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.time[data_id].shape != (0,): self.red_line_return.set_data( - stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.time[data_id][ self.combobox_frequency_profile.currentIndex(), self.slider.value() - 1] * - np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1]), - -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + np.ones(stg.depth_cross_section[data_id].shape[1]), + -stg.depth_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), :]) - elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.depth[data_id].shape != (0,): - if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if stg.time_cross_section[data_id].shape != (0,): self.red_line_return.set_data( - stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.time_cross_section[data_id][ self.combobox_frequency_profile.currentIndex(), self.slider.value() - 1] * - np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1]), - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + np.ones(stg.depth[data_id].shape[1]), + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :]) - elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + elif stg.time[data_id].shape != (0,): self.red_line_return.set_data( - stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.time[data_id][ self.combobox_frequency_profile.currentIndex(), self.slider.value() - 1] * - np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1]), - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + np.ones(stg.depth[data_id].shape[1]), + -stg.depth[data_id][ self.combobox_frequency_profile.currentIndex(), :]) self.fig_BS.canvas.draw_idle()