diff --git a/View/acoustic_data_tab.py b/View/acoustic_data_tab.py index cee3360..cef6f0b 100644 --- a/View/acoustic_data_tab.py +++ b/View/acoustic_data_tab.py @@ -28,7 +28,7 @@ import Translation.constant_string as cs from Model.TableModel import TableModel from Model.AquascatDataLoader import RawAquascatData from Model.acoustic_data_loader import AcousticDataLoader -from View.window_noise_level_averaged_profile import WindowNoiseLevelTailAveragedProfile +# from View.window_noise_level_averaged_profile import WindowNoiseLevelTailAveragedProfile from View.sample_data_tab import SampleDataTab @@ -717,6 +717,7 @@ class AcousticDataTab(QWidget): try: stg.path_BS_noise_data = dir_name stg.filename_BS_noise_data = name + self.load_noise_data_and_compute_SNR() except ValueError as e: msgBox = QMessageBox() msgBox.setWindowTitle("Download Error") @@ -725,7 +726,6 @@ class AcousticDataTab(QWidget): msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() else: - self.load_noise_data_and_compute_SNR() self.lineEdit_noise_file.setText(stg.filename_BS_noise_data) self.lineEdit_noise_file.setToolTip(stg.path_BS_noise_data) self.label_date_groupbox_noise_file.setText( @@ -922,10 +922,13 @@ class AcousticDataTab(QWidget): # --- Backscatter acoustic signal is recorded for next tab --- stg.BS_data = stg.BS_raw_data[:, :, np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]] + print("stg.time shape ", stg.time.shape) stg.t = stg.time[np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]] + print("stg.t shape ", stg.t.shape) stg.r_2D = stg.r_2D[:, np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]] + print("stg.r shape ", stg.r_2D.shape) for f in range(stg.freq.shape[0]): self.axis_BS[f].cla() diff --git a/View/acoustic_inversion_tab.py b/View/acoustic_inversion_tab.py index 81bdd7f..42aa969 100644 --- a/View/acoustic_inversion_tab.py +++ b/View/acoustic_inversion_tab.py @@ -333,6 +333,8 @@ class AcousticInversionTab(QWidget): int(stg.frequencies_to_compute_VBI[1, 0])], :], stg.r_2D, stg.kt_corrected_3D)) else: + print("stg.r_2D.shape ", stg.r_2D.shape) + print("stg.kt_corrected_3D.shape ", stg.kt_corrected_3D.shape) stg.J_cross_section = ( self.inv_hc.j_cross_section( stg.BS_data_section_SNR_filter[:, [int(stg.frequencies_to_compute_VBI[0, 0]), diff --git a/View/sample_data_tab.py b/View/sample_data_tab.py index c4ea000..7601ef5 100644 --- a/View/sample_data_tab.py +++ b/View/sample_data_tab.py @@ -16,6 +16,7 @@ from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as Navigatio from copy import deepcopy from os import path +import csv from Model.granulo_loader import GranuloLoader @@ -525,15 +526,24 @@ class SampleDataTab(QWidget): # --- Function to export data of table --- def export_table(self): - if self.tableWidget_sample.columnCount() > 10: - print("Export table") - else: - msgBox = QMessageBox() - msgBox.setWindowTitle("Export table Error") - msgBox.setIcon(QMessageBox.Warning) - msgBox.setText("Fill table before export table") - msgBox.setStandardButtons(QMessageBox.Ok) - msgBox.exec() + pass + # if self.tableWidget_sample.columnCount() > 10: + # name = QFileDialog.getSaveFileName(self, 'Save File') + # with open(fichiercsv, 'w', newline='') as csvfile: + # csvwriter = csv.writer(csvfile, delimiter=';', quoting=csv.QUOTE_MINIMAL) + # for row in range(0, self.tableWidget_sample.rowCount()): + # ligne = [] + # for col in range(0, self.tableWidget_sample.columnCount()): + # valeurcase = self.tableWidget_sample.item(row, col).text().strip() + # ligne.append(valeurcase) + # csvwriter.writerow(ligne) + # else: + # msgBox = QMessageBox() + # msgBox.setWindowTitle("Export table Error") + # msgBox.setIcon(QMessageBox.Warning) + # msgBox.setText("Fill table before export table") + # msgBox.setStandardButtons(QMessageBox.Ok) + # msgBox.exec() # ------------------------------------------------------------------------------------------------------------------ # --- Functions to plot samples positions on transect --- @@ -701,7 +711,7 @@ class SampleDataTab(QWidget): self.axis_plot_sample_position_on_transect.set_yticks([]) self.figure_plot_sample_position_on_transect.canvas.draw_idle() - else: #self.canvas_plot_sample_position_on_transect != None: + elif stg.BS_data_section.size == 0: val_min = np.nanmin(stg.BS_data[:, stg.freq_bottom_detection, :]) val_max = np.nanmax(stg.BS_data[:, stg.freq_bottom_detection, :]) @@ -725,6 +735,30 @@ class SampleDataTab(QWidget): self.axis_plot_sample_position_on_transect.set_yticks([]) self.figure_plot_sample_position_on_transect.canvas.draw_idle() + else: + + val_min = np.nanmin(stg.BS_data_section[:, stg.freq_bottom_detection, :]) + val_max = np.nanmax(stg.BS_data_section[:, stg.freq_bottom_detection, :]) + if val_min == 0: + val_min = 1e-5 + + self.axis_plot_sample_position_on_transect.pcolormesh( + stg.t, -stg.r, stg.BS_data_section[:, self.combobox_frequencies.currentIndex(), :], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + + if stg.r_bottom.size != 0: + self.axis_plot_sample_position_on_transect.plot( + stg.t, -stg.r_bottom, color='black', linewidth=1, linestyle="solid") + + self.axis_plot_sample_position_on_transect.scatter(stg.sample_time[position_list], + stg.sample_depth[position_list], + linestyle='None', marker="o", s=14, c=color_list) + + self.axis_plot_sample_position_on_transect.set_xticks([]) + self.axis_plot_sample_position_on_transect.set_yticks([]) + self.figure_plot_sample_position_on_transect.canvas.draw_idle() + + # ------------------------------------------------------------------------------------------------------------------ # --- Functions to plot total concentration --- diff --git a/View/signal_processing_tab.py b/View/signal_processing_tab.py index a75b143..bf512f8 100644 --- a/View/signal_processing_tab.py +++ b/View/signal_processing_tab.py @@ -1198,23 +1198,25 @@ class SignalProcessingTab(QWidget): def update_plot_FCB(self): - for f in range(stg.freq.shape[0]): + if stg.FCB.size != 0: - self.axis_FCB_profile[f].cla() + for f in range(stg.freq.shape[0]): - self.axis_FCB_profile[f].plot(stg.r, stg.FCB[:, f, self.slider.value()], linestyle="solid", linewidth=1, color="k") + self.axis_FCB_profile[f].cla() - # self.axis_FCB_profile[f].set_ylim(-np.max(stg.r), np.min(stg.r)) + self.axis_FCB_profile[f].plot(stg.r, stg.FCB[:, f, self.slider.value()], linestyle="solid", linewidth=1, color="k") - self.axis_FCB_profile[f].text(.95, .05, stg.freq_text[f], - fontsize=10, fontweight='bold', fontname="Ubuntu", - fontstyle="normal", c="black", alpha=0.2, - horizontalalignment='right', verticalalignment='bottom', - transform=self.axis_FCB_profile[f].transAxes) + # self.axis_FCB_profile[f].set_ylim(-np.max(stg.r), np.min(stg.r)) - self.figure_FCB_profile.supylabel("FCB") - self.figure_FCB_profile.supxlabel("Depth (m)") - self.figure_FCB_profile.canvas.draw_idle() + self.axis_FCB_profile[f].text(.95, .05, stg.freq_text[f], + fontsize=10, fontweight='bold', fontname="Ubuntu", + fontstyle="normal", c="black", alpha=0.2, + horizontalalignment='right', verticalalignment='bottom', + transform=self.axis_FCB_profile[f].transAxes) + + self.figure_FCB_profile.supylabel("FCB") + self.figure_FCB_profile.supxlabel("Depth (m)") + self.figure_FCB_profile.canvas.draw_idle()