diff --git a/View/signal_processing_tab.py b/View/signal_processing_tab.py index d107ddf..d584e71 100644 --- a/View/signal_processing_tab.py +++ b/View/signal_processing_tab.py @@ -503,7 +503,12 @@ class SignalProcessingTab(QWidget): - the user change the limits of one or all the records in the first tab (Acoustic data) """ if len(stg.filename_BS_raw_data) == 0: - pass + msgBox = QMessageBox() + msgBox.setWindowTitle("Compute noise from profile tail error") + msgBox.setIcon(QMessageBox.Warning) + msgBox.setText("Download acoustic data in previous tab before updating data") + msgBox.setStandardButtons(QMessageBox.Ok) + msgBox.exec() else: @@ -662,45 +667,65 @@ class SignalProcessingTab(QWidget): # --- Plot averaged signal --- - if stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + if len(stg.filename_BS_raw_data) == 0: - self.verticalLayout_groupbox_plot_profile_tail.removeWidget(self.canvas_profile_tail) + msgBox = QMessageBox() + msgBox.setWindowTitle("Compute noise from profile tail error") + msgBox.setIcon(QMessageBox.Warning) + msgBox.setText("Download acoustic data in previous tab before computing noise from profile tail") + msgBox.setStandardButtons(QMessageBox.Ok) + msgBox.exec() - self.fig_profile_tail, self.axis_profile_tail = plt.subplots(nrows=1, ncols=1, layout='constrained') - self.canvas_profile_tail = FigureCanvas(self.fig_profile_tail) + elif self.combobox_acoustic_data_choice.count() == 0: - self.verticalLayout_groupbox_plot_profile_tail.addWidget(self.canvas_profile_tail) + msgBox = QMessageBox() + msgBox.setWindowTitle("Compute noise from profile tail error") + msgBox.setIcon(QMessageBox.Warning) + msgBox.setText("Refresh acoustic data before computing noise from profile tail") + msgBox.setStandardButtons(QMessageBox.Ok) + msgBox.exec() - self.axis_profile_tail.plot( - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq_noise_from_profile_tail.currentIndex()], - stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq_noise_from_profile_tail.currentIndex()], - color="blue", linewidth=1) - self.axis_profile_tail.plot( - -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq_noise_from_profile_tail.currentIndex()], - float(self.lineEdit_profile_tail_value.text().replace(",", ".")) * - np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq_noise_from_profile_tail.currentIndex()].shape[0]), - linestyle='dashed', linewidth=2, color='red') + else: - self.axis_profile_tail.set_yscale('log') - self.axis_profile_tail.tick_params(axis='both', labelsize=8) - self.axis_profile_tail.text(.98, .03, "Depth (m)", - fontsize=8, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.9, - horizontalalignment='right', verticalalignment='bottom', rotation='horizontal', - transform=self.axis_profile_tail.transAxes) - self.axis_profile_tail.text(.1, .45, "BS signal (v)", - fontsize=8, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.9, - horizontalalignment='right', verticalalignment='bottom', rotation='vertical', - transform=self.axis_profile_tail.transAxes) - self.axis_profile_tail.text(.98, .85, - stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][ - self.combobox_freq_noise_from_profile_tail.currentIndex()], - fontsize=10, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, - horizontalalignment='right', verticalalignment='bottom', - transform=self.axis_profile_tail.transAxes) + if stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - self.fig_profile_tail.canvas.draw_idle() + self.verticalLayout_groupbox_plot_profile_tail.removeWidget(self.canvas_profile_tail) + + self.fig_profile_tail, self.axis_profile_tail = plt.subplots(nrows=1, ncols=1, layout='constrained') + self.canvas_profile_tail = FigureCanvas(self.fig_profile_tail) + + self.verticalLayout_groupbox_plot_profile_tail.addWidget(self.canvas_profile_tail) + + self.axis_profile_tail.plot( + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq_noise_from_profile_tail.currentIndex()], + stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq_noise_from_profile_tail.currentIndex()], + color="blue", linewidth=1) + self.axis_profile_tail.plot( + -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()], + float(self.lineEdit_profile_tail_value.text().replace(",", ".")) * + np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()].shape[0]), + linestyle='dashed', linewidth=2, color='red') + + self.axis_profile_tail.set_yscale('log') + self.axis_profile_tail.tick_params(axis='both', labelsize=8) + self.axis_profile_tail.text(.98, .03, "Depth (m)", + fontsize=8, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.9, + horizontalalignment='right', verticalalignment='bottom', rotation='horizontal', + transform=self.axis_profile_tail.transAxes) + self.axis_profile_tail.text(.1, .45, "BS signal (v)", + fontsize=8, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.9, + horizontalalignment='right', verticalalignment='bottom', rotation='vertical', + transform=self.axis_profile_tail.transAxes) + self.axis_profile_tail.text(.98, .85, + stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][ + self.combobox_freq_noise_from_profile_tail.currentIndex()], + fontsize=10, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, + horizontalalignment='right', verticalalignment='bottom', + transform=self.axis_profile_tail.transAxes) + + self.fig_profile_tail.canvas.draw_idle() # ------------------------------------------------------