diff --git a/View/sample_data_tab.py b/View/sample_data_tab.py index 2b6ffff..64ebc22 100644 --- a/View/sample_data_tab.py +++ b/View/sample_data_tab.py @@ -1109,7 +1109,16 @@ class SampleDataTab(QWidget): def fill_comboboxes_and_plot_transect(self): self.combobox_acoustic_data.clear() - self.combobox_acoustic_data.addItems(stg.filename_BS_raw_data) + for n, m in enumerate(stg.noise_method): + print("n = ", n, "m = ", m) + if stg.noise_method[n] == 0: + print("stg.filename_BS_raw_data ", stg.filename_BS_raw_data) + self.combobox_acoustic_data.addItem(stg.filename_BS_raw_data[n]) + elif stg.noise_method[n]!=0: + print("stg.data_preprocessed ", stg.data_preprocessed) + print("stg.data_preprocessed[n] ", stg.data_preprocessed[n]) + self.combobox_acoustic_data.addItem(stg.data_preprocessed[n]) + self.plot_sample_position_on_transect() self.combobox_acoustic_data.currentIndexChanged.connect(self.update_plot_sample_position_on_transect) self.combobox_frequencies.currentIndexChanged.connect(self.update_plot_sample_position_on_transect) @@ -1131,12 +1140,62 @@ class SampleDataTab(QWidget): # self.combobox_frequencies.currentTextChanged.connect(self.update_plot_sample_position_on_transect) self.verticalLayout_groupbox_plot_transect.removeWidget(self.canvas_plot_sample_position_on_transect) + self.figure_plot_sample_position_on_transect, self.axis_plot_sample_position_on_transect = \ plt.subplots(nrows=1, ncols=1, layout="constrained") self.canvas_plot_sample_position_on_transect = FigureCanvas(self.figure_plot_sample_position_on_transect) + self.verticalLayout_groupbox_plot_transect.addWidget(self.canvas_plot_sample_position_on_transect) - if stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,): + if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + val_min = np.nanmin(stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :]) + val_max = np.nanmax(stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :]) + if val_min == 0: + val_min = 1e-5 + + self.axis_plot_sample_position_on_transect.pcolormesh( + stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + + self.axis_plot_sample_position_on_transect.plot( + stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], color='black', linewidth=1, + linestyle="solid") + + elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + val_min = np.nanmin(stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :]) + val_max = np.nanmax(stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :]) + if val_min == 0: + val_min = 1e-5 + + self.axis_plot_sample_position_on_transect.pcolormesh( + stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + + self.axis_plot_sample_position_on_transect.plot( + stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], color='black', linewidth=1, + linestyle="solid") + + elif stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,): val_min = np.nanmin(stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :, :]) val_max = np.nanmax(stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :, :]) @@ -1153,6 +1212,46 @@ class SampleDataTab(QWidget): stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], color='black', linewidth=1, linestyle="solid") + elif stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + val_min = np.nanmin( + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :]) + val_max = np.nanmax( + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :]) + if val_min == 0: + val_min = 1e-5 + + self.axis_plot_sample_position_on_transect.pcolormesh( + stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + + elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + val_min = np.nanmin( + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :]) + val_max = np.nanmax( + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :]) + if val_min == 0: + val_min = 1e-5 + + self.axis_plot_sample_position_on_transect.pcolormesh( + stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): val_min = np.nanmin( @@ -1168,6 +1267,38 @@ class SampleDataTab(QWidget): stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + val_min = np.nanmin(stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :]) + val_max = np.nanmax(stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :]) + if val_min == 0: + val_min = 1e-5 + + self.axis_plot_sample_position_on_transect.pcolormesh( + stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], + -stg.depth[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + + elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + val_min = np.nanmin(stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :]) + val_max = np.nanmax(stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :]) + if val_min == 0: + val_min = 1e-5 + + self.axis_plot_sample_position_on_transect.pcolormesh( + stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], + -stg.depth[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :], + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + elif stg.BS_raw_data[self.combobox_acoustic_data.currentIndex()].shape != (0,): val_min = np.nanmin(stg.BS_raw_data[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :, :]) @@ -1190,7 +1321,59 @@ class SampleDataTab(QWidget): self.axis_plot_sample_position_on_transect.cla() # --- Create canvas of Matplotlib figure --- - if stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,): + if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + val_min = np.nanmin( + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), + :, :]) + val_max = np.nanmax( + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), + :, :]) + if val_min == 0: + val_min = 1e-5 + + self.axis_plot_sample_position_on_transect.pcolormesh( + stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), + :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + + self.axis_plot_sample_position_on_transect.plot( + stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], + color='black', linewidth=1, linestyle="solid") + + elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + val_min = np.nanmin( + stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), + :, :]) + val_max = np.nanmax( + stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), + :, :]) + if val_min == 0: + val_min = 1e-5 + + self.axis_plot_sample_position_on_transect.pcolormesh( + stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), + :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + + self.axis_plot_sample_position_on_transect.plot( + stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], + color='black', linewidth=1, linestyle="solid") + + elif stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,): val_min = np.nanmin(stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :, :]) val_max = np.nanmax(stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), :, :]) @@ -1208,6 +1391,52 @@ class SampleDataTab(QWidget): -stg.depth_bottom[self.combobox_acoustic_data.currentIndex()], color='black', linewidth=1, linestyle="solid") + elif stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + val_min = np.nanmin( + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + val_max = np.nanmax( + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + if val_min == 0: + val_min = 1e-5 + + self.axis_plot_sample_position_on_transect.pcolormesh( + stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + + elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + val_min = np.nanmin( + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + val_max = np.nanmax( + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + if val_min == 0: + val_min = 1e-5 + + self.axis_plot_sample_position_on_transect.pcolormesh( + stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + -stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): val_min = np.nanmin( @@ -1228,6 +1457,52 @@ class SampleDataTab(QWidget): :, :], cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + val_min = np.nanmin( + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + val_max = np.nanmax( + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + if val_min == 0: + val_min = 1e-5 + + self.axis_plot_sample_position_on_transect.pcolormesh( + stg.time[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + -stg.depth[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + + elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()].shape != (0,): + + val_min = np.nanmin( + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + val_max = np.nanmax( + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :]) + if val_min == 0: + val_min = 1e-5 + + self.axis_plot_sample_position_on_transect.pcolormesh( + stg.time[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + -stg.depth[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), :], + stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data.currentIndex()][ + self.combobox_frequencies.currentIndex(), + :, :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + elif stg.BS_raw_data[self.combobox_acoustic_data.currentIndex()].shape != (0,): val_min = np.nanmin(