acoused/View/signal_processing_tab.py

784 lines
47 KiB
Python

import sys
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QPushButton, QGroupBox, QLabel, QCheckBox, \
QSpinBox, QDoubleSpinBox, QComboBox, QLineEdit, QSlider
from PyQt5.QtGui import QFont, QIcon, QPixmap
from PyQt5.QtCore import Qt, QCoreApplication
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolBar
from matplotlib.colors import LogNorm
import Translation.constant_string as cs
_translate = QCoreApplication.translate
class SignalProcessingTab(QWidget):
''' This class generates the Signal Processing Tab '''
def __init__(self, widget_tab):
super().__init__()
path_icon = "./icons/"
### --- General layout of widgets ---
# ___________ ____________________________
# | profile | | Profile |
# | position | | |
# | | | |
# | | | Averaged profile |
# | post | | |
# | proc | | |
# | options | | FCB option |
# |___________| |____________________________|
self.horizontalLayout_SignalProceesingTab = QHBoxLayout(widget_tab)
self.verticalLayout_Left_SignalProcessingTab = QVBoxLayout()
self.horizontalLayout_SignalProceesingTab.addLayout(self.verticalLayout_Left_SignalProcessingTab, 2)
self.verticalLayout_Right_SignalProcessingTab = QVBoxLayout()
self.horizontalLayout_SignalProceesingTab.addLayout(self.verticalLayout_Right_SignalProcessingTab, 8)
# # --------------------------------------------------------------------------------------------------------------
# ### --- Layout of groupbox in the Left vertical layout box
#
# # Profile position
# # --------------------
# # Post processing
# # --------------------
# # FCB options
#
# self.pushbutton_Load_data_from_acoustic_data_tab = QPushButton()
#
# self.verticalLayout_Left_SignalProcessingTab.addWidget(self.pushbutton_Load_data_from_acoustic_data_tab)
#
# self.groupbox_display_profile_position = QGroupBox()
# self.verticalLayout_groupbox_display_profile_position = QVBoxLayout(self.groupbox_display_profile_position)
#
# self.label_profile_number = QLabel()
# self.label_profile_number.setFont(QFont("Ubuntu", 16, QFont.Bold))
# self.label_profile_number.setAlignment(Qt.AlignCenter)
# self.string_profile_number = 1
# self.string_profile_number_max = 2300
# self.verticalLayout_groupbox_display_profile_position.addWidget(self.label_profile_number)
#
# self.figure_plot_profile_position_on_transect, self.axis_plot_profile_position_on_transect = \
# plt.subplots(nrows=1, ncols=1, layout="constrained")
# self.canvas_plot_profile_position_on_transect = FigureCanvas(self.figure_plot_profile_position_on_transect)
# self.plot_transect_bottom_with_profile_position(0)
#
# # self.axis_plot_profile_position_on_transect.plot(
# # 0 * np.ones(self.model.r_bottom_cross_section.shape[0]),
# # self.model.r_bottom_cross_section, color='red', linestyle="solid", linewidth=2)
#
# self.verticalLayout_groupbox_display_profile_position.addWidget(self.canvas_plot_profile_position_on_transect)
#
# self.horizontalLayout_slider_plot_profile_position = QHBoxLayout()
# self.verticalLayout_groupbox_display_profile_position.addLayout(
# self.horizontalLayout_slider_plot_profile_position)
#
# # self.icon_triangle_left = QPixmap(path_icon + "triangle_left.png")
# # self.pushButton_slider_plot_profile_position_left = QPushButton()
# # self.pushButton_slider_plot_profile_position_left.setIcon(QIcon(self.icon_triangle_left))
# # self.icon_triangle_right = QPixmap(path_icon + "triangle_right.png")
# # self.pushButton_slider_plot_profile_position_right = QPushButton()
# # self.pushButton_slider_plot_profile_position_right.setIcon(QIcon(self.icon_triangle_right))
# #
# # self.horizontalLayout_slider_plot_profile_position.addWidget(self.pushButton_slider_plot_profile_position_left)
# # self.horizontalLayout_slider_plot_profile_position.addWidget(self.pushButton_slider_plot_profile_position_right)
# #
# # self.lineEdit_slider_plot_profile_position = QLineEdit()
# # self.horizontalLayout_slider_plot_profile_position.addWidget(self.lineEdit_slider_plot_profile_position)
# #
# # self.slider_plot_profile_position = QSlider()
# # self.slider_plot_profile_position.setOrientation(Qt.Horizontal)
# # self.slider_plot_profile_position.setTickPosition(QSlider.TicksBelow)
# # self.slider_plot_profile_position.setCursor(Qt.OpenHandCursor)
# # self.slider_plot_profile_position.setMinimum(0)
# # self.slider_plot_profile_position.setMaximum(1)
# # self.slider_plot_profile_position.setTickInterval(1)
# # self.slider_plot_profile_position.setValue(0)
# # self.horizontalLayout_slider_plot_profile_position.addWidget(self.slider_plot_profile_position)
#
# # self.horizontalLayoutTop_signalProcessing.addWidget(self.groupbox_display_profile_position, 3)
# self.verticalLayout_left_SignalProcessingTab.addWidget(self.groupbox_display_profile_position)
#
# # self.checkbox_substract_noise = QCheckBox()
# # self.checkbox_substract_noise.setText("Substract the noise")
# # self.verticalLayout_averaged_profile = QVBoxLayout(self.checkbox_substract_noise)
# # self.pushbutton_averaged_profile = QPushButton()
# # self.pushbutton_averaged_profile.setText("Plot averaged profile")
#
# # self.verticalLayout_groupbox_plotacousticprofile.addWidget(self.checkbox_substract_noise)
#
# # self.groupbox_SNR_criterion = QGroupBox()
# # self.groupbox_SNR_criterion.setTitle("SNR criterion")
# # self.verticalLayout_SNR_criterion = QVBoxLayout(self.groupbox_SNR_criterion)
# # self.horizontalLayout_SNR_criterion = QHBoxLayout()
# # self.label_SNR_crterion = QLabel()
# # self.label_SNR_crterion.setText("Remove point if SNR <")
# # self.horizontalLayout_SNR_criterion.addWidget(self.label_SNR_crterion)
# # self.lineEdit_SNR_criterion = QLineEdit()
# # self.horizontalLayout_SNR_criterion.addWidget(self.lineEdit_SNR_criterion)
# # self.verticalLayout_SNR_criterion.addLayout(self.horizontalLayout_SNR_criterion)
# # self.pushbutton_SNR_criterion = QPushButton()
# # self.pushbutton_SNR_criterion.setText("Remove points on profile")
# # self.verticalLayout_SNR_criterion.addWidget(self.pushbutton_SNR_criterion)
# # self.verticalLayout_groupbox_plotacousticprofile.addWidget(self.groupbox_SNR_criterion)
#
# # self.horizontalLayoutTop_signalProcessing.addWidget(self.groupbox_profile, 3)
#
# # self.horizontalLayoutMid_signalProcessing = QHBoxLayout()
# # self.verticalLayout_signalProcessingTab.addLayout(self.horizontalLayoutMid_signalProcessing, 3)
#
# self.groupbox_post_processing = QGroupBox()
# # self.groupbox_post_processing.setTitle("Post processing")
#
# self.verticalLayout_groupbox_post_processing = QVBoxLayout(self.groupbox_post_processing)
#
# self.groupbox_acoustic_profile = QGroupBox()
# # self.groupbox_acoustic_profile.setTitle("Acoustic profile")
#
# # self.gridLayout_groupbox_acoustic_profile = QGridLayout(self.groupbox_acoustic_profile)
# self.horizontalLayout_acoustic_profile = QHBoxLayout(self.groupbox_acoustic_profile)
# # self.label_subtract_noise = QLabel()
# # self.label_subtract_noise.setText("Subtract the noise")
# self.checkbox_substract_noise = QCheckBox()
# self.checkbox_substract_noise.setChecked(False)
# # self.checkbox_substract_noise.setText("Subtract the noise")
# self.checkbox_substract_noise.setToolTip("Enable for further computation")
# self.horizontalLayout_acoustic_profile.addWidget(self.checkbox_substract_noise)
# # self.gridLayout_groupbox_acoustic_profile.addWidget(self.checkbox_substract_noise, 0, 0, 1, 1)
# # self.checkbox_subtract_noise_enable = QCheckBox()
# # self.checkbox_subtract_noise_enable.setChecked(False)
# # self.checkbox_subtract_noise_enable.setText("Enable")
# # self.horizontalLayout_label_subtract_noise.addWidget(self.checkbox_subtract_noise_enable)
# # self.gridLayout_groupbox_acoustic_profile.addWidget(self.checkbox_subtract_noise_enable, 0, 1, 1, 1)
# # self.checkbox_subtract_noise_disable = QCheckBox()
# # self.checkbox_subtract_noise_disable.setChecked(True)
# # self.checkbox_subtract_noise_disable.setText("Disable")
# # self.checkbox_subtract_noise_add_noisy_profile = QCheckBox()
# # self.checkbox_subtract_noise_add_noisy_profile.setText("Add noisy profile")
# # self.horizontalLayout_label_subtract_noise.addWidget(self.checkbox_subtract_noise_disable)
# # self.verticalLayout_post_processing.addLayout(self.horizontalLayout_label_subtract_noise)
# # self.gridLayout_groupbox_acoustic_profile.addWidget(self.checkbox_subtract_noise_add_noisy_profile, 0, 2, 1, 1)
# # self.horizontalLayout_SNR_criterion = QHBoxLayout()
# # self.formLayout_SNR_criterion = QFormLayout()
# # self.formLayout_SNR_criterion.set
# # self.label_SNR_criterion = QLabel()
# # self.label_SNR_criterion.setText("SNR criterion")
# self.checkbox_SNR_criterion = QCheckBox()
# self.checkbox_SNR_criterion.setChecked(False)
# # self.checkbox_SNR_criterion.setText("SNR criterion")
# self.checkbox_SNR_criterion.setToolTip("Enable for further computation")
# self.horizontalLayout_acoustic_profile.addWidget(self.checkbox_SNR_criterion)
# # self.gridLayout_groupbox_acoustic_profile.addWidget(self.label_SNR_criterion, 1, 0, 1, 1)
# # self.lineEdit_SNR_criterion = QLineEdit()
# # self.lineEdit_SNR_criterion.setEnabled(True)
# # self.lineEdit_SNR_criterion.setText("10")
# self.spinbox_SNR_criterion = QSpinBox()
# self.spinbox_SNR_criterion.setRange(0, 9999)
# self.spinbox_SNR_criterion.setValue(10)
# # self.lineEdit_SNR_criterion.setFixedWidth(5)
# self.horizontalLayout_acoustic_profile.addWidget(self.spinbox_SNR_criterion)
# # self.gridLayout_groupbox_acoustic_profile.addWidget(self.lineEdit_SNR_criterion, 1, 1, 1, 1)
# # self.checkbox_SNR_criterion_enable = QCheckBox()
# # self.checkbox_SNR_criterion_enable.setChecked(False)
# # self.checkbox_SNR_criterion_enable.setText("Enable")
# # self.horizontalLayout_SNR_criterion.addWidget(self.checkbox_SNR_criterion_enable)
# # self.gridLayout_groupbox_acoustic_profile.addWidget(self.checkbox_SNR_criterion_enable, 1, 2, 1, 1)
# # self.checkbox_SNR_criterion_disable = QCheckBox()
# # self.checkbox_SNR_criterion_disable.setChecked(True)
# # self.checkbox_SNR_criterion_disable.setText("Disable")
# # self.horizontalLayout_SNR_criterion.addWidget(self.checkbox_SNR_criterion_disable)
# # self.verticalLayout_post_processing.addLayout(self.horizontalLayout_SNR_criterion)
# # self.gridLayout_groupbox_acoustic_profile.addWidget(self.checkbox_SNR_criterion_disable, 1, 3, 1, 1)
#
# self.verticalLayout_groupbox_post_processing.addWidget(self.groupbox_acoustic_profile)
#
# # self.horizontalLayout_averaged_profile_despiking_signal = QHBoxLayout()
# # self.verticalLayout_groupbox_post_processing.addLayout(self.horizontalLayout_averaged_profile_despiking_signal)
#
# self.groupbox_window_size = QGroupBox()
# # self.groupbox_window_size.setTitle("Window size")
#
# # self.gridLayout_groupbox_window_size = QGridLayout(self.groupbox_window_size)
# self.verticalLayout_windowsize = QVBoxLayout(self.groupbox_window_size)
#
# # self.groupbox_averageprofile_despikingsignal = QGroupBox()
# # self.groupbox_averageprofile_despikingsignal.setTitle("Averaged profiles && Despiking the signal")
# # self.verticalLayout_groupbox_averageprofile_despikingsignal = QVBoxLayout(self.groupbox_averageprofile_despikingsignal)
#
# # self.groupbox_plot_averaged_profile = QGroupBox()
# # self.groupbox_plot_averaged_profile.setTitle("Window size")
# # self.verticalLayout_plot_averaged_profile = QVBoxLayout(self.groupbox_plot_averaged_profile)
#
# self.horizontalLayout_horizontal_average = QHBoxLayout()
# self.verticalLayout_windowsize.addLayout(self.horizontalLayout_horizontal_average)
# # self.label_nb_horizontal_cells = QLabel()
# # self.label_nb_horizontal_cells.setText("Horizontal: +/-")
# self.checkbox_nb_horizontal_cells = QCheckBox()
# self.checkbox_nb_horizontal_cells.setChecked(False)
# # self.checkbox_nb_horizontal_cells.setText("Horizontal: +/-")
# self.checkbox_nb_horizontal_cells.setToolTip("Enable for further computation")
# self.horizontalLayout_horizontal_average.addWidget(self.checkbox_nb_horizontal_cells)
# # self.gridLayout_groupbox_window_size.addWidget(self.label_nb_horizontal_cells, 0, 0, 1, 1)
# # self.lineEdit_nb_horizontal_cells = QLineEdit()
# # self.lineEdit_nb_horizontal_cells.setText("1")
# self.spinbox_nb_horizontal_cells = QSpinBox()
# self.spinbox_nb_horizontal_cells.setRange(0, 9999)
# self.spinbox_nb_horizontal_cells.setValue(0)
# self.horizontalLayout_horizontal_average.addWidget(self.spinbox_nb_horizontal_cells)
# # self.gridLayout_groupbox_window_size.addWidget(self.lineEdit_nb_horizontal_cells, 0, 1, 1, 1)
# self.label_nb_horizontal_cells_cm = QLabel()
# # self.label_nb_horizontal_cells_cm.setText("cells = +/- ? cm")
# self.horizontalLayout_horizontal_average.addWidget(self.label_nb_horizontal_cells_cm)
# # self.verticalLayout_plot_averaged_profile.addLayout(self.horizontalLayout_horizontal_average)
# # self.gridLayout_groupbox_window_size.addWidget(self.label_nb_horizontal_cells_cm, 0, 2, 1, 1)
# # self.checkbox_nb_horizontal_cell_enable = QCheckBox()
# # self.checkbox_nb_horizontal_cell_enable.setText("Enable")
# # self.gridLayout_groupbox_window_size.addWidget(self.checkbox_nb_horizontal_cell_enable, 0, 3, 1, 1)
# # self.checkbox_nb_horizontal_cell_add_raw_profile = QCheckBox()
# # self.checkbox_nb_horizontal_cell_add_raw_profile.setText("Add raw profile")
# # self.gridLayout_groupbox_window_size.addWidget(self.checkbox_nb_horizontal_cell_add_raw_profile, 0, 4, 1, 1)
#
# self.horizontalLayout_vertical_average = QHBoxLayout()
# self.verticalLayout_windowsize.addLayout(self.horizontalLayout_vertical_average)
# # self.label_nb_vertical_cells = QLabel()
# # self.label_nb_vertical_cells.setText("Vertical: +/-")
# self.checkbox_nb_vertical_cells = QCheckBox()
# self.checkbox_nb_vertical_cells.setChecked(False)
# # self.checkbox_nb_vertical_cells.setText("Vertical: +/-")
# self.checkbox_nb_vertical_cells.setToolTip("Enable for further computation")
# self.horizontalLayout_vertical_average.addWidget(self.checkbox_nb_vertical_cells)
# # self.horizontalLayout_vertical_average.addWidget(self.label_nb_vertical_cells)
# # self.gridLayout_groupbox_window_size.addWidget(self.label_nb_vertical_cells, 1, 0, 1, 1)
# # self.lineEdit_nb_vertical_cells = QLineEdit()
# # self.lineEdit_nb_vertical_cells.setText("1")
# self.spinbox_nb_vertical_cells = QSpinBox()
# self.spinbox_nb_vertical_cells.setRange(0, 9999)
# self.spinbox_nb_vertical_cells.setValue(0)
# self.horizontalLayout_vertical_average.addWidget(self.spinbox_nb_vertical_cells)
# # self.horizontalLayout_vertical_average.addWidget(self.lineEdit_nb_vertical_cells)
# # self.gridLayout_groupbox_window_size.addWidget(self.lineEdit_nb_vertical_cells, 1, 1, 1, 1)
# self.label_nb_vertical_cells_cm = QLabel()
# # self.label_nb_vertical_cells_cm.setText("cells = +/- ? cm")
# self.horizontalLayout_vertical_average.addWidget(self.label_nb_vertical_cells_cm)
# # self.verticalLayout_plot_averaged_profile.addLayout(self.horizontalLayout_vertical_average)
# # self.gridLayout_groupbox_window_size.addWidget(self.label_nb_vertical_cells_cm, 1, 2, 1, 1)
# # self.checkbox_nb_vertical_cells_enable = QCheckBox()
# # self.checkbox_nb_vertical_cells_enable.setText("Enable")
# # self.gridLayout_groupbox_window_size.addWidget(self.checkbox_nb_vertical_cells_enable, 1, 3, 1, 1)
# # self.checkbox_nb_vertical_cells_add_raw_profile = QCheckBox()
# # self.checkbox_nb_vertical_cells_add_raw_profile.setText("Add raw profile")
# # self.gridLayout_groupbox_window_size.addWidget(self.checkbox_nb_vertical_cells_add_raw_profile, 1, 4, 1, 1)
#
# # self.pushbutton_plot_averaged_profile = QPushButton()
# # self.pushbutton_plot_averaged_profile.setText("Plot averaged profiles")
# # self.verticalLayout_plot_averaged_profile.addWidget(self.pushbutton_plot_averaged_profile)
# #
# # self.verticalLayout_groupbox_averageprofile_despikingsignal.addWidget(self.groupbox_plot_averaged_profile)
#
# # self.horizontalLayout_averaged_profile_despiking_signal.addWidget(self.groupbox_window_size)
#
# self.verticalLayout_groupbox_post_processing.addWidget(self.groupbox_window_size)
#
# self.groupbox_rayleigh_criterion = QGroupBox()
# # self.groupbox_rayleigh_criterion.setTitle("Rayleigh criterion")
# # self.groupbox_despiking_signal = QGroupBox()
# # self.groupbox_despiking_signal.setTitle("Despiking the signal")
# # self.verticalLayout_despiking_signal = QVBoxLayout(self.groupbox_despiking_signal)
# # self.horizontalLayout_despiking_signal_label = QHBoxLayout()
#
# # self.gridLayout_rayleigh_criterion = QGridLayout(self.groupbox_rayleigh_criterion)
# self.horizontalLayout_rayleigh_criterion = QHBoxLayout(self.groupbox_rayleigh_criterion)
#
# self.label_Rayleigh_criterion = QLabel()
# self.label_Rayleigh_criterion.setText("<V²>/<V>² <=")
# # self.horizontalLayout_despiking_signal_label.addWidget(self.label_Rayleigh_criterion)
# # self.gridLayout_rayleigh_criterion.addWidget(self.label_Rayleigh_criterion, 0, 0, 1, 1)
# self.horizontalLayout_rayleigh_criterion.addWidget(self.label_Rayleigh_criterion)
# # self.lineEdit_despiking_signal_label = QLineEdit()
# # self.lineEdit_despiking_signal_label.setText("10")
# self.spinbox_rayleigh_criterion = QSpinBox()
# self.spinbox_rayleigh_criterion.setRange(0, 9999)
# self.spinbox_rayleigh_criterion.setValue(10)
# # self.horizontalLayout_despiking_signal_label.addWidget(self.lineEdit_despiking_signal_label)
# # self.gridLayout_rayleigh_criterion.addWidget(self.lineEdit_despiking_signal_label, 0, 1, 1, 1)
# self.horizontalLayout_rayleigh_criterion.addWidget(self.spinbox_rayleigh_criterion)
# self.label_4pi = QLabel()
# self.label_4pi.setText("% x 4/pi")
# # self.horizontalLayout_despiking_signal_label.addWidget(self.label_4pi)
# # self.gridLayout_rayleigh_criterion.addWidget(self.label_4pi, 0, 2, 1, 1)
# self.horizontalLayout_rayleigh_criterion.addWidget(self.label_4pi)
# # self.verticalLayout_despiking_signal.addLayout(self.horizontalLayout_despiking_signal_label)
# # self.pushbutton_despiking_signal = QPushButton()
# # self.pushbutton_despiking_signal.setText("Despiking the signal")
# # self.verticalLayout_despiking_signal.addWidget(self.pushbutton_despiking_signal)
# self.checkbox_despiked_acoustic_signal = QCheckBox()
# # self.checkbox_despiked_acoustic_signal.setText("Despiking")
# self.checkbox_despiked_acoustic_signal.setToolTip("Enable for further computation")
# # self.gridLayout_rayleigh_criterion.addWidget(self.checkbox_rayleigh_criterion_enable, 0, 3, 1, 1)
# self.horizontalLayout_rayleigh_criterion.addWidget(self.checkbox_despiked_acoustic_signal)
# # self.horizontalLayout_averaged_profile_despiking_signal.addWidget(self.groupbox_rayleigh_criterion)
#
# # self.verticalLayout_groupbox_averageprofile_despikingsignal.addWidget(self.groupbox_despiking_signal)
#
# self.verticalLayout_groupbox_post_processing.addWidget(self.groupbox_rayleigh_criterion)
#
# # self.horizontalLayoutMid_signalProcessing.addWidget(self.groupbox_post_processing, 3)
# self.verticalLayout_left_SignalProcessingTab.addWidget(self.groupbox_post_processing)
#
# # self.horizontalLayoutBottom_signalProcessing = QHBoxLayout()
# # self.verticalLayout_signalProcessingTab.addLayout(self.horizontalLayoutBottom_signalProcessing, 3)
#
# # --- GroupBox FCB options ---
#
# self.groupbox_FCBoption = QGroupBox()
# # self.groupbox_FCBoption.setTitle("FCB options")
# # self.horizontalLayoutBottom_signalProcessing.addWidget(self.groupbox_FCBoption, 3)
# self.verticalLayout_left_SignalProcessingTab.addWidget(self.groupbox_FCBoption)
#
# self.verticalLayout_groupbox_FCBoption = QVBoxLayout(self.groupbox_FCBoption)
#
# self.groupbox_water_attenuation = QGroupBox()
# # self.groupbox_water_attenuation.setTitle("Computing water attenuation")
# self.verticalLayout_groupbox_water_attenuation = QVBoxLayout(self.groupbox_water_attenuation)
# self.horizontalLayout_waterAttenuationModel_temperature = QHBoxLayout()
# self.verticalLayout_groupbox_water_attenuation.addLayout(
# self.horizontalLayout_waterAttenuationModel_temperature)
#
# self.combobox_water_attenuation_model = QComboBox()
# self.combobox_water_attenuation_model.addItem("François & Garrison 1982")
# self.combobox_water_attenuation_model.addItem("Other model")
# self.horizontalLayout_waterAttenuationModel_temperature.addWidget(self.combobox_water_attenuation_model)
#
# self.label_temperature_water_attenation = QLabel()
# # self.label_temperature_water_attenation.setText("Temperature:")
# self.horizontalLayout_waterAttenuationModel_temperature.addWidget(self.label_temperature_water_attenation)
#
# # self.lineEdit_temperature_water_attenuation = QLineEdit()
# self.spinbox_temperature_water_attenuation = QSpinBox()
# self.horizontalLayout_waterAttenuationModel_temperature.addWidget(self.spinbox_temperature_water_attenuation)
#
# self.label_degre_celsius = QLabel()
# self.label_degre_celsius.setText("°C")
# self.horizontalLayout_waterAttenuationModel_temperature.addWidget(self.label_degre_celsius)
#
# self.horizontalLayout_comboboxFrequencies_WaterAttenuationValue = QHBoxLayout()
# self.verticalLayout_groupbox_water_attenuation.addLayout(
# self.horizontalLayout_comboboxFrequencies_WaterAttenuationValue)
#
# self.combobox_water_attenuation = QComboBox()
# self.combobox_water_attenuation.addItem('0.3 MHz')
# self.combobox_water_attenuation.addItem('0.5 MHz')
# self.combobox_water_attenuation.addItem('1 MHz')
# self.combobox_water_attenuation.addItem('5 MHz')
# # self.combobox_water_attenuation.currentIndexChanged.connect(self.alpha_value_changed)
#
# self.horizontalLayout_comboboxFrequencies_WaterAttenuationValue.addWidget(self.combobox_water_attenuation)
#
# self.label_water_attenuation = QLabel()
# self.label_water_attenuation.setText("\u03B1w = 0.02 dB/m")
# self.label_water_attenuation.setFont(QFont("Ubuntu", 14, QFont.Normal))
# self.horizontalLayout_comboboxFrequencies_WaterAttenuationValue.addWidget(self.label_water_attenuation)
#
# self.verticalLayout_groupbox_FCBoption.addWidget(self.groupbox_water_attenuation)
#
# self.groupbox_fit_regression_line = QGroupBox()
# # self.groupbox_fit_regression_line.setTitle("Fit regression line")
# self.verticalLayout_groupbox_fit_regression = QVBoxLayout(self.groupbox_fit_regression_line)
#
# self.label_alphaS_expression = QLabel()
# # self.label_alphaS_expression.setText("For homogeneous suspension: dFCB/dr = -2\u03B1<sub>s<\sub>")
# self.verticalLayout_groupbox_fit_regression.addWidget(self.label_alphaS_expression)
#
# self.horizontalLayout_alphaS_computation = QHBoxLayout()
# self.verticalLayout_groupbox_fit_regression.addLayout(self.horizontalLayout_alphaS_computation)
#
# self.combobox_frequency_compute_alphaS = QComboBox()
# self.combobox_frequency_compute_alphaS.addItem("0.3 MHz")
# self.combobox_frequency_compute_alphaS.addItem("0.5 MHz")
# self.combobox_frequency_compute_alphaS.addItem("1 MHz")
# self.combobox_frequency_compute_alphaS.addItem("5 MHz")
# self.combobox_frequency_compute_alphaS.addItem("All frequencies")
# self.horizontalLayout_alphaS_computation.addWidget(self.combobox_frequency_compute_alphaS)
#
# self.label_alphaS_computation_from = QLabel()
# # self.label_alphaS_computation_from.setText("From")
# self.horizontalLayout_alphaS_computation.addWidget(self.label_alphaS_computation_from)
#
# # self.lineEdit_alphaS_computation_from = QLineEdit()
# self.spinbox_alphaS_computation_from = QDoubleSpinBox()
# self.spinbox_alphaS_computation_from.setRange(0, 9999)
# self.horizontalLayout_alphaS_computation.addWidget(self.spinbox_alphaS_computation_from)
#
# self.label_alphaS_computation_to = QLabel()
# # self.label_alphaS_computation_to.setText("to")
# self.horizontalLayout_alphaS_computation.addWidget(self.label_alphaS_computation_to)
#
# # self.lineEdit_alphaS_computation_to = QLineEdit()
# self.spinbox_alphaS_computation_to = QDoubleSpinBox()
# self.horizontalLayout_alphaS_computation.addWidget(self.spinbox_alphaS_computation_to)
#
# self.horizontalLayout_fitButton_alphaWvalue = QHBoxLayout()
# self.verticalLayout_groupbox_fit_regression.addLayout(self.horizontalLayout_fitButton_alphaWvalue)
#
# self.pushbutton_fit_regression_line = QPushButton()
# self.pushbutton_fit_regression_line.setText("Fit && Compute \u03B1s")
# self.horizontalLayout_fitButton_alphaWvalue.addWidget(self.pushbutton_fit_regression_line)
#
# self.label_alphaS = QLabel()
# self.label_alphaS.setText("\u03B1s = " + "0.0" + "dB/m")
# self.label_alphaS.setFont(QFont("Ubuntu", 14, QFont.Normal))
# self.horizontalLayout_fitButton_alphaWvalue.addWidget(self.label_alphaS)
#
# self.verticalLayout_groupbox_FCBoption.addWidget(self.groupbox_fit_regression_line)
#
# # self.verticalLayout_groupbox_fit_regression
#
# ### ---------- Plot Profile ----------
#
# # self.data_test_slider = np.array([[0, 1, 2, 3, 4, 5],
# # [0, 1, 4, 9, 16, 25],
# # [0, 1, 8, 27, 64, 125]])
#
# self.groupbox_plot_profile = QGroupBox()
# # self.groupbox_plot_profile.setTitle("Profile")
#
# self.verticalLayout_plotprofiles = QVBoxLayout(self.groupbox_plot_profile)
# self.figure_profile, self.axis_profile = plt.subplots(nrows=1, ncols=4, layout='constrained')
# self.canvas_profile = FigureCanvas(self.figure_profile)
# # self.toolbar_profile =import NavigationToolBar(self.canvas_profile, self)
# # self.addToolBar(Qt.RightToolBarArea, self.toolbar_profile)
# # self.linear(self.figure_profile, self.axis_profile)
# for i in range(4):
# self.axis_profile[i].plot(self.model.BS_raw_cross_section.V[:, i, 0], self.model.r, c='k')
# # self.axis_profile.plot(self.data_test_slider[0, :], self.data_test_slider[0, :])
#
# self.toolbar_post_processing_tab = NavigationToolBar(self.canvas_profile, self)
# # self.addToolBar(Qt.RightToolBarArea, self.toolbar_post_processing_tab)
#
# # self.label_icon = QLabel()
# # self.label_icon.setPixmap(QPixmap("../icons/smiley1.jpg"))
#
# # self.verticalLayout_plotprofiles.addWidget(self.toolbar_profile)
# self.verticalLayout_plotprofiles.addWidget(self.canvas_profile)
# # self.verticalLayout_plotprofiles.addLayout(self.horizontalLayout_slider_plotprofil)
#
# # # self.verticalLayout_plotprofiles.addWidget(self.label_icon)
# # self.verticalLayout_plotprofiles.addWidget(self.slider_plotprofile)
#
# # self.slider_plotprofile.valueChanged.connect(self.changePlot)
#
# # self.horizontalLayoutTop_signalProcessing.addLayout(self.verticalLayout_plotprofiles, 7)
# # self.horizontalLayoutTop_signalProcessing.addWidget(self.groupbox_plot_profile, 7)
# # self.verticalLayout_right_SignalProcessingTab.addWidget(self.toolbar_profile)
# self.verticalLayout_right_SignalProcessingTab.addWidget(self.groupbox_plot_profile)
#
# ### ---------- Plot averaged profile ----------
#
# self.groupbox_plot_averaged_profile = QGroupBox()
# # self.groupbox_plot_averaged_profile.setTitle("Averaged profile")
#
# self.verticalLayout_averagedprofile = QVBoxLayout(self.groupbox_plot_averaged_profile)
# self.figure_averagedprofile, self.axis_averagedprofile = plt.subplots(nrows=1, ncols=4, layout='constrained')
# self.canvas_averagedprofile = FigureCanvas(self.figure_averagedprofile)
# # self.toolbar_averagedprofile = NavigationToolBar(self.canvas_averagedprofile, self)
# # self.addToolBar(Qt.RightToolBarArea, self.toolbar_averagedprofile)
# # self.toolbar_profile = NavigationToolBar(self.canvas_averagedprofile, self)
# # self.polynome(self.figure_averagedprofile, self.axis_averagedprofile)
# for i in range(4):
# self.axis_averagedprofile[i].plot(self.model.BS_averaged_cross_section.V[:, i, 0], self.model.r, c='b')
#
# self.toolbar_post_processing_tab = NavigationToolBar(self.canvas_averagedprofile, self)
#
# # self.horizontalLayout_slider_averagedprofile = QHBoxLayout()
# #
# # self.pushButton_slider_averagedprofile_right = QPushButton()
# # self.pushButton_slider_averagedprofile_right.setIcon(icon_triangle_right)
# #
# # self.pushButton_slider_averagedprofile_left = QPushButton()
# # self.pushButton_slider_averagedprofile_left.setIcon(icon_triangle_left)
# #
# # self.horizontalLayout_slider_averagedprofile.addWidget(self.pushButton_slider_averagedprofile_left)
# # self.horizontalLayout_slider_averagedprofile.addWidget(self.pushButton_slider_averagedprofile_right)
# #
# # self.lineEdit_slider_averaged_profile = QLineEdit()
# # self.lineEdit_slider_averaged_profile.setFixedWidth(50)
# # self.lineEdit_slider_averaged_profile.setText("1")
# # self.horizontalLayout_slider_averagedprofile.addWidget(self.lineEdit_slider_averaged_profile)
# #
# # self.slider_averagedprofile = QSlider()
# # self.slider_averagedprofile.setOrientation(Qt.Horizontal)
# # self.slider_averagedprofile.setTickPosition(QSlider.TicksBelow)
# # self.slider_averagedprofile.setCursor(Qt.OpenHandCursor)
# # self.slider_averagedprofile.setMinimum(0)
# # self.slider_averagedprofile.setMaximum(1)
# # self.slider_averagedprofile.setTickInterval(1)
# # self.slider_averagedprofile.setValue(0)
# # # self.slider_plotprofile.valueChanged.connect(self.changePlot)
# #
# # self.horizontalLayout_slider_averagedprofile.addWidget(self.slider_averagedprofile)
#
# # self.verticalLayout_averagedprofile.addWidget(self.toolbar_averagedprofile)
# self.verticalLayout_averagedprofile.addWidget(self.canvas_averagedprofile)
# # self.verticalLayout_averagedprofile.addLayout(self.horizontalLayout_slider_averagedprofile)
#
# # self.horizontalLayoutMid_signalProcessing.addLayout(self.verticalLayout_averagedprofile, 7)
# # self.horizontalLayoutMid_signalProcessing.addWidget(self.groupbox_plot_averaged_profile, 7)
# self.verticalLayout_right_SignalProcessingTab.addWidget(self.groupbox_plot_averaged_profile)
#
# ### ---------- Plot FCB profile ----------
#
# self.groupbox_FCB_profile = QGroupBox()
# # self.groupbox_FCB_profile.setTitle("FCB profile")
#
# self.verticalLayout_FCBoptions = QVBoxLayout(self.groupbox_FCB_profile)
# self.figure_FCBoptions, self.axis_FCBoptions = plt.subplots(nrows=1, ncols=4, layout="constrained")
# self.canvas_FCBoptions = FigureCanvas(self.figure_FCBoptions)
# self.toolbar_FCBoptions = NavigationToolBar(self.canvas_FCBoptions, self)
# # self.addToolBar(Qt.LeftToolBarArea, self.toolbar_FCBoptions)
# # self.toolbar_profile = NavigationToolBar(self.canvas_FCBoptions, self)
# # self.cubique(self.figure_FCBoptions, self.axis_FCBoptions)
# for i in range(4):
# self.axis_FCBoptions[i].plot(self.model.FCB[:, i, 0], self.model.r, c='r')
#
# self.toolbar_post_processing_tab = NavigationToolBar(self.canvas_FCBoptions, self)
#
# # self.horizontalLayout_slider_FCBoptions = QHBoxLayout()
# #
# # self.pushButton_slider_FCBoptions_right = QPushButton()
# # self.pushButton_slider_FCBoptions_right.setIcon(icon_triangle_right)
# #
# # self.pushButton_slider_FCBoptions_left = QPushButton()
# # self.pushButton_slider_FCBoptions_left.setIcon(icon_triangle_left)
# #
# # self.horizontalLayout_slider_FCBoptions.addWidget(self.pushButton_slider_FCBoptions_left)
# # self.horizontalLayout_slider_FCBoptions.addWidget(self.pushButton_slider_FCBoptions_right)
# #
# # self.lineEdit_slider_FCBplot = QLineEdit()
# # self.lineEdit_slider_FCBplot.setFixedWidth(50)
# # self.lineEdit_slider_FCBplot.setText("1")
# # self.horizontalLayout_slider_FCBoptions.addWidget(self.lineEdit_slider_FCBplot)
# #
# # self.slider_FCBoptions = QSlider()
# # self.slider_FCBoptions.setOrientation(Qt.Horizontal)
# # self.slider_FCBoptions.setTickPosition(QSlider.TicksBelow)
# # self.slider_FCBoptions.setCursor(Qt.OpenHandCursor)
# # self.slider_FCBoptions.setMinimum(0)
# # self.slider_FCBoptions.setMaximum(1)
# # self.slider_FCBoptions.setTickInterval(1)
# # self.slider_FCBoptions.setValue(0)
# # # self.slider_plotprofile.valueChanged.connect(self.changePlot)
# #
# # self.horizontalLayout_slider_FCBoptions.addWidget(self.slider_FCBoptions)
#
# # self.verticalLayout_FCBoptions.addWidget(self.toolbar_FCBoptions)
# self.verticalLayout_FCBoptions.addWidget(self.canvas_FCBoptions)
# # self.verticalLayout_FCBoptions.addLayout(self.horizontalLayout_slider_FCBoptions)
#
# # self.horizontalLayoutBottom_signalProcessing.addLayout(self.verticalLayout_FCBoptions, 7)
# # self.horizontalLayoutBottom_signalProcessing.addWidget(self.groupbox_FCB_profile, 7)
# self.verticalLayout_right_SignalProcessingTab.addWidget(self.groupbox_FCB_profile)
#
# self.horizontalLayout_slider_plotprofil = QHBoxLayout()
#
# icon_triangle_right = QIcon()
# icon_triangle_right.addPixmap(QPixmap(path_icon + "triangle_right.png"))
# icon_triangle_left = QIcon()
# icon_triangle_left.addPixmap(QPixmap(path_icon + "triangle_left.png"))
#
# self.pushButton_slider_plotprofile_right = QPushButton()
# self.pushButton_slider_plotprofile_right.setIcon(icon_triangle_right)
#
# self.pushButton_slider_plotprofile_right.clicked.connect(self.slide_profile_number_to_right)
#
# self.pushButton_slider_plotprofile_left = QPushButton()
# self.pushButton_slider_plotprofile_left.setIcon(icon_triangle_left)
# # print(self.pushButton_slider_plotprofile_left.size().width())
#
# self.pushButton_slider_plotprofile_left.clicked.connect(self.slide_profile_number_to_left)
#
# self.horizontalLayout_slider_plotprofil.addWidget(self.pushButton_slider_plotprofile_left)
# self.horizontalLayout_slider_plotprofil.addWidget(self.pushButton_slider_plotprofile_right)
#
# self.lineEdit_slider_acoustic_profile = QLineEdit()
# self.lineEdit_slider_acoustic_profile.setText("1")
# # self.lineEdit_slider_acoustic_profile.setFixedWidth(self.pushButton_slider_plotprofile_left.size().width())
# self.lineEdit_slider_acoustic_profile.setFixedWidth(50)
# self.horizontalLayout_slider_plotprofil.addWidget(self.lineEdit_slider_acoustic_profile)
#
# self.lineEdit_slider_acoustic_profile.returnPressed.connect(self.profile_number_on_lineEdit)
#
# self.slider_plotprofile = QSlider()
# self.slider_plotprofile.setOrientation(Qt.Horizontal)
# # self.slider_plotprofile.setTickPosition(QSlider.TicksBelow)
# self.slider_plotprofile.setCursor(Qt.OpenHandCursor)
# self.slider_plotprofile.setMinimum(1)
# self.slider_plotprofile.setMaximum(self.model.BS_averaged_cross_section_corr.V.shape[2])
# self.slider_plotprofile.setTickInterval(1)
# self.slider_plotprofile.setValue(1)
# self.slider_plotprofile.valueChanged.connect(self.changePlot)
#
# self.horizontalLayout_slider_plotprofil.addWidget(self.slider_plotprofile, 9)
#
# self.verticalLayout_right_SignalProcessingTab.addLayout(self.horizontalLayout_slider_plotprofil)
#
# self.retranslate_signal_processing_tab()
#
#
#
# # -------------------- Functions for Signal processing Tab --------------------
#
# def retranslate_signal_processing_tab(self):
#
# self.pushbutton_Load_data_from_acoustic_data_tab.setText(
# _translate("CONSTANT_STRING", cs.LOAD_DATA_FROM_ACOUSTIC_DATA_TAB))
#
# self.groupbox_display_profile_position.setTitle(_translate("CONSTANT_STRING", cs.DISPLAY_PROFILE_POSITION))
# self.label_profile_number.setText(_translate("CONSTANT_STRING", cs.PROFILE_NUMBER) + " " +
# str(self.string_profile_number) + " / " + str(self.string_profile_number_max))
#
# self.groupbox_post_processing.setTitle(_translate("CONSTANT_STRING", cs.POST_PROCESSING))
#
# self.groupbox_acoustic_profile.setTitle(_translate("CONSTANT_STRING", cs.ACOUSTIC_PROFILE))
# self.checkbox_substract_noise.setText(_translate("CONSTANT_STRING", cs.SUBTRACT_THE_NOISE))
# self.checkbox_SNR_criterion.setText(_translate("CONSTANT_STRING", cs.SNR_CRITERION))
#
# self.groupbox_window_size.setTitle(_translate("CONSTANT_STRING", cs.WINDOW_SIZE))
# self.checkbox_nb_horizontal_cells.setText(_translate("CONSTANT_STRING", cs.HORIZONTAL) + ": +/-")
# self.label_nb_horizontal_cells_cm.setText(_translate("CONSTANT_STRING", cs.CELLS) + " = +/- ? cm")
# self.checkbox_nb_vertical_cells.setText(_translate("CONSTANT_STRING", cs.VERTICAL) + ": +/-")
# self.label_nb_vertical_cells_cm.setText(_translate("CONSTANT_STRING", cs.CELLS) + " = +/- ? cm")
#
# self.groupbox_rayleigh_criterion.setTitle(_translate("CONSTANT_STRING", cs.RAYLEIGH_CRITERION))
# self.checkbox_despiked_acoustic_signal.setText(_translate("CONSTANT_STRING", cs.DESPIKING))
#
# self.groupbox_FCBoption.setTitle(_translate("CONSTANT_STRING", cs.FCB_OPTIONS))
#
# self.groupbox_water_attenuation.setTitle(_translate("CONSTANT_STRING", cs.COMPUTING_WATER_ATTENUATION))
# self.label_temperature_water_attenation.setText(_translate("CONSTANT_STRING", cs.TEMPERATURE) + ":")
#
# self.groupbox_fit_regression_line.setTitle(_translate("CONSTANT_STRING", cs.FIT_REGRESSION_LINE))
# self.label_alphaS_expression.setText(
# _translate("CONSTANT_STRING", cs.FOR_HOMOGENEOUS_SUSPENSION) + ": dFCB/dr = -2\u03B1<sub>s<\sub>")
# self.label_alphaS_computation_from.setText(_translate("CONSTANT_STRING", cs.FROM))
# self.label_alphaS_computation_to.setText(_translate("CONSTANT_STRING", cs.TO))
#
# self.groupbox_plot_profile.setTitle(_translate("CONSTANT_STRING", cs.PROFILE))
# self.groupbox_plot_averaged_profile.setTitle(_translate("CONSTANT_STRING", cs.AVERAGED_PROFILE))
# self.groupbox_FCB_profile.setTitle(_translate("CONSTANT_STRING", cs.FCB_PROFILE))
#
#
# def plot_transect_bottom_with_profile_position(self, profile_position):
# frequency = self.model.Freq[0]
# val_min = 0 # np.nanmin(self.model.BS_averaged_cross_section_corr.V[:, 0, :])
# val_max = np.nanmax(self.model.BS_averaged_cross_section_corr.V[:, 0, :])
# # print('val_min=', val_min)
# # print('val_max=', val_max)
# if val_min == 0:
# val_min = 1e-5
# # print('val_min update=', val_min)
# # if val_min == 0:
# # val_min = 1e-5
# # self.axis_plot_profile_position_on_transect.imshow(np.asarray(np.array(self.model.V[:, 0, :2300], dtype=float)), aspect='auto',
# # extent=[0, 2300, self.model.depth[-1][0], self.model.depth[0][0]],
# # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
# self.axis_plot_profile_position_on_transect.cla()
# # self.figure_plot_profile_position_on_transect.clf()
# self.axis_plot_profile_position_on_transect.pcolormesh(self.model.dist_BS_section,
# np.flipud(self.model.BS_raw_cross_section.r),
# self.model.BS_averaged_cross_section_corr.V[:, 0,
# :],
# cmap='viridis',
# norm=LogNorm(vmin=val_min, vmax=val_max),
# shading='gouraud')
# self.axis_plot_profile_position_on_transect.plot(self.model.dist_BS_section,
# np.max(self.model.r_bottom_cross_section) -
# self.model.r_bottom_cross_section +
# np.min(self.model.r_bottom_cross_section),
# color='k', linewidth=2)
# self.axis_plot_profile_position_on_transect.plot(
# self.model.dist_BS_section[profile_position] * np.ones(self.model.r_bottom_cross_section.shape[0]),
# self.model.r_bottom_cross_section, color='red', linestyle="solid", linewidth=2)
# self.axis_plot_profile_position_on_transect.set_xticks([])
# self.axis_plot_profile_position_on_transect.set_yticks([])
# self.figure_plot_profile_position_on_transect.canvas.draw_idle()
#
#
# def changePlot(self):
# value = self.slider_plotprofile.value()
#
# self.string_profile_number = value
# self.label_profile_number.setText("Profile " + str(value) +
# " / " + str(self.string_profile_number_max))
#
# self.plot_transect_bottom_with_profile_position(value)
#
# self.lineEdit_slider_acoustic_profile.setText(str(value))
#
# for i in range(4):
# self.axis_profile[i].cla()
# self.axis_profile[i].plot(self.model.BS_raw_cross_section.V[:, i, value-1], self.model.r, c='k')
#
# self.axis_averagedprofile[i].cla()
# self.axis_averagedprofile[i].plot(self.model.BS_averaged_cross_section.V[:, i, value-1], self.model.r, c='b')
#
# self.axis_FCBoptions[i].cla()
# self.axis_FCBoptions[i].plot(self.model.FCB[:, i, value-1], self.model.r, c='r')
# # self.axis_profile.plot(self.data_test_slider[0, :], self.data_test_slider[value-1, :])
#
# self.figure_profile.canvas.draw_idle()
# # self.figure_profile.canvas.flush_events()
# self.figure_averagedprofile.canvas.draw_idle()
# # self.figure_averagedprofile.canvas.flush_events()
# self.figure_FCBoptions.canvas.draw_idle()
# # self.figure_FCBoptions.canvas.flush_events()
#
# def profile_number_on_lineEdit(self):
# self.slider_plotprofile.setValue(int(self.lineEdit_slider_acoustic_profile.text()))
# print("profile number = ", self.lineEdit_slider_acoustic_profile.text())
#
# def slide_profile_number_to_right(self):
# self.slider_plotprofile.setValue(int(self.slider_plotprofile.value()) + 1)
#
# def slide_profile_number_to_left(self):
# self.slider_plotprofile.setValue(int(self.slider_plotprofile.value()) - 1)
#
# def linear(self, figure, axis, i):
# # for i in range(4):
# # axis[i].plot([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], '*-')
# # figure.tight_layout()
# for i in range(4):
# axis[i].plot(self.model.BS_raw_cross_section.V[:, i, 800], self.model.r, c='k')
#
# def polynome(self, figure, axis):
# # for i in range(4):
# # axis[i].plot([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100], '*-')
# # figure.tight_layout()
# for i in range(4):
# axis[i].plot(self.model.BS_averaged_cross_section.V[:, i, 800], self.model.r, c='b')
#
# def cubique(self, figure, axis):
# # for i in range(4):
# # axis[i].plot([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000], '*-')
# # figure.tight_layout()
# for i in range(4):
# axis[i].plot(self.model.FCB[:, i, 800], self.model.r, c='r')
#
#