Commit with minor modifications

dev-brahim
brahim 2023-09-27 11:46:58 +02:00
parent cd33f9d85c
commit e0b76447e6
4 changed files with 65 additions and 24 deletions

View File

@ -28,7 +28,7 @@ import Translation.constant_string as cs
from Model.TableModel import TableModel from Model.TableModel import TableModel
from Model.AquascatDataLoader import RawAquascatData from Model.AquascatDataLoader import RawAquascatData
from Model.acoustic_data_loader import AcousticDataLoader 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 from View.sample_data_tab import SampleDataTab
@ -717,6 +717,7 @@ class AcousticDataTab(QWidget):
try: try:
stg.path_BS_noise_data = dir_name stg.path_BS_noise_data = dir_name
stg.filename_BS_noise_data = name stg.filename_BS_noise_data = name
self.load_noise_data_and_compute_SNR()
except ValueError as e: except ValueError as e:
msgBox = QMessageBox() msgBox = QMessageBox()
msgBox.setWindowTitle("Download Error") msgBox.setWindowTitle("Download Error")
@ -725,7 +726,6 @@ class AcousticDataTab(QWidget):
msgBox.setStandardButtons(QMessageBox.Ok) msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec() msgBox.exec()
else: else:
self.load_noise_data_and_compute_SNR()
self.lineEdit_noise_file.setText(stg.filename_BS_noise_data) self.lineEdit_noise_file.setText(stg.filename_BS_noise_data)
self.lineEdit_noise_file.setToolTip(stg.path_BS_noise_data) self.lineEdit_noise_file.setToolTip(stg.path_BS_noise_data)
self.label_date_groupbox_noise_file.setText( self.label_date_groupbox_noise_file.setText(
@ -922,10 +922,13 @@ class AcousticDataTab(QWidget):
# --- Backscatter acoustic signal is recorded for next tab --- # --- 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]: 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]] 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]: 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]] 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]: 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]] 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]): for f in range(stg.freq.shape[0]):
self.axis_BS[f].cla() self.axis_BS[f].cla()

View File

@ -333,6 +333,8 @@ class AcousticInversionTab(QWidget):
int(stg.frequencies_to_compute_VBI[1, 0])], :], int(stg.frequencies_to_compute_VBI[1, 0])], :],
stg.r_2D, stg.kt_corrected_3D)) stg.r_2D, stg.kt_corrected_3D))
else: 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 = ( stg.J_cross_section = (
self.inv_hc.j_cross_section( self.inv_hc.j_cross_section(
stg.BS_data_section_SNR_filter[:, [int(stg.frequencies_to_compute_VBI[0, 0]), stg.BS_data_section_SNR_filter[:, [int(stg.frequencies_to_compute_VBI[0, 0]),

View File

@ -16,6 +16,7 @@ from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as Navigatio
from copy import deepcopy from copy import deepcopy
from os import path from os import path
import csv
from Model.granulo_loader import GranuloLoader from Model.granulo_loader import GranuloLoader
@ -525,15 +526,24 @@ class SampleDataTab(QWidget):
# --- Function to export data of table --- # --- Function to export data of table ---
def export_table(self): def export_table(self):
if self.tableWidget_sample.columnCount() > 10: pass
print("Export table") # if self.tableWidget_sample.columnCount() > 10:
else: # name = QFileDialog.getSaveFileName(self, 'Save File')
msgBox = QMessageBox() # with open(fichiercsv, 'w', newline='') as csvfile:
msgBox.setWindowTitle("Export table Error") # csvwriter = csv.writer(csvfile, delimiter=';', quoting=csv.QUOTE_MINIMAL)
msgBox.setIcon(QMessageBox.Warning) # for row in range(0, self.tableWidget_sample.rowCount()):
msgBox.setText("Fill table before export table") # ligne = []
msgBox.setStandardButtons(QMessageBox.Ok) # for col in range(0, self.tableWidget_sample.columnCount()):
msgBox.exec() # 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 --- # --- Functions to plot samples positions on transect ---
@ -701,7 +711,7 @@ class SampleDataTab(QWidget):
self.axis_plot_sample_position_on_transect.set_yticks([]) self.axis_plot_sample_position_on_transect.set_yticks([])
self.figure_plot_sample_position_on_transect.canvas.draw_idle() 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_min = np.nanmin(stg.BS_data[:, stg.freq_bottom_detection, :])
val_max = np.nanmax(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.axis_plot_sample_position_on_transect.set_yticks([])
self.figure_plot_sample_position_on_transect.canvas.draw_idle() 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 --- # --- Functions to plot total concentration ---

View File

@ -1198,6 +1198,8 @@ class SignalProcessingTab(QWidget):
def update_plot_FCB(self): def update_plot_FCB(self):
if stg.FCB.size != 0:
for f in range(stg.freq.shape[0]): for f in range(stg.freq.shape[0]):
self.axis_FCB_profile[f].cla() self.axis_FCB_profile[f].cla()