mirror of
https://forgemia.inra.fr/theophile.terraz/acoused.git
synced 2026-10-30 03:10:40 +01:00
Merge branch 'dev-parouby' into dev
This commit is contained in:
commit
d7ea9cc4f7
11 files changed
+867
-642
No files matched your search
+58
-21
@@ -733,8 +733,32 @@ class AcousticDataTab(QWidget):
|
||||
|
||||
# -------------------- Functions for Acoustic dataTab --------------------
|
||||
|
||||
def retranslate_acoustic_data_tab(self):
|
||||
def full_update(self):
|
||||
logger.debug(f"{__name__}: Update")
|
||||
self.blockSignals(True)
|
||||
self.fileListWidget.blockSignals(True)
|
||||
self.combobox_ABS_system_choice.blockSignals(True)
|
||||
|
||||
self.combobox_ABS_system_choice.setCurrentText(stg.ABS_name[0])
|
||||
self.ABS_system_choice()
|
||||
|
||||
self.fileListWidget.addFilenames(stg.filename_BS_raw_data)
|
||||
|
||||
self.fill_measurements_information_groupbox()
|
||||
self.fill_table()
|
||||
self.plot_backscattered_acoustic_signal_recording()
|
||||
self.plot_profile()
|
||||
self.update_frequency_combobox()
|
||||
self.water_attenuation()
|
||||
self.compute_tmin_tmax()
|
||||
self.compute_rmin_rmax()
|
||||
self.set_range_for_spinboxes_bathymetry()
|
||||
|
||||
self.combobox_ABS_system_choice.blockSignals(False)
|
||||
self.fileListWidget.blockSignals(False)
|
||||
self.blockSignals(False)
|
||||
|
||||
def retranslate_acoustic_data_tab(self):
|
||||
self.groupbox_info.setTitle(_translate("CONSTANT_STRING", cs.MEASUREMENTS_INFORMATION))
|
||||
|
||||
self.label_date_acoustic_file.setText(_translate("CONSTANT_STRING", cs.DATE) + ":")
|
||||
@@ -953,7 +977,7 @@ class AcousticDataTab(QWidget):
|
||||
self.gridLayout_groupbox_info.addWidget(self.lineEdit_temperature, 3, 1, 1, 1, Qt.AlignLeft)
|
||||
self.label_temperature_unit.show()
|
||||
self.gridLayout_groupbox_info.addWidget(self.label_temperature_unit, 3, 2, 1, 1, Qt.AlignLeft)
|
||||
self.temperature_value()
|
||||
self.setup_temperature_value()
|
||||
|
||||
self.label_speed_of_sound.show()
|
||||
self.gridLayout_groupbox_info.addWidget(self.label_speed_of_sound, 4, 0, 1, 1, Qt.AlignLeft)
|
||||
@@ -1216,25 +1240,31 @@ class AcousticDataTab(QWidget):
|
||||
|
||||
self.pushbutton_distance_from_ABS_to_free_surface.blockSignals(False)
|
||||
|
||||
def temperature_value(self):
|
||||
def setup_temperature_value(self):
|
||||
self.water_velocity()
|
||||
self.water_attenuation()
|
||||
|
||||
def temperature_value(self):
|
||||
if findall(r",", self.lineEdit_temperature.text()):
|
||||
stg.temperature = float(self.lineEdit_temperature.text().replace(',', '.'))
|
||||
self.lineEdit_temperature.setText(self.lineEdit_temperature.text().replace(',', '.'))
|
||||
else:
|
||||
stg.temperature = float(self.lineEdit_temperature.text())
|
||||
self.lineEdit_temperature.setText(self.lineEdit_temperature.text())
|
||||
|
||||
self.water_velocity()
|
||||
self.water_attenuation()
|
||||
|
||||
def water_velocity(self):
|
||||
"""Computing sond speed from Bilaniuk and Wong 1993"""
|
||||
temp = float(self.lineEdit_temperature.text())
|
||||
|
||||
C = (1.40238744 * 1e3 +
|
||||
5.03836171 * float(self.lineEdit_temperature.text()) -
|
||||
5.81172916 * 1e-2 * float(self.lineEdit_temperature.text()) ** 2 +
|
||||
3.34638117 * 1e-4 * float(self.lineEdit_temperature.text()) ** 3 -
|
||||
1.48259672 * 1e-6 * float(self.lineEdit_temperature.text()) ** 4 +
|
||||
3.16585020 * 1e-9 * float(self.lineEdit_temperature.text()) ** 5)
|
||||
5.03836171 * temp -
|
||||
5.81172916 * 1e-2 * temp ** 2 +
|
||||
3.34638117 * 1e-4 * temp ** 3 -
|
||||
1.48259672 * 1e-6 * temp ** 4 +
|
||||
3.16585020 * 1e-9 * temp ** 5)
|
||||
stg.water_velocity = C
|
||||
|
||||
self.lineEdit_speed_of_sound.setText(str(round(stg.water_velocity, 2)))
|
||||
@@ -1286,26 +1316,29 @@ class AcousticDataTab(QWidget):
|
||||
# -------- Computing water attenuation coefficient ----------- #
|
||||
def water_attenuation(self):
|
||||
"""Computing attenuation from François and Garrison 1982"""
|
||||
temp = float(self.lineEdit_temperature.text())
|
||||
file_id = self.fileListWidget.currentRow()
|
||||
|
||||
if self.fileListWidget.count() > 0:
|
||||
stg.water_attenuation[self.fileListWidget.currentRow()].clear()
|
||||
for f in stg.freq[self.fileListWidget.currentRow()]:
|
||||
if float(self.lineEdit_temperature.text()) > 20:
|
||||
stg.water_attenuation[file_id].clear()
|
||||
for f in stg.freq[file_id]:
|
||||
if temp > 20:
|
||||
alpha = ((3.964 * 1e-4 -
|
||||
1.146 * 1e-5 * float(self.lineEdit_temperature.text()) +
|
||||
1.45 * 1e-7 * float(self.lineEdit_temperature.text()) ** 2 -
|
||||
6.5 * 1e-10 * float(self.lineEdit_temperature.text()) ** 3) *
|
||||
1.146 * 1e-5 * temp +
|
||||
1.45 * 1e-7 * temp ** 2 -
|
||||
6.5 * 1e-10 * temp ** 3) *
|
||||
1e-3 * (np.log(10) / 20) * (f * 1e-3) ** 2)
|
||||
else:
|
||||
alpha = ((4.937 * 1e-4 -
|
||||
2.59 * 1e-5 * float(self.lineEdit_temperature.text()) +
|
||||
9.11 * 1e-7 * float(self.lineEdit_temperature.text()) ** 2 -
|
||||
1.5 * 1e-8 * float(self.lineEdit_temperature.text()) ** 3) *
|
||||
2.59 * 1e-5 * temp +
|
||||
9.11 * 1e-7 * temp ** 2 -
|
||||
1.5 * 1e-8 * temp ** 3) *
|
||||
1e-3 * (np.log(10) / 20) * (f * 1e-3) ** 2)
|
||||
|
||||
stg.water_attenuation[self.fileListWidget.currentRow()].append(alpha)
|
||||
stg.water_attenuation[file_id].append(alpha)
|
||||
|
||||
self.lineEdit_sound_attenuation.setText(
|
||||
str("%.6f" % stg.water_attenuation[self.fileListWidget.currentRow()][
|
||||
str("%.6f" % stg.water_attenuation[file_id][
|
||||
self.combobox_frequency_information.currentIndex()]))
|
||||
|
||||
def open_dialog_box(self):
|
||||
@@ -1642,9 +1675,9 @@ class AcousticDataTab(QWidget):
|
||||
stg.gain_tx.append(acoustic_data._gain_tx)
|
||||
stg.water_attenuation.append([])
|
||||
|
||||
# --- The other acoustic variables lists are filled with empty object. ---
|
||||
# --- They will be used for pre- and post-processing ---
|
||||
self.initiate_setting_parameters_new_others()
|
||||
|
||||
def initiate_setting_parameters_new_others(self):
|
||||
stg.BS_cross_section.append(np.array([]))
|
||||
stg.depth_cross_section.append(np.array([]))
|
||||
stg.time_cross_section.append(np.array([]))
|
||||
@@ -1704,6 +1737,9 @@ class AcousticDataTab(QWidget):
|
||||
self.fill_measurements_information_groupbox_cells()
|
||||
self.fill_measurements_information_groupbox_kt()
|
||||
|
||||
self.water_velocity()
|
||||
self.water_attenuation()
|
||||
|
||||
def fill_measurements_information_groupbox_datetime(self):
|
||||
file_id = self.fileListWidget.currentRow()
|
||||
print("file_id ", file_id)
|
||||
@@ -1741,6 +1777,7 @@ class AcousticDataTab(QWidget):
|
||||
.currentIndexChanged\
|
||||
.connect(self.combobox_frequency_information_update)
|
||||
|
||||
logger.debug(f"Set temperature = {stg.temperature}")
|
||||
self.lineEdit_temperature.setText(str(stg.temperature))
|
||||
|
||||
self.label_profiles_value.setText(
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import logging
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from math import isinf
|
||||
@@ -50,6 +51,7 @@ from Model.acoustic_inversion_method_high_concentration import AcousticInversion
|
||||
|
||||
_translate = QCoreApplication.translate
|
||||
|
||||
logger = logging.getLogger("acoused")
|
||||
|
||||
class AcousticInversionTab(QWidget):
|
||||
|
||||
@@ -369,6 +371,14 @@ class AcousticInversionTab(QWidget):
|
||||
# ------------------------------------ Functions for Acoustic Inversion Tab ----------------------------------------
|
||||
# ==================================================================================================================
|
||||
|
||||
def full_update(self):
|
||||
logger.debug(f"{__name__}: Update")
|
||||
self.blockSignals(True)
|
||||
|
||||
# TODO: Update all widgets
|
||||
|
||||
self.blockSignals(False)
|
||||
|
||||
def update_acoustic_data_choice(self):
|
||||
|
||||
self.combobox_acoustic_data_choice.clear()
|
||||
|
||||
+8
-6
@@ -21,6 +21,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import time
|
||||
import pickle
|
||||
import logging
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from subprocess import Popen
|
||||
|
||||
# Form implementation generated from reading ui file 'mainwindow.ui'
|
||||
#
|
||||
@@ -38,12 +45,7 @@ from Model.calibration_constant_kt import CalibrationConstantKt
|
||||
from View.about_window import AboutWindow
|
||||
import settings as stg
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from subprocess import Popen
|
||||
|
||||
import time
|
||||
|
||||
logger = logging.getLogger("acoused")
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import logging
|
||||
|
||||
from PyQt5.QtWidgets import (
|
||||
QApplication, QWidget, QVBoxLayout, QHBoxLayout,
|
||||
QTextEdit, QPushButton, QSpacerItem, QSpinBox,
|
||||
@@ -8,6 +10,8 @@ from PyQt5.QtCore import Qt
|
||||
|
||||
import settings as stg
|
||||
|
||||
logger = logging.getLogger("acoused")
|
||||
|
||||
class NoteTab(QWidget):
|
||||
|
||||
''' This class generates a enhanced notepad in Note Tab '''
|
||||
@@ -17,6 +21,9 @@ class NoteTab(QWidget):
|
||||
|
||||
path_icon = "./icons/"
|
||||
|
||||
# FIXME: The note are disabled because there are never saved
|
||||
widget_tab.setEnabled(False)
|
||||
|
||||
self.verticalLayout_main_note_tab = QVBoxLayout(widget_tab)
|
||||
|
||||
self.horizontalLayout_toolbar = QHBoxLayout()
|
||||
@@ -130,6 +137,14 @@ class NoteTab(QWidget):
|
||||
## -------------------------------
|
||||
|
||||
|
||||
def full_update(self):
|
||||
logger.debug(f"{__name__}: Update")
|
||||
self.blockSignals(True)
|
||||
|
||||
# TODO: Update all widgets
|
||||
|
||||
self.blockSignals(False)
|
||||
|
||||
# def new_text(self):
|
||||
# window = self.ui_mainwindow.tab5
|
||||
# window.show()
|
||||
|
||||
+45
-21
@@ -271,6 +271,24 @@ class SampleDataTab(QWidget):
|
||||
|
||||
self.groupbox_plot_PSD.setTitle(_translate("CONSTANT_STRING", cs.DISTRIBUTION_PLOT))
|
||||
|
||||
def full_update(self):
|
||||
logger.debug(f"{__name__}: Update")
|
||||
self.blockSignals(True)
|
||||
|
||||
self.fill_comboboxes_and_plot_transect()
|
||||
self.lineEdit_fine_sediment.setText(stg.filename_fine)
|
||||
self.lineEdit_fine_sediment.setToolTip(stg.path_fine)
|
||||
self.fill_table_fine()
|
||||
|
||||
self.lineEdit_sand_sediment.setText(stg.filename_sand)
|
||||
self.lineEdit_sand_sediment.setToolTip(stg.path_sand)
|
||||
self.fill_table_sand()
|
||||
|
||||
#self.plot_sample_position_on_transect()
|
||||
self.plot_total_concentration()
|
||||
self.plot_PSD_fine_and_sand_sediments()
|
||||
|
||||
self.blockSignals(False)
|
||||
|
||||
def last_opened_file_path(self, priority="sand"):
|
||||
lst = []
|
||||
@@ -317,6 +335,10 @@ class SampleDataTab(QWidget):
|
||||
self.lineEdit_fine_sediment.setToolTip(stg.path_fine)
|
||||
self.fill_table_fine()
|
||||
|
||||
self.plot_sample_position_on_transect()
|
||||
self.plot_total_concentration()
|
||||
self.plot_PSD_fine_and_sand_sediments()
|
||||
|
||||
def open_dialog_box_sand_sediment(self):
|
||||
filename_sand_sediment = QFileDialog.getOpenFileName(
|
||||
self, "Sand sediment file",
|
||||
@@ -342,6 +364,10 @@ class SampleDataTab(QWidget):
|
||||
self.lineEdit_sand_sediment.setToolTip(stg.path_sand)
|
||||
self.fill_table_sand()
|
||||
|
||||
self.plot_sample_position_on_transect()
|
||||
self.plot_total_concentration()
|
||||
self.plot_PSD_fine_and_sand_sediments()
|
||||
|
||||
def load_fine_sediment_data(self):
|
||||
fine_granulo_data = GranuloLoader(
|
||||
os.path.join(stg.path_fine, stg.filename_fine)
|
||||
@@ -396,7 +422,7 @@ class SampleDataTab(QWidget):
|
||||
horizontal_header = list(
|
||||
itertools.chain(
|
||||
["Color", "Sample"],
|
||||
list(map(str, stg.columns_fine[[0, 2]])),
|
||||
[str(stg.columns_fine[0]), str(stg.columns_fine[2])],
|
||||
list(map(str, stg.columns_fine[3:]))
|
||||
)
|
||||
)
|
||||
@@ -472,10 +498,6 @@ class SampleDataTab(QWidget):
|
||||
self.combobox_x_axis.currentIndexChanged.connect(self.plot_total_concentration)
|
||||
self.combobox_y_axis.currentIndexChanged.connect(self.plot_total_concentration)
|
||||
|
||||
self.plot_sample_position_on_transect()
|
||||
self.plot_total_concentration()
|
||||
self.plot_PSD_fine_and_sand_sediments()
|
||||
|
||||
self.tableWidget_fine.blockSignals(False)
|
||||
else:
|
||||
msgBox = QMessageBox()
|
||||
@@ -495,7 +517,7 @@ class SampleDataTab(QWidget):
|
||||
horizontal_header = list(
|
||||
itertools.chain(
|
||||
["Color", "Sample"],
|
||||
list(map(str, stg.columns_sand[[0, 2]])),
|
||||
[str(stg.columns_fine[0]), str(stg.columns_fine[2])],
|
||||
list(map(str, stg.columns_sand[3:]))
|
||||
)
|
||||
)
|
||||
@@ -574,10 +596,6 @@ class SampleDataTab(QWidget):
|
||||
self.combobox_y_axis.currentIndexChanged\
|
||||
.connect(self.plot_total_concentration)
|
||||
|
||||
self.plot_sample_position_on_transect()
|
||||
self.plot_total_concentration()
|
||||
self.plot_PSD_fine_and_sand_sediments()
|
||||
|
||||
self.tableWidget_sand.blockSignals(False)
|
||||
|
||||
# --- Function to extract position of sample from table checkboxes to update plots ---
|
||||
@@ -738,13 +756,19 @@ class SampleDataTab(QWidget):
|
||||
self.combobox_acoustic_data.clear()
|
||||
for n, m in enumerate(stg.noise_method):
|
||||
if stg.noise_method[n] == 0:
|
||||
self.combobox_acoustic_data.addItem(stg.filename_BS_raw_data[n])
|
||||
elif stg.noise_method[n]!=0:
|
||||
self.combobox_acoustic_data.addItem(stg.data_preprocessed[n])
|
||||
self.combobox_acoustic_data\
|
||||
.addItem(stg.filename_BS_raw_data[n])
|
||||
elif stg.noise_method[n] != 0:
|
||||
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)
|
||||
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)
|
||||
|
||||
def plot_sample_position_on_transect(self):
|
||||
self.verticalLayout_groupbox_plot_transect\
|
||||
@@ -998,7 +1022,7 @@ class SampleDataTab(QWidget):
|
||||
|
||||
self.axis_plot_sample_position_on_transect.text(
|
||||
1, .85, stg.freq_text[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()],
|
||||
fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5,
|
||||
fontsize=14, fontweight='bold', fontname="DejaVu Sans", c="black", alpha=0.5,
|
||||
horizontalalignment='right', verticalalignment='bottom',
|
||||
transform=self.axis_plot_sample_position_on_transect.transAxes)
|
||||
|
||||
@@ -1006,11 +1030,11 @@ class SampleDataTab(QWidget):
|
||||
self.axis_plot_sample_position_on_transect.tick_params(axis='both', labelsize=8)
|
||||
|
||||
self.axis_plot_sample_position_on_transect.text(.98, .03, "Time (sec)",
|
||||
fontsize=10, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.9,
|
||||
fontsize=10, fontweight='bold', fontname="DejaVu Sans", c="black", alpha=0.9,
|
||||
horizontalalignment='right', verticalalignment='bottom', rotation='horizontal',
|
||||
transform=self.axis_plot_sample_position_on_transect.transAxes)
|
||||
self.axis_plot_sample_position_on_transect.text(.04, .53, "Depth (m)",
|
||||
fontsize=10, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.9,
|
||||
fontsize=10, fontweight='bold', fontname="DejaVu Sans", c="black", alpha=0.9,
|
||||
horizontalalignment='right', verticalalignment='bottom', rotation='vertical',
|
||||
transform=self.axis_plot_sample_position_on_transect.transAxes)
|
||||
|
||||
@@ -1324,7 +1348,7 @@ class SampleDataTab(QWidget):
|
||||
|
||||
self.axis_plot_sample_position_on_transect.text(
|
||||
1, .85, stg.freq_text[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()],
|
||||
fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5,
|
||||
fontsize=14, fontweight='bold', fontname="DejaVu Sans", c="black", alpha=0.5,
|
||||
horizontalalignment='right', verticalalignment='bottom',
|
||||
transform=self.axis_plot_sample_position_on_transect.transAxes)
|
||||
|
||||
@@ -1332,13 +1356,13 @@ class SampleDataTab(QWidget):
|
||||
self.axis_plot_sample_position_on_transect.tick_params(axis='both', labelsize=8)
|
||||
|
||||
self.axis_plot_sample_position_on_transect.text(.98, .03, "Time (sec)",
|
||||
fontsize=10, fontweight='bold', fontname="Ubuntu", c="black",
|
||||
fontsize=10, fontweight='bold', fontname="DejaVu Sans", c="black",
|
||||
alpha=0.9,
|
||||
horizontalalignment='right', verticalalignment='bottom',
|
||||
rotation='horizontal',
|
||||
transform=self.axis_plot_sample_position_on_transect.transAxes)
|
||||
self.axis_plot_sample_position_on_transect.text(.04, .53, "Depth (m)",
|
||||
fontsize=10, fontweight='bold', fontname="Ubuntu", c="black",
|
||||
fontsize=10, fontweight='bold', fontname="DejaVu Sans", c="black",
|
||||
alpha=0.9,
|
||||
horizontalalignment='right', verticalalignment='bottom',
|
||||
rotation='vertical',
|
||||
|
||||
@@ -857,6 +857,14 @@ class SedimentCalibrationTab(QWidget):
|
||||
# ----------------------------------- Functions for Signal processing Tab --------------------------------------
|
||||
# ==============================================================================================================
|
||||
|
||||
def full_update(self):
|
||||
logger.debug(f"{__name__}: Update")
|
||||
self.blockSignals(True)
|
||||
|
||||
self.function_pushbutton_update_acoustic_file()
|
||||
|
||||
self.blockSignals(False)
|
||||
|
||||
def function_pushbutton_update_acoustic_file(self):
|
||||
if len(stg.data_preprocessed) == 0:
|
||||
return
|
||||
@@ -1776,10 +1784,6 @@ class SedimentCalibrationTab(QWidget):
|
||||
)
|
||||
|
||||
def update_label_kt_value_for_calibration(self):
|
||||
print("self.combobox_freq1.currentIndex() ",
|
||||
self.combobox_freq1.currentIndex(),
|
||||
self.combobox_freq1.currentText())
|
||||
|
||||
freq_1 = self.combobox_freq1.currentIndex()
|
||||
freq_2 = self.combobox_freq2.currentIndex()
|
||||
|
||||
|
||||
+236
-271
@@ -511,12 +511,31 @@ class SignalProcessingTab(QWidget):
|
||||
self.icon_clear = QIcon(path_icon("clear.png"))
|
||||
self.icon_apply = QIcon(path_icon("circle_green_arrow_right.png"))
|
||||
|
||||
def full_update(self):
|
||||
logger.debug(f"{__name__}: Update")
|
||||
self.blockSignals(True)
|
||||
self.combobox_acoustic_data_choice.blockSignals(True)
|
||||
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
# +++++++++ FUNCTION +++++++++
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
self.full_update_fill_text()
|
||||
self.update_SignalPreprocessingTab()
|
||||
|
||||
self.combobox_acoustic_data_choice.blockSignals(False)
|
||||
self.blockSignals(False)
|
||||
|
||||
def full_update_fill_text(self):
|
||||
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||
|
||||
self.lineEdit_profile_tail_value.setText(
|
||||
str(stg.noise_value[data_id])
|
||||
)
|
||||
|
||||
self.lineEdit_SNR_criterion.setText(
|
||||
str(stg.SNR_filter_value[data_id])
|
||||
)
|
||||
|
||||
self.lineEdit_horizontal_average.setText(
|
||||
str(stg.Nb_cells_to_average_BS_signal[data_id])
|
||||
)
|
||||
|
||||
def update_SignalPreprocessingTab(self):
|
||||
|
||||
@@ -564,6 +583,33 @@ class SignalProcessingTab(QWidget):
|
||||
self.combobox_freq_noise_from_profile_tail.blockSignals(False)
|
||||
self.combobox_acoustic_data_choice.blockSignals(False)
|
||||
|
||||
def _is_correct_shape(self, data):
|
||||
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||
|
||||
if stg.time_cross_section[data_id].shape != (0,):
|
||||
x_time = stg.time_cross_section[data_id]
|
||||
else:
|
||||
x_time = stg.time[data_id]
|
||||
|
||||
if stg.depth_cross_section[data_id].shape != (0,):
|
||||
y_depth = stg.depth_cross_section[data_id]
|
||||
else:
|
||||
y_depth = stg.depth[data_id]
|
||||
|
||||
time_shape, = x_time[data_id].shape
|
||||
depth_shape, = y_depth[data_id].shape
|
||||
|
||||
logger.debug(f"_is_correct_shape: time shape: {time_shape}")
|
||||
logger.debug(f"_is_correct_shape: depth shape: {depth_shape}")
|
||||
logger.debug(f"_is_correct_shape: data shape: {data[data_id].shape}")
|
||||
|
||||
if data[data_id].shape == (0,):
|
||||
return False
|
||||
|
||||
_, y, z = data[data_id].shape
|
||||
|
||||
return (y == depth_shape and z == time_shape)
|
||||
|
||||
def recompute(self):
|
||||
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||
|
||||
@@ -784,9 +830,17 @@ class SignalProcessingTab(QWidget):
|
||||
|
||||
self.compute_average_profile_tail()
|
||||
|
||||
self.lineEdit_SNR_criterion.setText(str(stg.SNR_filter_value[self.combobox_acoustic_data_choice.currentIndex()]))
|
||||
self.lineEdit_SNR_criterion.setText(
|
||||
str(stg.SNR_filter_value[
|
||||
self.combobox_acoustic_data_choice.currentIndex()
|
||||
])
|
||||
)
|
||||
|
||||
self.lineEdit_horizontal_average.setText(str(stg.Nb_cells_to_average_BS_signal[self.combobox_acoustic_data_choice.currentIndex()]))
|
||||
self.lineEdit_horizontal_average.setText(
|
||||
str(stg.Nb_cells_to_average_BS_signal[
|
||||
self.combobox_acoustic_data_choice.currentIndex()
|
||||
])
|
||||
)
|
||||
|
||||
self.combobox_frequency_profile.clear()
|
||||
self.combobox_frequency_profile.addItems(
|
||||
@@ -808,28 +862,29 @@ class SignalProcessingTab(QWidget):
|
||||
if len(stg.filename_BS_raw_data) == 0:
|
||||
pass
|
||||
else:
|
||||
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||
|
||||
stg.BS_noise_raw_data[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
|
||||
stg.BS_noise_raw_data[data_id] = np.array([])
|
||||
stg.BS_noise_averaged_data[data_id] = np.array([])
|
||||
stg.SNR_raw_data[data_id] = np.array([])
|
||||
stg.SNR_cross_section[data_id] = np.array([])
|
||||
stg.SNR_stream_bed[data_id] = np.array([])
|
||||
stg.time_noise[data_id] = np.array([])
|
||||
stg.SNR_filter_value[data_id] = 0
|
||||
|
||||
stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
|
||||
stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
|
||||
stg.BS_raw_data_pre_process_SNR[data_id] = np.array([])
|
||||
stg.BS_raw_data_pre_process_average[data_id] = np.array([])
|
||||
|
||||
stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
|
||||
stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
|
||||
stg.BS_cross_section_pre_process_SNR[data_id] = np.array([])
|
||||
stg.BS_cross_section_pre_process_average[data_id] = np.array([])
|
||||
|
||||
stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
|
||||
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:
|
||||
stg.BS_stream_bed_pre_process_SNR[data_id] = np.array([])
|
||||
stg.BS_stream_bed_pre_process_average[data_id] = np.array([])
|
||||
print("stg.noise_method[data_id]", stg.noise_method[data_id])
|
||||
if stg.noise_method[data_id] == 0:
|
||||
self.lineEdit_noise_file.clear()
|
||||
|
||||
elif stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 1:
|
||||
elif stg.noise_method[data_id] == 1:
|
||||
self.lineEdit_val1.clear()
|
||||
self.lineEdit_val1.setText("0.00")
|
||||
|
||||
@@ -946,136 +1001,140 @@ class SignalProcessingTab(QWidget):
|
||||
|
||||
|
||||
def load_noise_data_and_compute_SNR(self):
|
||||
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||
|
||||
stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] = 0
|
||||
stg.noise_method[data_id] = 0
|
||||
|
||||
noise_data = AcousticDataLoader(stg.path_BS_noise_data[self.combobox_acoustic_data_choice.currentIndex()] +
|
||||
noise_data = AcousticDataLoader(stg.path_BS_noise_data[data_id] +
|
||||
"/" +
|
||||
stg.filename_BS_noise_data[self.combobox_acoustic_data_choice.currentIndex()])
|
||||
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = noise_data._BS_raw_data
|
||||
stg.filename_BS_noise_data[data_id])
|
||||
stg.BS_noise_raw_data[data_id] = noise_data._BS_raw_data
|
||||
|
||||
stg.time_noise[self.combobox_acoustic_data_choice.currentIndex()] = noise_data._time
|
||||
stg.depth_noise[self.combobox_acoustic_data_choice.currentIndex()] = noise_data._r
|
||||
stg.time_noise[data_id] = noise_data._time
|
||||
stg.depth_noise[data_id] = noise_data._r
|
||||
|
||||
if stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
if stg.BS_stream_bed[data_id].shape != (0,):
|
||||
|
||||
noise = np.zeros(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape)
|
||||
noise = np.zeros(stg.BS_stream_bed[data_id].shape)
|
||||
for f, _ in enumerate(noise_data._freq):
|
||||
noise[f, :, :] = np.mean(
|
||||
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, :], axis=(0, 1))
|
||||
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = noise
|
||||
stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
np.divide((stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()] -
|
||||
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()]) ** 2,
|
||||
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] ** 2))
|
||||
stg.BS_noise_raw_data[data_id][f, :, :], axis=(0, 1))
|
||||
stg.BS_noise_averaged_data[data_id] = noise
|
||||
stg.SNR_stream_bed[data_id] = (
|
||||
np.divide((stg.BS_stream_bed[data_id] -
|
||||
stg.BS_noise_averaged_data[data_id]) ** 2,
|
||||
stg.BS_noise_averaged_data[data_id] ** 2))
|
||||
|
||||
elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
elif stg.BS_cross_section[data_id].shape != (0,):
|
||||
|
||||
noise = np.zeros(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape)
|
||||
noise = np.zeros(stg.BS_cross_section[data_id].shape)
|
||||
for f, _ in enumerate(noise_data._freq):
|
||||
noise[f, :, :] = np.mean(
|
||||
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, :], axis=(0, 1))
|
||||
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = noise
|
||||
stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
np.divide((stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()] -
|
||||
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()]) ** 2,
|
||||
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] ** 2))
|
||||
stg.BS_noise_raw_data[data_id][f, :, :], axis=(0, 1))
|
||||
stg.BS_noise_averaged_data[data_id] = noise
|
||||
stg.SNR_cross_section[data_id] = (
|
||||
np.divide((stg.BS_cross_section[data_id] -
|
||||
stg.BS_noise_averaged_data[data_id]) ** 2,
|
||||
stg.BS_noise_averaged_data[data_id] ** 2))
|
||||
# stg.SNR_reshape = np.reshape(stg.SNR_cross_section, (stg.r.shape[1] * stg.t.shape[1], stg.freq.shape[0]), order="F")
|
||||
|
||||
else:
|
||||
|
||||
noise = np.zeros(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape)
|
||||
noise = np.zeros(stg.BS_raw_data[data_id].shape)
|
||||
for f, _ in enumerate(noise_data._freq):
|
||||
noise[f, :, :] = np.mean(
|
||||
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, :], axis=(0, 1))
|
||||
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = noise
|
||||
stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
np.divide((stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()] -
|
||||
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()]) ** 2,
|
||||
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] ** 2))
|
||||
stg.BS_noise_raw_data[data_id][f, :, :], axis=(0, 1))
|
||||
stg.BS_noise_averaged_data[data_id] = noise
|
||||
stg.SNR_raw_data[data_id] = (
|
||||
np.divide((stg.BS_raw_data[data_id] -
|
||||
stg.BS_noise_averaged_data[data_id]) ** 2,
|
||||
stg.BS_noise_averaged_data[data_id] ** 2))
|
||||
|
||||
def open_plot_noise_window(self):
|
||||
pnw = PlotNoiseWindow()
|
||||
pnw.exec()
|
||||
|
||||
def compute_noise_from_profile_tail_value(self):
|
||||
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||
|
||||
stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] = 1
|
||||
stg.noise_method[data_id] = 1
|
||||
stg.noise_value[data_id] = (
|
||||
float(self.lineEdit_profile_tail_value.text().replace(",", "."))
|
||||
)
|
||||
|
||||
stg.noise_value[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
float(self.lineEdit_profile_tail_value.text().replace(",", ".")))
|
||||
|
||||
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
stg.time_noise[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()])
|
||||
if stg.time_cross_section[data_id].shape != (0,):
|
||||
stg.time_noise[data_id] = (
|
||||
stg.time_cross_section[data_id]
|
||||
)
|
||||
else:
|
||||
stg.time_noise[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()])
|
||||
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
stg.depth_noise[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()])
|
||||
stg.time_noise[data_id] = (
|
||||
stg.time[data_id]
|
||||
)
|
||||
if stg.depth_cross_section[data_id].shape != (0,):
|
||||
stg.depth_noise[data_id] = (
|
||||
stg.depth_cross_section[data_id]
|
||||
)
|
||||
else:
|
||||
stg.depth_noise[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
stg.depth[self.combobox_acoustic_data_choice.currentIndex()])
|
||||
stg.depth_noise[data_id] = (
|
||||
stg.depth[data_id]
|
||||
)
|
||||
|
||||
# --- Compute noise from value and compute SNR ---
|
||||
|
||||
if stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
|
||||
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
np.full(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape,
|
||||
if self._is_correct_shape(stg.BS_stream_bed):
|
||||
stg.BS_noise_raw_data[data_id] = np.array([])
|
||||
stg.BS_noise_raw_data[data_id] = (
|
||||
np.full(stg.BS_stream_bed[data_id].shape,
|
||||
float(self.lineEdit_profile_tail_value.text().replace(",", "."))))
|
||||
|
||||
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()][:, :,
|
||||
:stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape[2]])
|
||||
stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
np.divide((stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()]
|
||||
- stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()]) ** 2,
|
||||
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] ** 2))
|
||||
stg.BS_noise_averaged_data[data_id] = (
|
||||
stg.BS_noise_raw_data[data_id][:, :,
|
||||
:stg.BS_stream_bed[data_id].shape[2]])
|
||||
stg.SNR_stream_bed[data_id] = (
|
||||
np.divide((stg.BS_stream_bed[data_id]
|
||||
- stg.BS_noise_raw_data[data_id]) ** 2,
|
||||
stg.BS_noise_raw_data[data_id] ** 2))
|
||||
|
||||
elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
np.full(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape,
|
||||
elif self._is_correct_shape(stg.BS_cross_section):
|
||||
stg.BS_noise_raw_data[data_id] = (
|
||||
np.full(stg.BS_cross_section[data_id].shape,
|
||||
float(self.lineEdit_profile_tail_value.text().replace(",", "."))))
|
||||
|
||||
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()][:, :,
|
||||
:stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[2]])
|
||||
stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
np.divide((stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()]
|
||||
- stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()]) ** 2,
|
||||
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] ** 2)) #
|
||||
stg.BS_noise_averaged_data[data_id] = (
|
||||
stg.BS_noise_raw_data[data_id][:, :,
|
||||
:stg.BS_cross_section[data_id].shape[2]])
|
||||
stg.SNR_cross_section[data_id] = (
|
||||
np.divide((stg.BS_cross_section[data_id]
|
||||
- stg.BS_noise_raw_data[data_id]) ** 2,
|
||||
stg.BS_noise_raw_data[data_id] ** 2)) #
|
||||
|
||||
else:
|
||||
|
||||
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
np.full(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape,
|
||||
stg.BS_noise_raw_data[data_id] = (
|
||||
np.full(stg.BS_raw_data[data_id].shape,
|
||||
float(self.lineEdit_profile_tail_value.text().replace(",", "."))))
|
||||
|
||||
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()])
|
||||
stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
np.divide((stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()]
|
||||
- stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()]) ** 2,
|
||||
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] ** 2))
|
||||
stg.BS_noise_averaged_data[data_id] = (
|
||||
stg.BS_noise_raw_data[data_id])
|
||||
stg.SNR_raw_data[data_id] = (
|
||||
np.divide((stg.BS_raw_data[data_id]
|
||||
- stg.BS_noise_raw_data[data_id]) ** 2,
|
||||
stg.BS_noise_raw_data[data_id] ** 2))
|
||||
|
||||
self.combobox_frequency_profile.clear()
|
||||
self.combobox_frequency_profile.addItems(
|
||||
[f for f in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]])
|
||||
[f for f in stg.freq_text[data_id]])
|
||||
|
||||
# --- Trigger graphic widgets ---
|
||||
|
||||
if stg.SNR_filter_value[self.combobox_acoustic_data_choice.currentIndex()] == 0:
|
||||
if stg.SNR_filter_value[data_id] == 0:
|
||||
self.lineEdit_SNR_criterion.setText("0.00")
|
||||
else:
|
||||
self.lineEdit_SNR_criterion.setText(str(stg.SNR_filter_value[self.combobox_acoustic_data_choice.currentIndex()]))
|
||||
self.lineEdit_SNR_criterion.setText(str(stg.SNR_filter_value[data_id]))
|
||||
|
||||
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
self.slider.setMaximum(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1])
|
||||
if stg.time_cross_section[data_id].shape != (0,):
|
||||
self.slider.setMaximum(stg.time_cross_section[data_id].shape[1])
|
||||
else:
|
||||
self.slider.setMaximum(stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1])
|
||||
self.slider.setMaximum(stg.time[data_id].shape[1])
|
||||
|
||||
# self.activate_list_of_pre_processed_data()
|
||||
|
||||
@@ -1123,14 +1182,17 @@ class SignalProcessingTab(QWidget):
|
||||
|
||||
# elif self.canvas_SNR == None:
|
||||
else:
|
||||
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||
|
||||
if ((self.combobox_acoustic_data_choice.currentIndex() != -1)
|
||||
and (stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))):
|
||||
|
||||
if ((data_id != -1)
|
||||
and (stg.BS_noise_raw_data[data_id].shape != (0,))):
|
||||
self.verticalLayout_groupbox_plot_SNR.removeWidget(self.toolbar_SNR)
|
||||
self.verticalLayout_groupbox_plot_SNR.removeWidget(self.scroll_SNR)
|
||||
|
||||
self.fig_SNR, self.axis_SNR = plt.subplots(nrows=stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], ncols=1, sharex=True, sharey=False, layout='constrained')
|
||||
self.fig_SNR, self.axis_SNR = plt.subplots(
|
||||
nrows=stg.freq[data_id].shape[0], ncols=1,
|
||||
sharex=True, sharey=False, layout='constrained'
|
||||
)
|
||||
self.canvas_SNR = FigureCanvas(self.fig_SNR)
|
||||
self.toolbar_SNR = NavigationToolBar(self.canvas_SNR, self)
|
||||
|
||||
@@ -1139,158 +1201,82 @@ class SignalProcessingTab(QWidget):
|
||||
self.verticalLayout_groupbox_plot_SNR.addWidget(self.toolbar_SNR)
|
||||
self.verticalLayout_groupbox_plot_SNR.addWidget(self.scroll_SNR)
|
||||
|
||||
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]):
|
||||
|
||||
if stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
x, y = np.meshgrid(
|
||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :],
|
||||
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :])
|
||||
|
||||
elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
x, y = np.meshgrid(
|
||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :],
|
||||
stg.depth[self.combobox_acoustic_data_choice.currentIndex()][f, :])
|
||||
|
||||
else:
|
||||
|
||||
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
x, y = np.meshgrid(
|
||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()][f, :],
|
||||
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :])
|
||||
|
||||
elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
x, y = np.meshgrid(
|
||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()][f, :],
|
||||
stg.depth[self.combobox_acoustic_data_choice.currentIndex()][f, :])
|
||||
|
||||
val_min = np.nanmin(stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, :, :])
|
||||
val_max = np.nanmax(stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, :, :])
|
||||
if val_min == val_max:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1.2]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
else:
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
if val_max > 1000:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1.2]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
else:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, val_max * 1000 + 1])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1000 + 1]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
|
||||
cf = (self.axis_SNR[f].contourf(x, -y,
|
||||
stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, :, :],
|
||||
levels, cmap='gist_rainbow',
|
||||
norm=norm))
|
||||
|
||||
elif stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
x, y = np.meshgrid(
|
||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :],
|
||||
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :])
|
||||
|
||||
elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
x, y = np.meshgrid(
|
||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :],
|
||||
stg.depth[self.combobox_acoustic_data_choice.currentIndex()][f, :])
|
||||
|
||||
else:
|
||||
|
||||
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
x, y = np.meshgrid(
|
||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()][f, :],
|
||||
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :])
|
||||
|
||||
elif stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
x, y = np.meshgrid(
|
||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()][f, :],
|
||||
stg.depth[self.combobox_acoustic_data_choice.currentIndex()][f, :])
|
||||
|
||||
val_min = np.nanmin(stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :, :])
|
||||
val_max = np.nanmax(stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :, :])
|
||||
if val_min == val_max:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1.2]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
else:
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
if val_max > 1000:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1.2]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
|
||||
else:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, val_max * 1000 + 1])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1000 + 1]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
|
||||
cf = (self.axis_SNR[f].contourf(x, -y,
|
||||
stg.SNR_cross_section[
|
||||
self.combobox_acoustic_data_choice.currentIndex()][f, :, :],
|
||||
levels, cmap='gist_rainbow', norm=norm))
|
||||
for f, _ in enumerate(stg.freq[data_id]):
|
||||
if stg.SNR_stream_bed[data_id].shape != (0,):
|
||||
SNR_data = stg.SNR_stream_bed
|
||||
elif stg.SNR_cross_section[data_id].shape != (0,):
|
||||
SNR_data = stg.SNR_cross_section
|
||||
|
||||
if stg.time_cross_section[data_id].shape != (0,):
|
||||
time_data = stg.time_cross_section
|
||||
else:
|
||||
time_data = stg.time
|
||||
|
||||
x, y = np.meshgrid(stg.time[self.combobox_acoustic_data_choice.currentIndex()][0, :],
|
||||
stg.depth[self.combobox_acoustic_data_choice.currentIndex()][0, :])
|
||||
if stg.depth_cross_section[data_id].shape != (0,):
|
||||
depth_data = stg.depth_cross_section
|
||||
elif stg.depth[data_id].shape != (0,):
|
||||
depth_data = stg.depth
|
||||
|
||||
val_min = np.nanmin(stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, :])
|
||||
val_max = np.nanmax(stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, :])
|
||||
if val_min == val_max:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1.2]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
x, y = np.meshgrid(
|
||||
time_data[data_id][f, :],
|
||||
depth_data[data_id][f, :]
|
||||
)
|
||||
|
||||
val_min = np.nanmin(SNR_data[data_id][f, :, :])
|
||||
val_max = np.nanmax(SNR_data[data_id][f, :, :])
|
||||
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1.2]
|
||||
|
||||
if val_min != val_max:
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
else:
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
if val_max > 1000:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1.2]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
else:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, val_max*1000 + 1])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1000 + 1]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
levels = np.array(
|
||||
[00.1, 1, 2, 10, 100, 1000, val_max * 1000 + 1]
|
||||
)
|
||||
bounds = [
|
||||
00.1, 1, 2, 10, 100, 1000,
|
||||
val_max * 1000 + 1
|
||||
]
|
||||
|
||||
cf = (self.axis_SNR[f].contourf(x, -y,
|
||||
stg.SNR_raw_data[
|
||||
self.combobox_acoustic_data_choice.currentIndex()][f, :, :],
|
||||
levels, cmap='gist_rainbow', norm=norm))
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
|
||||
cf = self.axis_SNR[f].contourf(
|
||||
x, -y,
|
||||
SNR_data[data_id][f, :, :],
|
||||
levels, cmap='gist_rainbow',
|
||||
norm=norm
|
||||
)
|
||||
|
||||
self.axis_SNR[f].text(1, .70, stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][f],
|
||||
fontsize=14, fontweight='bold', fontname="DejaVu Sans", c="black", alpha=0.5,
|
||||
horizontalalignment='right', verticalalignment='bottom',
|
||||
transform=self.axis_SNR[f].transAxes)
|
||||
self.axis_SNR[f].text(
|
||||
1, .70, stg.freq_text[data_id][f],
|
||||
fontsize=14, fontweight='bold', fontname="DejaVu Sans",
|
||||
c="black", alpha=0.5,
|
||||
horizontalalignment='right',
|
||||
verticalalignment='bottom',
|
||||
transform=self.axis_SNR[f].transAxes
|
||||
)
|
||||
|
||||
self.fig_SNR.supxlabel('Time (sec)', fontsize=10)
|
||||
self.fig_SNR.supylabel('Depth (m)', fontsize=10)
|
||||
cbar = self.fig_SNR.colorbar(cf, ax=self.axis_SNR[:], shrink=1, location='right')
|
||||
cbar.set_label(label='Signal to Noise Ratio', rotation=270, labelpad=10)
|
||||
cbar.set_ticklabels(['0', '1', '2', '10', '100', r'10$^3$', r'10$^6$'])
|
||||
cbar = self.fig_SNR.colorbar(
|
||||
cf, ax=self.axis_SNR[:],
|
||||
shrink=1, location='right'
|
||||
)
|
||||
cbar.set_label(
|
||||
label='Signal to Noise Ratio',
|
||||
rotation=270, labelpad=10
|
||||
)
|
||||
cbar.set_ticklabels(
|
||||
[
|
||||
'0', '1', '2', '10', '100',
|
||||
r'10$^3$', r'10$^6$'
|
||||
]
|
||||
)
|
||||
self.fig_SNR.canvas.draw_idle()
|
||||
|
||||
else:
|
||||
|
||||
self.verticalLayout_groupbox_plot_SNR.removeWidget(self.toolbar_SNR)
|
||||
self.verticalLayout_groupbox_plot_SNR.removeWidget(self.scroll_SNR)
|
||||
|
||||
@@ -1412,9 +1398,6 @@ class SignalProcessingTab(QWidget):
|
||||
x_time = stg.time[data_id]
|
||||
y_depth = stg.depth[data_id]
|
||||
|
||||
logger.debug(f"x_time: {x_time[data_id].shape}")
|
||||
logger.debug(f"y_depth: {y_depth[data_id].shape}")
|
||||
|
||||
for f, _ in enumerate(stg.freq[data_id]):
|
||||
if stg.BS_stream_bed_pre_process_average[data_id].shape != (0,):
|
||||
BS_data = stg.BS_stream_bed_pre_process_average
|
||||
@@ -1435,8 +1418,6 @@ class SignalProcessingTab(QWidget):
|
||||
elif stg.BS_raw_data[data_id].shape != (0,):
|
||||
BS_data = stg.BS_raw_data
|
||||
|
||||
logger.debug(f"BS_data: {BS_data[data_id].shape}")
|
||||
|
||||
val_min = np.nanmin(
|
||||
BS_data[data_id][f, :, :]
|
||||
)
|
||||
@@ -1539,20 +1520,10 @@ class SignalProcessingTab(QWidget):
|
||||
)
|
||||
)
|
||||
|
||||
if stg.time_cross_section[data_id].shape != (0,):
|
||||
if stg.depth_cross_section[data_id].shape != (0,):
|
||||
x_time = stg.time_cross_section[data_id]
|
||||
y_depth = stg.depth_cross_section[data_id]
|
||||
elif stg.depth[data_id].shape != (0,):
|
||||
x_time = stg.time_cross_section[data_id]
|
||||
y_depth = stg.depth[data_id]
|
||||
else:
|
||||
if stg.depth_cross_section[data_id].shape != (0,):
|
||||
x_time = stg.time[data_id]
|
||||
y_depth = stg.depth_cross_section[data_id]
|
||||
elif stg.depth[data_id].shape != (0,):
|
||||
x_time = stg.time[data_id]
|
||||
y_depth = stg.depth[data_id]
|
||||
if stg.depth_cross_section[data_id].shape != (0,):
|
||||
y_depth = stg.depth_cross_section[data_id]
|
||||
elif stg.depth[data_id].shape != (0,):
|
||||
y_depth = stg.depth[data_id]
|
||||
|
||||
BS = [
|
||||
stg.BS_stream_bed_pre_process_SNR,
|
||||
@@ -1572,11 +1543,6 @@ class SignalProcessingTab(QWidget):
|
||||
stg.BS_raw_data_pre_process_average,
|
||||
]
|
||||
|
||||
time_shape, = x_time[data_id].shape
|
||||
depth_shape, = y_depth[data_id].shape
|
||||
logger.debug(f"time_shape: {time_shape}")
|
||||
logger.debug(f"depth_shape: {depth_shape}")
|
||||
|
||||
BS_data = stg.BS_raw_data
|
||||
BS_data_ppa = stg.BS_raw_data_pre_process_average
|
||||
for i in range(len(BS)):
|
||||
@@ -1585,8 +1551,7 @@ class SignalProcessingTab(QWidget):
|
||||
if bs[data_id].shape == (0,):
|
||||
continue
|
||||
|
||||
x, y, z = bs[data_id].shape
|
||||
if y == depth_shape and z == time_shape:
|
||||
if self._is_correct_shape(bs):
|
||||
BS_data = bs
|
||||
BS_data_ppa = BS_ppa[i]
|
||||
break
|
||||
|
||||
@@ -27,5 +27,10 @@ class UserManualTab(QWidget):
|
||||
# self.label_picture_theory.resize(np.int(pic.width()/100), np.int(pic.height()/100))
|
||||
# self.verticalLayout_main.addWidget(self.label_picture_theory)
|
||||
|
||||
def full_update(self):
|
||||
logger.debug(f"{__name__}: Update")
|
||||
self.blockSignals(True)
|
||||
|
||||
# TODO: Update all widgets
|
||||
|
||||
self.blockSignals(False)
|
||||
Reference in new issue
Block a user