Compare commits

..

19 Commits

Author SHA1 Message Date
Pierre-Antoine 11ced0a263 Mainwindow: Minor change. 2025-03-17 10:44:49 +01:00
Pierre-Antoine 5cf87a5e7b Mainwindow: Fix table export. 2025-03-17 10:41:38 +01:00
brahim 477ad00cf8 hyperlink of git deposit is added in about window 2025-03-14 17:22:19 +01:00
brahim 1c409531a1 logger added to print computed values of calibration parameters 2025-03-14 16:42:23 +01:00
brahim 5734f6e614 Clear button works when only one acoustic file is downloaded and crash when more than one acoustic file is downloaded #34 2025-03-14 16:33:08 +01:00
brahim 22cd451b24 Error message is added when user click on import/compute calibration without acoustic data #37 2025-03-14 11:52:27 +01:00
brahim 22be597d75 Correction of Delete acoustic data issue (#34) generates others issues in measurements information box. To be continued ... 2025-03-14 11:40:44 +01:00
brahim 671f66058c the clear button is partially corrected 2025-03-13 17:11:10 +01:00
brahim 2d6c950dfe the delete button is corrected 2025-03-13 17:01:13 +01:00
brahim fe9ac2d65c Some correction : Profile and display option wasn't filled when the user download an acoustic file 2025-03-13 16:03:51 +01:00
brahim bdeca2b44e Correction when the user clicks on the clear button (clear profile tail) #36 2025-03-13 15:41:04 +01:00
brahim 06056d4865 Correction of average filter button (if no acoustic data) #33 2025-03-13 15:22:49 +01:00
brahim df68a862fc Correction of SNR filter button (if no acoustic data) #33 2025-03-13 15:19:30 +01:00
brahim 7a5f6d41f7 Correction of the profile tail button (if no acoustic data) #33 2025-03-13 15:07:31 +01:00
brahim eef048b197 Correction of the red cross button (if no acoustic data) #33 2025-03-13 14:19:44 +01:00
brahim 3c78777179 Correction of reload button (if no acoustic data) #33 2025-03-13 13:34:57 +01:00
brahim b84f58ca2c Resolving confilct 2025-03-13 12:23:30 +01:00
brahim 0df253d70f Resolve merge conflict by incorporating both suggestions 2025-03-13 12:05:27 +01:00
brahim 2715d225af Crash corrected if any calibration file is selected (Click Cancel) 2025-03-13 11:38:21 +01:00
11 changed files with 436 additions and 299 deletions

View File

@ -31,13 +31,13 @@ class AboutWindow(QDialog):
super().__init__() super().__init__()
self.logo_path = "./Logo" self.logo_path = "./logos"
self.logo_AcouSed = QPixmap(self.logo_path + "/" + "Logo_AcouSed_AboutAcouSedWindow.png") self.logo_AcouSed = QPixmap(self.logo_path + "/" + "AcouSed.png")
self.logo_AcouSed.scaled(16, 16, Qt.KeepAspectRatio, Qt.SmoothTransformation) self.logo_AcouSed.scaled(16, 16, Qt.KeepAspectRatio, Qt.SmoothTransformation)
self.logo_INRAE = QPixmap(self.logo_path + "/" + "BlocMarque-INRAE-Inter.jpg") self.logo_INRAE = QPixmap(self.logo_path + "/" + "BlocMarque-INRAE-Inter.jpg")
self.setGeometry(400, 200, 300, 200) self.setGeometry(400, 200, 350, 200)
self.setWindowTitle("About AcouSed") self.setWindowTitle("About AcouSed")
@ -51,7 +51,7 @@ class AboutWindow(QDialog):
self.label_logo_AcouSed = QLabel() self.label_logo_AcouSed = QLabel()
self.label_logo_AcouSed.setPixmap(self.logo_AcouSed.scaledToHeight(128, Qt.SmoothTransformation)) self.label_logo_AcouSed.setPixmap(self.logo_AcouSed.scaledToHeight(128, Qt.SmoothTransformation))
self.gridLayout.addWidget(self.label_logo_AcouSed, 0, 0, 3, 1, Qt.AlignCenter) self.gridLayout.addWidget(self.label_logo_AcouSed, 0, 0, 5, 1, Qt.AlignCenter)
self.label_acoused = QLabel() self.label_acoused = QLabel()
self.label_acoused.setText("Acoused 2.0") self.label_acoused.setText("Acoused 2.0")
@ -70,7 +70,13 @@ class AboutWindow(QDialog):
self.label_contact = QLabel() self.label_contact = QLabel()
self.label_contact.setText("Contact : celine.berni@inrae.fr \n" self.label_contact.setText("Contact : celine.berni@inrae.fr \n"
" jerome.lecoz@inrae.fr") " jerome.lecoz@inrae.fr")
self.gridLayout.addWidget(self.label_contact, 3, 1, 1, 1, Qt.AlignLeft) self.gridLayout.addWidget(self.label_contact, 3, 1, 1, 1, Qt.AlignCenter)
self.label_link = QLabel()
self.label_link.setText("< a href = https://forgemia.inra.fr/theophile.terraz/acoused > "
"https://forgemia.inra.fr/theophile.terraz/acoused </a>")
self.label_link.setOpenExternalLinks(True)
self.gridLayout.addWidget(self.label_link, 4, 1, 1, 1, Qt.AlignCenter)
# ---------------------------------------------------------- # ----------------------------------------------------------
@ -179,7 +185,7 @@ class Support(QDialog):
super().__init__() super().__init__()
self.logo_path = "./Logo" self.logo_path = "./logos"
self.logo_OSR = QPixmap(self.logo_path + '/' + "OSR.png") self.logo_OSR = QPixmap(self.logo_path + '/' + "OSR.png")
self.logo_CNR = QPixmap(self.logo_path + '/' + "CNR.png") self.logo_CNR = QPixmap(self.logo_path + '/' + "CNR.png")

View File

@ -626,17 +626,19 @@ class AcousticDataTab(QWidget):
self.delBtn.clicked.connect(self.remove_file_from_ListWidget) self.delBtn.clicked.connect(self.remove_file_from_ListWidget)
self.clearBtn.clicked.connect(self.clear_files_from_ListWidget) self.clearBtn.clicked.connect(self.clear_files_from_ListWidget)
self.fileListWidget.itemSelectionChanged.connect(self.print_selected_file) self.fileListWidget.itemSelectionChanged.connect(self.fileListWidget_event)
self.fileListWidget.itemSelectionChanged.connect(self.fill_measurements_information_groupbox)
self.fileListWidget.itemSelectionChanged.connect(self.fill_table) # self.fileListWidget.itemSelectionChanged.connect(self.print_selected_file)
self.fileListWidget.itemSelectionChanged.connect(self.compute_tmin_tmax) # self.fileListWidget.itemSelectionChanged.connect(self.fill_measurements_information_groupbox)
self.fileListWidget.itemSelectionChanged.connect(self.compute_rmin_rmax) # self.fileListWidget.itemSelectionChanged.connect(self.fill_table)
self.fileListWidget.itemSelectionChanged.connect(self.update_frequency_combobox) # self.fileListWidget.itemSelectionChanged.connect(self.compute_tmin_tmax)
# self.fileListWidget.itemSelectionChanged.connect(self.plot_backscattered_acoustic_signal_recording) # self.fileListWidget.itemSelectionChanged.connect(self.compute_rmin_rmax)
self.fileListWidget.itemSelectionChanged.connect(self.plot_profile) # self.fileListWidget.itemSelectionChanged.connect(self.update_frequency_combobox)
self.fileListWidget.itemSelectionChanged.connect(self.update_plot_backscattered_acoustic_signal_recording) # # self.fileListWidget.itemSelectionChanged.connect(self.plot_backscattered_acoustic_signal_recording)
self.fileListWidget.itemSelectionChanged.connect(self.update_plot_profile) # # self.fileListWidget.itemSelectionChanged.connect(self.plot_profile)
self.fileListWidget.itemSelectionChanged.connect(self.set_range_for_spinboxes_bathymetry) # self.fileListWidget.itemSelectionChanged.connect(self.update_plot_backscattered_acoustic_signal_recording)
# self.fileListWidget.itemSelectionChanged.connect(self.update_plot_profile)
# self.fileListWidget.itemSelectionChanged.connect(self.set_range_for_spinboxes_bathymetry)
self.combobox_ABS_name.currentIndexChanged.connect(self.fill_measurements_information_groupbox) self.combobox_ABS_name.currentIndexChanged.connect(self.fill_measurements_information_groupbox)
@ -744,6 +746,20 @@ class AcousticDataTab(QWidget):
self.groupbox_transect_2Dplot_raw_BS_data.setTitle(_translate("CONSTANT_STRING", cs.RAW_ACOUSTIC_DATA_2D_FIELD)) self.groupbox_transect_2Dplot_raw_BS_data.setTitle(_translate("CONSTANT_STRING", cs.RAW_ACOUSTIC_DATA_2D_FIELD))
def fileListWidget_event(self):
self.print_selected_file()
self.fill_measurements_information_groupbox()
self.fill_table()
self.compute_tmin_tmax()
self.compute_rmin_rmax()
self.update_frequency_combobox()
# self.fileListWidget.itemSelectionChanged.connect(self.plot_backscattered_acoustic_signal_recording)
# self.fileListWidget.itemSelectionChanged.connect(self.plot_profile)
self.update_plot_backscattered_acoustic_signal_recording()
self.update_plot_profile()
self.set_range_for_spinboxes_bathymetry()
def print_selected_file(self): def print_selected_file(self):
print(f"Selected file in list widget : {self.fileListWidget.selectedItems()}") print(f"Selected file in list widget : {self.fileListWidget.selectedItems()}")
print("self.fileListWidget.selectedItems()[1:] : ", self.fileListWidget.selectedItems()[1:]) print("self.fileListWidget.selectedItems()[1:] : ", self.fileListWidget.selectedItems()[1:])
@ -1327,8 +1343,12 @@ class AcousticDataTab(QWidget):
self.fill_measurements_information_groupbox() self.fill_measurements_information_groupbox()
self.fill_table() self.fill_table()
self.plot_backscattered_acoustic_signal_recording() self.plot_backscattered_acoustic_signal_recording()
self.plot_profile()
self.update_frequency_combobox() self.update_frequency_combobox()
self.water_attenuation() self.water_attenuation()
self.compute_tmin_tmax()
self.compute_rmin_rmax()
self.set_range_for_spinboxes_bathymetry()
stg.acoustic_data = list( stg.acoustic_data = list(
range( range(
@ -1361,26 +1381,39 @@ class AcousticDataTab(QWidget):
del current_item del current_item
# --- Clear variables --- # --- Clear variables ---
list_to_pop1 = ["stg.acoustic_data", "stg.date", "stg.hour", "stg.freq", "stg.freq_text", "stg.temperature", list_to_pop1 = [
"stg.nb_profiles", "stg.nb_profiles_per_sec", "stg.nb_cells", "stg.cell_size", "stg.acoustic_data", "stg.date", "stg.hour",
"stg.pulse_length", "stg.nb_pings_per_sec", "stg.nb_pings_averaged_per_profile", "stg.freq", "stg.freq_text",
"stg.kt_read", "stg.kt_corrected", "stg.gain_rx", "stg.gain_tx", "stg.nb_profiles", "stg.nb_profiles_per_sec",
"stg.filename_BS_raw_data", "stg.path_BS_raw_data", "stg.nb_cells", "stg.cell_size",
"stg.BS_raw_data", "stg.time", "stg.depth", "stg.pulse_length", "stg.nb_pings_per_sec",
"stg.BS_raw_data_reshape", "stg.time_reshape", "stg.depth_reshape"] "stg.nb_pings_averaged_per_profile",
"stg.kt_read", "stg.kt_corrected", "stg.gain_rx", "stg.gain_tx",
"stg.filename_BS_raw_data", "stg.path_BS_raw_data",
"stg.BS_raw_data", "stg.time", "stg.depth",
"stg.BS_raw_data_reshape", "stg.time_reshape", "stg.depth_reshape"
]
for p in list_to_pop1: for p in list_to_pop1:
if isinstance(p, list): if isinstance(eval(p), list):
exec(p + ".pop(current_row)") exec(p + ".pop(current_row)")
if stg.BS_cross_section: if stg.BS_cross_section:
list_to_pop2 = ["stg.rmin", "stg.rmax", "stg.tmin", "stg.tmax", list_to_pop2 = ["stg.rmin", "stg.rmax", "stg.tmin", "stg.tmax",
"stg.time_cross_section", "stg.BS_cross_section"] "stg.time_cross_section", "stg.depth_cross_section", "stg.BS_cross_section"]
for k in list_to_pop2: for k in list_to_pop2:
exec(k + ".pop(current_row)") exec(k + ".pop(current_row)")
if stg.BS_stream_bed:
list_to_pop3 = ["stg.BS_stream_bed", "stg.depth_bottom",
"stg.val_bottom", "stg.ind_bottom", "stg.freq_bottom_detection"]
for s in list_to_pop3:
exec(s + ".pop(current_row)")
if self.fileListWidget.count() == 0: if self.fileListWidget.count() == 0:
# --- Clear measurements information --- # --- Clear measurements information ---
@ -1459,24 +1492,26 @@ class AcousticDataTab(QWidget):
list_to_clear = [ list_to_clear = [
"stg.acoustic_data", "stg.date", "stg.hour", "stg.acoustic_data", "stg.date", "stg.hour",
"stg.freq", "stg.freq_text", "stg.temperature", "stg.freq", "stg.freq_text",
"stg.nb_profiles", "stg.nb_profiles_per_sec", "stg.nb_profiles", "stg.nb_profiles_per_sec",
"stg.nb_cells", "stg.cell_size", "stg.nb_cells", "stg.cell_size",
"stg.pulse_length", "stg.nb_pings_per_sec", "stg.pulse_length", "stg.nb_pings_per_sec",
"stg.nb_pings_averaged_per_profile", "stg.nb_pings_averaged_per_profile",
"stg.kt_read", "stg.kt_corrected", "stg.gain_rx", "stg.gain_tx", "stg.kt_read", "stg.kt_corrected", "stg.gain_rx", "stg.gain_tx",
"stg.filename_BS_raw_data", "stg.path_BS_raw_data",
"stg.BS_raw_data", "stg.time", "stg.depth", "stg.BS_raw_data", "stg.time", "stg.depth",
"stg.BS_raw_data_reshape", "stg.time_reshape", "stg.depth_reshape", "stg.BS_raw_data_reshape", "stg.time_reshape", "stg.depth_reshape",
"stg.rmin", "stg.rmax", "stg.tmin", "stg.tmax", "stg.rmin", "stg.rmax", "stg.tmin", "stg.tmax",
"stg.time_cross_section", "stg.depth_cross_section", "stg.time_cross_section", "stg.depth_cross_section",
"stg.BS_cross_section" "stg.BS_cross_section", "stg.BS_stream_bed"
] ]
for k in list_to_clear: for k in list_to_clear:
if isinstance(k, list): if isinstance(eval(k), list):
exec(k + ".clear()") exec(k + ".clear()")
self.fileListWidget.clear() self.fileListWidget.clear()
# self.fileListWidget.takeItem(0)
if self.fileListWidget.count() == 0: if self.fileListWidget.count() == 0:
# --- Clear measurmeents information --- # --- Clear measurmeents information ---
@ -1683,9 +1718,13 @@ class AcousticDataTab(QWidget):
self.fill_measurements_information_groupbox_kt() self.fill_measurements_information_groupbox_kt()
def fill_measurements_information_groupbox_datetime(self): def fill_measurements_information_groupbox_datetime(self):
file_id = self.fileListWidget.currentRow()
print("file_id ", file_id)
print("stg.date ", stg.date)
self.label_date_acoustic_file.clear() self.label_date_acoustic_file.clear()
self.label_date_acoustic_file.setText( self.label_date_acoustic_file.setText(
"Date: " + str(stg.date[self.fileListWidget.currentRow()]) "Date: " + str(stg.date[file_id])
) )
self.gridLayout_groupbox_info.addWidget( self.gridLayout_groupbox_info.addWidget(
self.label_date_acoustic_file, self.label_date_acoustic_file,
@ -1695,7 +1734,7 @@ class AcousticDataTab(QWidget):
self.label_hour_acoustic_file.clear() self.label_hour_acoustic_file.clear()
self.label_hour_acoustic_file.setText( self.label_hour_acoustic_file.setText(
"Hour: " + str(stg.hour[self.fileListWidget.currentRow()]) "Hour: " + str(stg.hour[file_id])
) )
self.gridLayout_groupbox_info.addWidget( self.gridLayout_groupbox_info.addWidget(
self.label_hour_acoustic_file, self.label_hour_acoustic_file,
@ -2012,7 +2051,8 @@ class AcousticDataTab(QWidget):
) )
def fill_table(self): def fill_table(self):
if self.fileListWidget.currentRow() != -1: # if self.fileListWidget.currentRow() != -1:
if self.fileListWidget.selectedItems() != []:
file_id = self.fileListWidget.currentRow() file_id = self.fileListWidget.currentRow()
header_list = [] header_list = []

View File

@ -39,6 +39,7 @@ from View.about_window import AboutWindow
import settings as stg import settings as stg
import numpy as np import numpy as np
import pandas as pd
from subprocess import Popen from subprocess import Popen
import time import time
@ -325,23 +326,21 @@ class Ui_MainWindow(object):
self.open_doc_file('Tutorial_AQUAscat_software.pdf') self.open_doc_file('Tutorial_AQUAscat_software.pdf')
def export_table_of_acoustic_BS_values_to_excel_or_libreOfficeCalc_file(self): def export_table_of_acoustic_BS_values_to_excel_or_libreOfficeCalc_file(self):
if len(stg.BS_raw_data_reshape) != 0: if len(stg.BS_raw_data_reshape) != 0:
name = QtWidgets.QFileDialog.getExistingDirectory(
# --- Open file dialog to select the directory --- caption="Select Directory - Acoustic BS raw data Table"
)
name = QtWidgets.QFileDialog.getExistingDirectory(caption="Select Directory - Acoustic BS raw data Table")
print("name table to save ", name) print("name table to save ", name)
# --- Save the raw acoustic backscatter data from a Dataframe to csv file --- # --- Save the raw acoustic backscatter data from a
# --- Dataframe to csv file ---
t0 = time.time() t0 = time.time()
print("len(stg.BS_raw_data_reshape) ", len(stg.BS_raw_data_reshape)) print("len(stg.BS_raw_data_reshape) ",
len(stg.BS_raw_data_reshape))
if name: if name:
for i in range(len(stg.BS_raw_data_reshape)): for i in range(len(stg.BS_raw_data_reshape)):
header_list = [] header_list = []
header_list.clear() header_list.clear()
table_data = np.array([[]]) table_data = np.array([[]])
@ -351,27 +350,42 @@ class Ui_MainWindow(object):
header_list.append("BS - " + freq_value) header_list.append("BS - " + freq_value)
if freq_ind == 0: if freq_ind == 0:
table_data = np.vstack((np.vstack((stg.time_reshape[i][:, freq_ind], table_data = np.vstack(
stg.depth_reshape[i][:, freq_ind])), (
stg.BS_raw_data_reshape[i][:, freq_ind])) np.vstack(
(stg.time_reshape[i][:, freq_ind],
stg.depth_reshape[i][:, freq_ind])),
stg.BS_raw_data_reshape[i][:, freq_ind]
)
)
else: else:
table_data = np.vstack((table_data, table_data = np.vstack(
np.vstack((np.vstack( (
(stg.time_reshape[i][:, freq_ind], table_data,
stg.depth_reshape[i][:, freq_ind])), np.vstack((
stg.BS_raw_data_reshape[i][:, freq_ind])) np.vstack((
)) stg.time_reshape[i][:, freq_ind],
stg.depth_reshape[i][:, freq_ind]
)),
stg.BS_raw_data_reshape[i][:, freq_ind]
))
)
)
exec("DataFrame_acoustic_" + str(i) + "= pd.DataFrame(None)") DataFrame_acoustic = pd.DataFrame(None)
exec("DataFrame_acoustic_" + str(i) + "= pd.DataFrame(data=table_data.transpose(), columns=header_list)") DataFrame_acoustic = pd.DataFrame(
data=table_data.transpose(), columns=header_list
)
exec("DataFrame_acoustic_" + str(i) + ".to_csv(" + DataFrame_acoustic.to_csv(
"path_or_buf=" + path_or_buf=os.path.join(
"'" + name + "/" + "Table_" + name,
str(stg.filename_BS_raw_data[i][:-4]) + ".csv'" + ", " + f"Table_{str(stg.filename_BS_raw_data[i][:-4])}.csv"
"sep=" + "',' " + ", " + ),
"header=DataFrame_acoustic_" + str(i) + ".columns" + ")") header=DataFrame_acoustic.columns,
sep=',',
)
t1 = time.time() - t0 t1 = time.time() - t0
print("time duration export BS ", t1) print("time duration export BS ", t1)

View File

@ -1716,32 +1716,47 @@ class SedimentCalibrationTab(QWidget):
self.animaiton_groupbox_compute.start() self.animaiton_groupbox_compute.start()
def import_calibration_file(self): def import_calibration_file(self):
filename = QFileDialog.getOpenFileName(
self, "Open calibration",
[
stg.path_calibration_file
if stg.path_calibration_file
else stg.path_BS_raw_data[-1]
if self.combobox_acoustic_data_choice.count() > 0
else ""
][0],
"Calibration file (*.xls, *.ods, *csv)",
options=QFileDialog.DontUseNativeDialog
)
dir_name = os.path.dirname(filename[0]) if self.combobox_acoustic_data_choice.count() == 0:
name = os.path.basename(filename[0]) msgBox = QMessageBox()
msgBox.setWindowTitle("Calibration import error")
msgBox.setIconPixmap(
QPixmap(
self._path_icon("no_approved.png")
).scaledToHeight(32, Qt.SmoothTransformation)
)
msgBox.setText("Update data before importing calibration")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
stg.path_calibration_file = dir_name else:
stg.filename_calibration_file = name
self.lineEdit_import_calibration.clear() filename = QFileDialog.getOpenFileName(
self.lineEdit_import_calibration.setText(name) self, "Open calibration",
[
stg.path_calibration_file
if stg.path_calibration_file
else stg.path_BS_raw_data[-1]
if self.combobox_acoustic_data_choice.count() > 0
else ""
][0],
"Calibration file (*.xls, *.ods, *csv)",
options=QFileDialog.DontUseNativeDialog
)
self.lineEdit_import_calibration.setToolTip(dir_name) dir_name = os.path.dirname(filename[0])
name = os.path.basename(filename[0])
self.compute_depth_2D() stg.path_calibration_file = dir_name
self.read_calibration_file_and_fill_parameter() stg.filename_calibration_file = name
self.lineEdit_import_calibration.clear()
self.lineEdit_import_calibration.setText(name)
self.lineEdit_import_calibration.setToolTip(dir_name)
self.compute_depth_2D()
self.read_calibration_file_and_fill_parameter()
def update_label_freq1_for_calibration(self): def update_label_freq1_for_calibration(self):
self.label_freq1.clear() self.label_freq1.clear()
@ -1784,26 +1799,14 @@ class SedimentCalibrationTab(QWidget):
) )
def read_calibration_file_and_fill_parameter(self): def read_calibration_file_and_fill_parameter(self):
if self.combobox_acoustic_data_choice.count() == 0:
msgBox = QMessageBox() if stg.filename_calibration_file == "":
msgBox.setWindowTitle("Calibration import error")
msgBox.setIconPixmap( pass
QPixmap(
self._path_icon("no_approved.png")
).scaledToHeight(32, Qt.SmoothTransformation)
)
msgBox.setText("Update data before importing calibration")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
else: else:
# --- Read calibration file --- # --- Read calibration file ---
data = pd.read_csv( data = pd.read_csv(os.path.join(stg.path_calibration_file, stg.filename_calibration_file), header=0, index_col=0)
os.path.join(
stg.path_calibration_file,
stg.filename_calibration_file
),
header=0, index_col=0
)
# --- Fill spinboxes of calibration parameter --- # --- Fill spinboxes of calibration parameter ---
self.label_temperature.clear() self.label_temperature.clear()
@ -1997,17 +2000,31 @@ class SedimentCalibrationTab(QWidget):
def function_pushbutton_compute_calibration(self): def function_pushbutton_compute_calibration(self):
self.label_temperature.clear() if self.combobox_acoustic_data_choice.count() == 0:
self.label_temperature.setText("T = " + str(stg.temperature) + " °C") msgBox = QMessageBox()
msgBox.setWindowTitle("Calibration computation error")
msgBox.setIconPixmap(
QPixmap(
self._path_icon("no_approved.png")
).scaledToHeight(32, Qt.SmoothTransformation)
)
msgBox.setText("Update data before importing calibration")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
self.compute_depth_2D() else:
self.compute_ks()
self.compute_sv() self.label_temperature.clear()
self.compute_X() self.label_temperature.setText("T = " + str(stg.temperature) + " °C")
self.compute_kt2D_kt3D()
self.compute_J_cross_section() self.compute_depth_2D()
self.compute_alpha_s() self.compute_ks()
self.compute_zeta() self.compute_sv()
self.compute_X()
self.compute_kt2D_kt3D()
self.compute_J_cross_section()
self.compute_alpha_s()
self.compute_zeta()
def compute_ks(self): def compute_ks(self):
data_id = self.combobox_acoustic_data_choice.currentIndex() data_id = self.combobox_acoustic_data_choice.currentIndex()
@ -2059,11 +2076,11 @@ class SedimentCalibrationTab(QWidget):
stg.sv = [sv_freq1, sv_freq2] stg.sv = [sv_freq1, sv_freq2]
print( logger.debug(
f"sv for frequency of {stg.freq[data_id][self.combobox_freq1.currentIndex()]}" f"sv for frequency of {stg.freq[data_id][self.combobox_freq1.currentIndex()]}"
+ f" : {sv_freq1:.8f} /m \n" + f" : {sv_freq1:.8f} /m \n"
) )
print( logger.debug(
f"sv for frequency of {stg.freq[data_id][self.combobox_freq2.currentIndex()]}" f"sv for frequency of {stg.freq[data_id][self.combobox_freq2.currentIndex()]}"
+ f" : {sv_freq2:.8f} /m" + f" : {sv_freq2:.8f} /m"
) )
@ -2086,7 +2103,7 @@ class SedimentCalibrationTab(QWidget):
stg.X_exponent.clear() stg.X_exponent.clear()
stg.X_exponent.append(X_exponent) stg.X_exponent.append(X_exponent)
print(f"Exponent X = {X_exponent:.2f}\n") logger.debug(f"Exponent X = {X_exponent:.2f}\n")
self.lineEdit_X.setText(str("%.2f" % X_exponent)) self.lineEdit_X.setText(str("%.2f" % X_exponent))
@ -2137,6 +2154,7 @@ class SedimentCalibrationTab(QWidget):
] ]
for i in range(self.combobox_acoustic_data_choice.count()): for i in range(self.combobox_acoustic_data_choice.count()):
J_cross_section_freq1 = np.array([]) J_cross_section_freq1 = np.array([])
J_cross_section_freq2 = np.array([]) J_cross_section_freq2 = np.array([])
@ -2210,8 +2228,8 @@ class SedimentCalibrationTab(QWidget):
stg.alpha_s = [alpha_s_freq1, alpha_s_freq2] stg.alpha_s = [alpha_s_freq1, alpha_s_freq2]
print(f"\u03B1s for frequency of freq1 : {alpha_s_freq1:.2f} /m \n") logger.debug(f"\u03B1s for frequency of freq1 : {alpha_s_freq1:.2f} /m \n")
print(f"\u03B1s for frequency of freq2 : {alpha_s_freq2:.2f} /m") logger.debug(f"\u03B1s for frequency of freq2 : {alpha_s_freq2:.2f} /m")
self.lineEdit_alphas_freq1.clear() self.lineEdit_alphas_freq1.clear()
self.lineEdit_alphas_freq1.setText(str("%.5f" % alpha_s_freq1)) self.lineEdit_alphas_freq1.setText(str("%.5f" % alpha_s_freq1))
@ -2220,25 +2238,19 @@ class SedimentCalibrationTab(QWidget):
self.lineEdit_alphas_freq2.setText(str("%.5f" % alpha_s_freq2)) self.lineEdit_alphas_freq2.setText(str("%.5f" % alpha_s_freq2))
if (alpha_s_freq1 < 0) or (alpha_s_freq2 < 0): if (alpha_s_freq1 < 0) or (alpha_s_freq2 < 0):
msgBox = QMessageBox() msgBox = QMessageBox()
msgBox.setWindowTitle("Alpha computation error") msgBox.setWindowTitle("Alpha computation error")
msgBox.setIconPixmap( msgBox.setIconPixmap(QPixmap(self._path_icon("no_approved.png")).scaledToHeight(32, Qt.SmoothTransformation))
QPixmap(
self._path_icon("no_approved.png")
).scaledToHeight(32, Qt.SmoothTransformation)
)
msgBox.setText("Sediment sound attenuation is negative !") msgBox.setText("Sediment sound attenuation is negative !")
msgBox.setStandardButtons(QMessageBox.Ok) msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec() msgBox.exec()
else: else:
msgBox = QMessageBox() msgBox = QMessageBox()
msgBox.setWindowTitle("Alpha computation validation") msgBox.setWindowTitle("Alpha computation validation")
msgBox.setIconPixmap( msgBox.setIconPixmap(QPixmap(self._path_icon("approved.png")).scaledToHeight(32, Qt.SmoothTransformation))
QPixmap(
self._path_icon("approved.png")
).scaledToHeight(32, Qt.SmoothTransformation)
)
msgBox.setText("Sediment sound attenuation is positive.") msgBox.setText("Sediment sound attenuation is positive.")
msgBox.setStandardButtons(QMessageBox.Ok) msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec() msgBox.exec()
@ -2280,8 +2292,8 @@ class SedimentCalibrationTab(QWidget):
stg.zeta = [zeta_freq1, zeta_freq2] stg.zeta = [zeta_freq1, zeta_freq2]
print(f"\u03B6 for frequency of freq1 : {zeta_freq1:.3f} /m \n") logger.debug(f"\u03B6 for frequency of freq1 : {zeta_freq1:.3f} /m \n")
print(f"\u03B6 for frequency of freq2 : {zeta_freq2:.3f} /m") logger.debug(f"\u03B6 for frequency of freq2 : {zeta_freq2:.3f} /m")
self.lineEdit_zeta_freq1.clear() self.lineEdit_zeta_freq1.clear()
self.lineEdit_zeta_freq1.setText(str("%.5f" % zeta_freq1)) self.lineEdit_zeta_freq1.setText(str("%.5f" % zeta_freq1))
@ -2739,3 +2751,4 @@ class SedimentCalibrationTab(QWidget):
self.lineEdit_slider_FCB.setText( self.lineEdit_slider_FCB.setText(
str(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ str(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex(), self.slider_FCB.value()-1])) self.combobox_frequency_FCB.currentIndex(), self.slider_FCB.value()-1]))

View File

@ -447,8 +447,8 @@ class SignalProcessingTab(QWidget):
# -------------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------------
self.pushbutton_update.clicked.connect(self.update_SignalPreprocessingTab) self.pushbutton_update.clicked.connect(self.update_SignalPreprocessingTab)
self.pushbutton_update.clicked.connect(self.compute_average_profile_tail) # self.pushbutton_update.clicked.connect(self.compute_average_profile_tail)
self.pushbutton_update.clicked.connect(self.plot_averaged_profile_tail) # self.pushbutton_update.clicked.connect(self.plot_averaged_profile_tail)
self.combobox_acoustic_data_choice.currentIndexChanged.connect(self.combobox_acoustic_data_choice_change_index) self.combobox_acoustic_data_choice.currentIndexChanged.connect(self.combobox_acoustic_data_choice_change_index)
@ -501,26 +501,39 @@ class SignalProcessingTab(QWidget):
- the user remove a file (in the list widget) in the first tab (Acoustic data), so that the combobox - the user remove a file (in the list widget) in the first tab (Acoustic data), so that the combobox
of data to be processed is updated, of data to be processed is updated,
- the user change the limits of one or all the records in the first tab (Acoustic data) """ - 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:
self.combobox_acoustic_data_choice.clear() msgBox = QMessageBox()
self.combobox_acoustic_data_choice.addItems(stg.filename_BS_raw_data) 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()
if stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 0: else:
self.groupbox_download_noise_file.setChecked(True) self.combobox_acoustic_data_choice.clear()
self.groupbox_compute_noise_from_profile_tail.setChecked(False) self.combobox_acoustic_data_choice.addItems(stg.filename_BS_raw_data)
self.groupbox_download_noise_file_toggle()
elif stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 1: if stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 0:
self.groupbox_download_noise_file.setChecked(False) self.groupbox_download_noise_file.setChecked(True)
self.groupbox_compute_noise_from_profile_tail.setChecked(True) self.groupbox_compute_noise_from_profile_tail.setChecked(False)
self.groupbox_option_profile_tail_toggle() self.groupbox_download_noise_file_toggle()
self.combobox_freq_noise_from_profile_tail.clear() elif stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 1:
self.combobox_freq_noise_from_profile_tail.addItems(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()])
self.combobox_acoustic_data_choice.currentIndexChanged.connect(self.combobox_acoustic_data_choice_change_index) self.groupbox_download_noise_file.setChecked(False)
self.groupbox_compute_noise_from_profile_tail.setChecked(True)
self.groupbox_option_profile_tail_toggle()
self.combobox_freq_noise_from_profile_tail.clear()
self.combobox_freq_noise_from_profile_tail.addItems(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()])
self.combobox_acoustic_data_choice.currentIndexChanged.connect(self.combobox_acoustic_data_choice_change_index)
self.compute_average_profile_tail()
self.plot_averaged_profile_tail()
def activate_list_of_pre_processed_data(self): def activate_list_of_pre_processed_data(self):
for i in range(self.combobox_acoustic_data_choice.count()): for i in range(self.combobox_acoustic_data_choice.count()):
@ -654,45 +667,65 @@ class SignalProcessingTab(QWidget):
# --- Plot averaged signal --- # --- 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') elif self.combobox_acoustic_data_choice.count() == 0:
self.canvas_profile_tail = FigureCanvas(self.fig_profile_tail)
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( else:
-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') if stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
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() 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()
# ------------------------------------------------------ # ------------------------------------------------------
@ -722,82 +755,87 @@ class SignalProcessingTab(QWidget):
def clear_noise_data(self): def clear_noise_data(self):
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) if len(stg.filename_BS_raw_data) == 0:
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.time_noise[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] = 0
stg.SNR_filter_value[self.combobox_acoustic_data_choice.currentIndex()] = 0
stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) pass
stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) else:
stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([]) stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.time_noise[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_filter_value[self.combobox_acoustic_data_choice.currentIndex()] = 0
if stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 0: stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
self.lineEdit_noise_file.clear() stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
elif stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 1: stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
self.lineEdit_val1.clear() stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
self.lineEdit_val1.setText("0.00")
self.lineEdit_val2.clear() stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
self.lineEdit_val2.setText("0.00") stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
print("stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()]", stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()])
if stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 0:
self.lineEdit_noise_file.clear()
self.lineEdit_profile_tail_value.clear() elif stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 1:
self.lineEdit_profile_tail_value.setText("0.0000") self.lineEdit_val1.clear()
self.lineEdit_val1.setText("0.00")
self.verticalLayout_groupbox_plot_profile_tail.removeWidget(self.canvas_profile_tail) self.lineEdit_val2.clear()
self.canvas_profile_tail = FigureCanvas() self.lineEdit_val2.setText("0.00")
self.verticalLayout_groupbox_plot_profile_tail.addWidget(self.canvas_profile_tail)
self.lineEdit_SNR_criterion.setText("0.00") self.lineEdit_profile_tail_value.clear()
self.lineEdit_horizontal_average.setText("0.00") self.lineEdit_profile_tail_value.setText("0.0000")
# --- Clear SNR plot --- self.verticalLayout_groupbox_plot_profile_tail.removeWidget(self.canvas_profile_tail)
self.verticalLayout_groupbox_plot_SNR.removeWidget(self.toolbar_SNR) self.canvas_profile_tail = FigureCanvas()
self.verticalLayout_groupbox_plot_SNR.removeWidget(self.scroll_SNR) self.verticalLayout_groupbox_plot_profile_tail.addWidget(self.canvas_profile_tail)
self.canvas_SNR = FigureCanvas() self.lineEdit_SNR_criterion.setText("0.00")
self.toolbar_SNR = NavigationToolBar(self.canvas_SNR, self) self.lineEdit_horizontal_average.setText("0.00")
self.scroll_SNR.setWidget(self.canvas_SNR)
self.verticalLayout_groupbox_plot_SNR.addWidget(self.toolbar_SNR) # --- Clear SNR plot ---
self.verticalLayout_groupbox_plot_SNR.addWidget(self.scroll_SNR) self.verticalLayout_groupbox_plot_SNR.removeWidget(self.toolbar_SNR)
self.verticalLayout_groupbox_plot_SNR.removeWidget(self.scroll_SNR)
# --- Clear BS plot --- self.canvas_SNR = FigureCanvas()
self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.removeWidget(self.toolbar_BS) self.toolbar_SNR = NavigationToolBar(self.canvas_SNR, self)
self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.removeWidget(self.scroll_BS) self.scroll_SNR.setWidget(self.canvas_SNR)
self.canvas_BS = FigureCanvas() self.verticalLayout_groupbox_plot_SNR.addWidget(self.toolbar_SNR)
self.toolbar_BS = NavigationToolBar(self.canvas_BS, self) self.verticalLayout_groupbox_plot_SNR.addWidget(self.scroll_SNR)
self.scroll_BS.setWidget(self.canvas_BS)
self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.addWidget(self.toolbar_BS) # --- Clear BS plot ---
self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.addWidget(self.scroll_BS) self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.removeWidget(self.toolbar_BS)
self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.removeWidget(self.scroll_BS)
self.combobox_frequency_profile.clear() self.canvas_BS = FigureCanvas()
self.toolbar_BS = NavigationToolBar(self.canvas_BS, self)
self.scroll_BS.setWidget(self.canvas_BS)
self.verticalLayout_groupbox_plot_profile.removeWidget(self.toolbar_profile) self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.addWidget(self.toolbar_BS)
self.verticalLayout_groupbox_plot_profile.removeWidget(self.canvas_profile) self.verticalLayout_groupbox_plot_pre_processed_data_2D_field.addWidget(self.scroll_BS)
self.canvas_profile = FigureCanvas() self.combobox_frequency_profile.clear()
self.toolbar_profile = NavigationToolBar(self.canvas_profile, self)
self.verticalLayout_groupbox_plot_profile.addWidget(self.toolbar_profile) self.verticalLayout_groupbox_plot_profile.removeWidget(self.toolbar_profile)
self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_profile) self.verticalLayout_groupbox_plot_profile.removeWidget(self.canvas_profile)
self.slider.setValue(1) self.canvas_profile = FigureCanvas()
self.slider.setMaximum(10) self.toolbar_profile = NavigationToolBar(self.canvas_profile, self)
self.slider.setValue(0) self.verticalLayout_groupbox_plot_profile.addWidget(self.toolbar_profile)
self.slider.setMaximum(10) self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_profile)
self.slider.setValue(1)
self.slider.setMaximum(10)
self.slider.setValue(0)
self.slider.setMaximum(10)
def open_dialog_box(self): def open_dialog_box(self):
@ -1221,11 +1259,19 @@ class SignalProcessingTab(QWidget):
def remove_point_with_snr_filter(self): def remove_point_with_snr_filter(self):
if len(stg.BS_noise_raw_data) == 0: if len(stg.filename_BS_raw_data) == 0:
msgBox = QMessageBox()
msgBox.setWindowTitle("Compute noise from profile tail error")
msgBox.setIcon(QMessageBox.Warning)
msgBox.setText("Download acoustic data in previous tab before applying SNR filter")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
elif len(stg.BS_noise_raw_data) == 0:
msgBox = QMessageBox() msgBox = QMessageBox()
msgBox.setWindowTitle("SNR filter Error") msgBox.setWindowTitle("SNR filter Error")
msgBox.setIcon(QMessageBox.Warning) msgBox.setIcon(QMessageBox.Warning)
msgBox.setText("Load Noise data from acoustic data tab before using SNR filter") msgBox.setText("Define noise data (file or profile tail) before using SNR filter")
msgBox.setStandardButtons(QMessageBox.Ok) msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec() msgBox.exec()
@ -1504,105 +1550,123 @@ class SignalProcessingTab(QWidget):
def compute_averaged_BS_data(self): def compute_averaged_BS_data(self):
kernel_avg = np.ones(2 * int(float(self.lineEdit_horizontal_average.text().replace(",", "."))) + 1) if len(stg.filename_BS_raw_data) == 0:
print(kernel_avg) msgBox = QMessageBox()
msgBox.setWindowTitle("Compute noise from profile tail error")
msgBox.setIcon(QMessageBox.Warning)
msgBox.setText("Download acoustic data in previous tab before applying SNR filter")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
stg.Nb_cells_to_average_BS_signal[self.combobox_acoustic_data_choice.currentIndex()] = ( elif len(stg.BS_noise_raw_data) == 0:
float(self.lineEdit_horizontal_average.text().replace(",", "."))) msgBox = QMessageBox()
msgBox.setWindowTitle("SNR filter Error")
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): msgBox.setIcon(QMessageBox.Warning)
msgBox.setText("Define noise data (file or profile tail) before using SNR filter")
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
x_time = stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()]
y_depth = stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()]
elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
x_time = stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()]
y_depth = stg.depth[self.combobox_acoustic_data_choice.currentIndex()]
else: else:
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): kernel_avg = np.ones(2 * int(float(self.lineEdit_horizontal_average.text().replace(",", "."))) + 1)
print(kernel_avg)
x_time = stg.time[self.combobox_acoustic_data_choice.currentIndex()] stg.Nb_cells_to_average_BS_signal[self.combobox_acoustic_data_choice.currentIndex()] = (
y_depth = stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()] float(self.lineEdit_horizontal_average.text().replace(",", ".")))
elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
x_time = stg.time[self.combobox_acoustic_data_choice.currentIndex()] if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
y_depth = stg.depth[self.combobox_acoustic_data_choice.currentIndex()]
if stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].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()]
stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()]))
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): x_time = stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()]
for i in range(y_depth.shape[1]): y_depth = stg.depth[self.combobox_acoustic_data_choice.currentIndex()]
stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( else:
convolve(stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, i, :],
kernel_avg))
elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( x_time = stg.time[self.combobox_acoustic_data_choice.currentIndex()]
stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()])) y_depth = stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()]
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
for i in range(y_depth.shape[1]):
stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( x_time = stg.time[self.combobox_acoustic_data_choice.currentIndex()]
convolve(stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, i, :], y_depth = stg.depth[self.combobox_acoustic_data_choice.currentIndex()]
kernel_avg))
elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): if stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( stg.BS_stream_bed_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_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()]))
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]):
for i in range(y_depth.shape[1]): for i in range(y_depth.shape[1]):
stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = ( stg.BS_stream_bed_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, :], convolve(stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, i, :],
kernel_avg)) kernel_avg))
elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy(
stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()])) stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()]))
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]):
for i in range(y_depth.shape[1]): 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))
elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): 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, :],
kernel_avg))
stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()]))
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy(
for i in range(y_depth.shape[1]): stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()]))
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, :],
kernel_avg))
elif stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]):
for i in range(y_depth.shape[1]):
stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy( stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][f, i, :] = (
stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()])) convolve(stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][f, i, :],
kernel_avg))
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
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))
self.plot_pre_processed_BS_signal() stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = (deepcopy(
self.update_plot_pre_processed_profile() stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()]))
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]):
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))
elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].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()]))
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]):
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, :],
kernel_avg))
elif stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].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()]))
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]):
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))
self.plot_pre_processed_BS_signal()
self.update_plot_pre_processed_profile()
def plot_pre_processed_profile(self): def plot_pre_processed_profile(self):

BIN
logos/AcouSed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
logos/CNR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
logos/EDF.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
logos/OSR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
logos/Ubertone.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB