diff --git a/View/sediment_calibration_tab.py b/View/sediment_calibration_tab.py index eba470b..6061be9 100644 --- a/View/sediment_calibration_tab.py +++ b/View/sediment_calibration_tab.py @@ -20,11 +20,15 @@ # -*- coding: utf-8 -*- +import os import matplotlib.pyplot as plt import pandas as pd -from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout, QGroupBox, QComboBox, - QGridLayout, QLabel, QPushButton, QSlider, QLineEdit, QFileDialog, QMessageBox, QFrame) +from PyQt5.QtWidgets import ( + QWidget, QVBoxLayout, QHBoxLayout, QGroupBox, QComboBox, + QGridLayout, QLabel, QPushButton, QSlider, QLineEdit, + QFileDialog, QMessageBox, QFrame +) from PyQt5.QtCore import Qt, QPropertyAnimation, QSize from PyQt5.QtGui import QIcon, QPixmap, QFont @@ -39,8 +43,6 @@ from matplotlib.colors import LogNorm from scipy.stats import linregress -from os import path - from View.checkable_combobox import CheckableComboBox from Model.acoustic_inversion_method_high_concentration import AcousticInversionMethodHighConcentration @@ -53,40 +55,59 @@ class SedimentCalibrationTab(QWidget): def __init__(self, widget_tab): super().__init__() - self.path_icon = "./icons/" - self.icon_folder = QIcon(self.path_icon + "folder.png") - self.icon_triangle_left = QIcon(self.path_icon + "triangle_left.png") - self.icon_triangle_left_to_begin = QIcon(self.path_icon + "triangle_left_to_begin.png") - self.icon_triangle_right = QIcon(self.path_icon + "triangle_right.png") - self.icon_triangle_right_to_end = QIcon(self.path_icon + "triangle_right_to_end.png") - self.icon_update = QIcon(self.path_icon + "update.png") - self.icon_approved = QIcon(self.path_icon + "approved.png") - self.icon_no_approved = QIcon(self.path_icon + "no_approved.png") - + self._widget_tab = widget_tab self.inv_hc = AcousticInversionMethodHighConcentration() - ### --- General layout of widgets --- + self._setup_icons() + self._setup_widgets() - self.verticalLayoutMain = QVBoxLayout(widget_tab) + def _path_icon(self, icon): + return os.path.join("icons", icon) + def _setup_icons(self): + self.icon_folder = QIcon(self._path_icon("folder.png")) + self.icon_triangle_left = QIcon(self._path_icon("triangle_left.png")) + self.icon_triangle_left_to_begin = QIcon( + self._path_icon("triangle_left_to_begin.png") + ) + self.icon_triangle_right = QIcon( + self._path_icon("triangle_right.png") + ) + self.icon_triangle_right_to_end = QIcon( + self._path_icon("triangle_right_to_end.png") + ) + self.icon_update = QIcon(self._path_icon("update.png")) + self.icon_approved = QIcon(self._path_icon("approved.png")) + self.icon_no_approved = QIcon(self._path_icon("no_approved.png")) + + + def _setup_widgets(self): + self.verticalLayoutMain = QVBoxLayout(self._widget_tab) + + # 1O units is 100% , 1 units is 10% self.horizontalLayoutTop = QHBoxLayout() - self.verticalLayoutMain.addLayout(self.horizontalLayoutTop, 5) # 1O units is 100% , 1 units is 10% + self.verticalLayoutMain.addLayout(self.horizontalLayoutTop, 5) self.horizontalLayoutBottom = QHBoxLayout() self.verticalLayoutMain.addLayout(self.horizontalLayoutBottom, 5) - # -------------------------------------------------------------------------------------------------------------- - self.groupbox_acoustic_data = QGroupBox() self.horizontalLayoutTop.addWidget(self.groupbox_acoustic_data, 6) self.groupbox_Mfine_profile = QGroupBox() self.horizontalLayoutTop.addWidget(self.groupbox_Mfine_profile, 4) - # ++++++++++++++++++++++++++++++ - # +++ Groupbox acoustic data +++ + self._setup_widgets_acoustic_data() + self._setup_widgets_concentration() + self._setup_widgets_calibration() + self._setup_widgets_fcb() - self.groupbox_acoustic_data.setTitle("Step 1 : acoustic and sample data choice") + self._setup_connections() + + def _setup_widgets_acoustic_data(self): + self.groupbox_acoustic_data.setTitle( + "Step 1 : acoustic and sample data choice" + ) self.horizontalLayout_groupbox_acoustic_data = QHBoxLayout(self.groupbox_acoustic_data) @@ -96,73 +117,115 @@ class SedimentCalibrationTab(QWidget): self.groupbox_data_plot = QGroupBox() self.horizontalLayout_groupbox_acoustic_data.addWidget(self.groupbox_data_plot, 7) - # --- Groupbox data choice --- self.verticalLayout_groupbox_data_choice = QVBoxLayout(self.groupbox_data_choice) - # -------------------------------------------- + self._setup_widgets_acoustic_data_1() + self._setup_widgets_acoustic_data_2() + self._setup_widgets_acoustic_data_3() + self._setup_widgets_acoustic_data_plot() + + def _setup_widgets_acoustic_data_1(self): self.groupbox_acoustic_recording = QGroupBox() self.groupbox_acoustic_recording.setTitle("➊") - self.verticalLayout_groupbox_data_choice.addWidget(self.groupbox_acoustic_recording) + self.verticalLayout_groupbox_data_choice.addWidget( + self.groupbox_acoustic_recording + ) - self.gridLayout_groupbox_acoustic_recording = QGridLayout(self.groupbox_acoustic_recording) + self.gridLayout_groupbox_acoustic_recording = QGridLayout( + self.groupbox_acoustic_recording + ) self.pushbutton_update_acoustic_file = QPushButton() self.pushbutton_update_acoustic_file.setIcon(self.icon_update) - self.gridLayout_groupbox_acoustic_recording.addWidget(self.pushbutton_update_acoustic_file, 0, 0, 1, 2) + self.gridLayout_groupbox_acoustic_recording.addWidget( + self.pushbutton_update_acoustic_file, 0, 0, 1, 2 + ) self.label_acoustic_data_choice = QLabel() self.label_acoustic_data_choice.setText("Acoustic data") - self.gridLayout_groupbox_acoustic_recording.addWidget(self.label_acoustic_data_choice, 1, 0, 1, 1) + self.gridLayout_groupbox_acoustic_recording.addWidget( + self.label_acoustic_data_choice, 1, 0, 1, 1 + ) self.combobox_acoustic_data_choice = QComboBox() - self.gridLayout_groupbox_acoustic_recording.addWidget(self.combobox_acoustic_data_choice, 1, 1, 1, 1) + self.gridLayout_groupbox_acoustic_recording.addWidget( + self.combobox_acoustic_data_choice, 1, 1, 1, 1 + ) - # -------------------------------------------- + def _setup_widgets_acoustic_data_2(self): self.groupbox_frequency = QGroupBox() self.groupbox_frequency.setTitle("➋") - self.verticalLayout_groupbox_data_choice.addWidget(self.groupbox_frequency) + self.verticalLayout_groupbox_data_choice.addWidget( + self.groupbox_frequency + ) - self.gridLayout_groupbox_frequency = QGridLayout(self.groupbox_frequency) + self.gridLayout_groupbox_frequency = QGridLayout( + self.groupbox_frequency + ) self.label_freq1_choice = QLabel() self.label_freq1_choice.setText("Frequency 1") - self.gridLayout_groupbox_frequency.addWidget(self.label_freq1_choice, 0, 0, 1, 1) + self.gridLayout_groupbox_frequency.addWidget( + self.label_freq1_choice, 0, 0, 1, 1 + ) self.combobox_freq1 = QComboBox() - self.gridLayout_groupbox_frequency.addWidget(self.combobox_freq1, 0, 1, 1, 1) + self.gridLayout_groupbox_frequency.addWidget( + self.combobox_freq1, 0, 1, 1, 1 + ) self.label_freq2_choice = QLabel() self.label_freq2_choice.setText("Frequency 2") - self.gridLayout_groupbox_frequency.addWidget(self.label_freq2_choice, 1, 0, 1, 1) + self.gridLayout_groupbox_frequency.addWidget( + self.label_freq2_choice, 1, 0, 1, 1 + ) self.combobox_freq2 = QComboBox() - self.gridLayout_groupbox_frequency.addWidget(self.combobox_freq2, 1, 1, 1, 1) + self.gridLayout_groupbox_frequency.addWidget( + self.combobox_freq2, 1, 1, 1, 1 + ) - # -------------------------------------------- + def _setup_widgets_acoustic_data_3(self): self.groupbox_sample = QGroupBox() self.groupbox_sample.setTitle("➌") - self.verticalLayout_groupbox_data_choice.addWidget(self.groupbox_sample) + self.verticalLayout_groupbox_data_choice.addWidget( + self.groupbox_sample + ) - self.gridLayout_groupbox_sample = QGridLayout(self.groupbox_sample) + self.gridLayout_groupbox_sample = QGridLayout( + self.groupbox_sample + ) self.label_fine_profile = QLabel() self.label_fine_profile.setText("Fine profile") - self.gridLayout_groupbox_sample.addWidget(self.label_fine_profile, 0, 0, 1, 1) + self.gridLayout_groupbox_sample.addWidget( + self.label_fine_profile, 0, 0, 1, 1 + ) self.combobox_fine_sample_choice = CheckableComboBox() - self.gridLayout_groupbox_sample.addWidget(self.combobox_fine_sample_choice, 0, 1, 1, 1) + self.gridLayout_groupbox_sample.addWidget( + self.combobox_fine_sample_choice, 0, 1, 1, 1 + ) self.label_sand_target = QLabel() self.label_sand_target.setText("Sand target") - self.gridLayout_groupbox_sample.addWidget(self.label_sand_target, 1, 0, 1, 1) + self.gridLayout_groupbox_sample.addWidget( + self.label_sand_target, 1, 0, 1, 1 + ) self.combobox_sand_sample_choice = QComboBox() - self.gridLayout_groupbox_sample.addWidget(self.combobox_sand_sample_choice, 1, 1, 1, 1) + self.gridLayout_groupbox_sample.addWidget( + self.combobox_sand_sample_choice, 1, 1, 1, 1 + ) self.pushbutton_plot_sample = QPushButton() self.pushbutton_plot_sample.setText("Plot sample") - self.gridLayout_groupbox_sample.addWidget(self.pushbutton_plot_sample, 2, 0, 1, 2) + self.gridLayout_groupbox_sample.addWidget( + self.pushbutton_plot_sample, 2, 0, 1, 2 + ) - # --- Groupbox data plot --- - self.verticalLayout_groupbox_data_plot = QVBoxLayout(self.groupbox_data_plot) + def _setup_widgets_acoustic_data_plot(self): + self.verticalLayout_groupbox_data_plot = QVBoxLayout( + self.groupbox_data_plot + ) self.canvas_BS = FigureCanvas() self.toolbar_BS = NavigationToolBar(self.canvas_BS, self) @@ -171,318 +234,436 @@ class SedimentCalibrationTab(QWidget): self.verticalLayout_groupbox_data_plot.addWidget(self.toolbar_BS) self.verticalLayout_groupbox_data_plot.addWidget(self.canvas_BS) - # -------------------------------------------------------------------------------------------------------------- - # +++++++++++++++++++++++++++++++++++++++++++ - # +++ Groupbox Fine concentration profile +++ - - self.groupbox_Mfine_profile.setTitle("Step 2 : profile of the fine sediment concentration") - self.horizontalLayout_groupbox_Mfine_profile = QHBoxLayout(self.groupbox_Mfine_profile) + def _setup_widgets_concentration(self): + self.groupbox_Mfine_profile.setTitle( + "Step 2 : profile of the fine sediment concentration" + ) + self.horizontalLayout_groupbox_Mfine_profile = QHBoxLayout( + self.groupbox_Mfine_profile + ) self.groupbox_interpolate_info = QGroupBox() - self.horizontalLayout_groupbox_Mfine_profile.addWidget(self.groupbox_interpolate_info, 4) + self.horizontalLayout_groupbox_Mfine_profile.addWidget( + self.groupbox_interpolate_info, 4 + ) self.groupbox_interpolate_plot = QGroupBox() - self.horizontalLayout_groupbox_Mfine_profile.addWidget(self.groupbox_interpolate_plot, 6) + self.horizontalLayout_groupbox_Mfine_profile.addWidget( + self.groupbox_interpolate_plot, 6 + ) - # --- Groupbox interpolate info --- - self.gridLayout_groupbox_interpolate_info = QGridLayout(self.groupbox_interpolate_info) + self._setup_widgets_concentration_interpolate() + self._setup_widgets_concentration_interpolate_plot() + + def _setup_widgets_concentration_interpolate(self): + self.gridLayout_groupbox_interpolate_info = QGridLayout( + self.groupbox_interpolate_info + ) self.pushbutton_interpolate_Mfine_profile = QPushButton() self.pushbutton_interpolate_Mfine_profile.setText("Interpolate") - self.gridLayout_groupbox_interpolate_info.addWidget(self.pushbutton_interpolate_Mfine_profile, 0, 0, 1, 4, Qt.AlignCenter) + self.gridLayout_groupbox_interpolate_info.addWidget( + self.pushbutton_interpolate_Mfine_profile, 0, 0, 1, 4, + Qt.AlignCenter + ) self.label_sample_fine = QLabel() self.label_sample_fine.setText("Sample") - self.gridLayout_groupbox_interpolate_info.addWidget(self.label_sample_fine, 1, 0, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_interpolate_info.addWidget( + self.label_sample_fine, 1, 0, 1, 1, Qt.AlignCenter + ) self.label_depth_fine = QLabel() self.label_depth_fine.setText("Depth (m)") - self.gridLayout_groupbox_interpolate_info.addWidget(self.label_depth_fine, 1, 1, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_interpolate_info.addWidget( + self.label_depth_fine, 1, 1, 1, 1, Qt.AlignCenter + ) self.label_time_fine = QLabel() self.label_time_fine.setText("time") - self.gridLayout_groupbox_interpolate_info.addWidget(self.label_time_fine, 1, 2, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_interpolate_info.addWidget( + self.label_time_fine, 1, 2, 1, 1, Qt.AlignCenter + ) self.label_concentration_fine = QLabel() self.label_concentration_fine.setText("Cfine (g/L)") - self.gridLayout_groupbox_interpolate_info.addWidget(self.label_concentration_fine, 1, 3, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_interpolate_info.addWidget( + self.label_concentration_fine, 1, 3, 1, 1, Qt.AlignCenter + ) self.double_horizontal_line = QFrame() self.double_horizontal_line.setFrameShape(QFrame.HLine) self.double_horizontal_line.setFrameShadow(QFrame.Sunken) self.double_horizontal_line.setLineWidth(1) self.double_horizontal_line.setMidLineWidth(3) - self.gridLayout_groupbox_interpolate_info.addWidget(self.double_horizontal_line, 4, 0, 1, 4, Qt.AlignCenter) + self.gridLayout_groupbox_interpolate_info.addWidget( + self.double_horizontal_line, 4, 0, 1, 4, Qt.AlignCenter + ) self.label_sample_sand = QLabel() self.label_sample_sand.setText("Sample") - self.gridLayout_groupbox_interpolate_info.addWidget(self.label_sample_sand, 5, 0, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_interpolate_info.addWidget( + self.label_sample_sand, 5, 0, 1, 1, Qt.AlignCenter + ) self.label_depth_sand = QLabel() self.label_depth_sand.setText("Depth (m)") - self.gridLayout_groupbox_interpolate_info.addWidget(self.label_depth_sand, 5, 1, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_interpolate_info.addWidget( + self.label_depth_sand, 5, 1, 1, 1, Qt.AlignCenter + ) self.label_time_sand = QLabel() self.label_time_sand.setText("time") - self.gridLayout_groupbox_interpolate_info.addWidget(self.label_time_sand, 5, 2, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_interpolate_info.addWidget( + self.label_time_sand, 5, 2, 1, 1, Qt.AlignCenter + ) self.label_concentration_sand = QLabel() self.label_concentration_sand.setText("Csand (g/L)") - self.gridLayout_groupbox_interpolate_info.addWidget(self.label_concentration_sand, 5, 3, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_interpolate_info.addWidget( + self.label_concentration_sand, 5, 3, 1, 1, Qt.AlignCenter + ) - # --- Groupbox interpolate plot --- - self.verticalLayout_groupbox_interpolate_plot = QVBoxLayout(self.groupbox_interpolate_plot) + def _setup_widgets_concentration_interpolate_plot(self): + self.verticalLayout_groupbox_interpolate_plot = QVBoxLayout( + self.groupbox_interpolate_plot + ) self.canvas_Mfine = FigureCanvas() self.toolbar_Mfine = NavigationToolBar(self.canvas_Mfine, self) - self.verticalLayout_groupbox_interpolate_plot.addWidget(self.toolbar_Mfine) - self.verticalLayout_groupbox_interpolate_plot.addWidget(self.canvas_Mfine) + self.verticalLayout_groupbox_interpolate_plot\ + .addWidget(self.toolbar_Mfine) + self.verticalLayout_groupbox_interpolate_plot\ + .addWidget(self.canvas_Mfine) - # -------------------------------------------------------------------------------------------------------------- + + def _setup_widgets_calibration(self): self.groupbox_sediment_calibration = QGroupBox() self.horizontalLayoutBottom.addWidget(self.groupbox_sediment_calibration, 4) self.groupbox_FCB = QGroupBox() self.horizontalLayoutBottom.addWidget(self.groupbox_FCB, 6) - # +++++++++++++++++++++++++++++++++++++ - # +++ Groupbox sediment calibration +++ - self.groupbox_sediment_calibration.setTitle("Step 3 : Compute Calibration") self.verticalLayout_groupbox_sediment_calibration = QVBoxLayout(self.groupbox_sediment_calibration) self.horizontalLayout_groupboxes_Import_Compute_Calibration = QHBoxLayout() self.verticalLayout_groupbox_sediment_calibration.addLayout(self.horizontalLayout_groupboxes_Import_Compute_Calibration) - # --- Groupbox import calibration file --- + self._setup_widgets_calibration_import_file() + self._setup_widgets_calibration_compute() + self._setup_widgets_calibration_parameters() + + def _setup_widgets_calibration_import_file(self): self.groupbox_sediment_calibration_import = QGroupBox() - self.groupbox_sediment_calibration_import.setTitle("Import sediment calibration file") + self.groupbox_sediment_calibration_import.setTitle( + "Import sediment calibration file" + ) self.groupbox_sediment_calibration_import.setCheckable(True) self.groupbox_sediment_calibration_import.setChecked(True) - self.horizontalLayout_groupboxes_Import_Compute_Calibration.addWidget(self.groupbox_sediment_calibration_import) + self.horizontalLayout_groupboxes_Import_Compute_Calibration.addWidget( + self.groupbox_sediment_calibration_import + ) - self.gridLayout_groupbox_sediment_calibration_import = QGridLayout(self.groupbox_sediment_calibration_import) + self.gridLayout_groupbox_sediment_calibration_import = QGridLayout( + self.groupbox_sediment_calibration_import + ) self.pushbutton_import_calibration = QPushButton() self.pushbutton_import_calibration.setText('Import calibration') - self.gridLayout_groupbox_sediment_calibration_import.addWidget(self.pushbutton_import_calibration, 0, 0, 1, 1) + self.gridLayout_groupbox_sediment_calibration_import.addWidget( + self.pushbutton_import_calibration, 0, 0, 1, 1 + ) self.lineEdit_import_calibration = QLineEdit() - self.gridLayout_groupbox_sediment_calibration_import.addWidget(self.lineEdit_import_calibration, 0, 1, 1, 2) + self.gridLayout_groupbox_sediment_calibration_import.addWidget( + self.lineEdit_import_calibration, 0, 1, 1, 2 + ) - # --- Compute calibration --- + def _setup_widgets_calibration_compute(self): self.groupbox_sediment_calibration_compute = QGroupBox() - self.groupbox_sediment_calibration_compute.setTitle("Compute sediment calibration") + self.groupbox_sediment_calibration_compute.setTitle( + "Compute sediment calibration" + ) self.groupbox_sediment_calibration_compute.setCheckable(True) self.groupbox_sediment_calibration_compute.setChecked(False) - self.horizontalLayout_groupboxes_Import_Compute_Calibration.addWidget(self.groupbox_sediment_calibration_compute) + self.horizontalLayout_groupboxes_Import_Compute_Calibration\ + .addWidget(self.groupbox_sediment_calibration_compute) - self.gridLayout_groupbox_sediment_calibration_compute = QGridLayout(self.groupbox_sediment_calibration_compute) + self.gridLayout_groupbox_sediment_calibration_compute = QGridLayout( + self.groupbox_sediment_calibration_compute + ) self.pushbutton_compute_calibration = QPushButton() - self.pushbutton_compute_calibration.setText("Compute Calibration") - self.pushbutton_compute_calibration.setToolTip("Calibration is computed at abscissa 'sand target'") - self.gridLayout_groupbox_sediment_calibration_compute.addWidget(self.pushbutton_compute_calibration, 0, 0, 1, 3) + self.pushbutton_compute_calibration.setText( + "Compute Calibration" + ) + self.pushbutton_compute_calibration.setToolTip( + "Calibration is computed at abscissa 'sand target'" + ) + self.gridLayout_groupbox_sediment_calibration_compute\ + .addWidget(self.pushbutton_compute_calibration, 0, 0, 1, 3) - # --- Calibration parameter --- + + def _setup_widgets_calibration_parameters(self): self.groupbox_sediment_calibration_parameter = QGroupBox() - self.gridLayout_groupbox_sediment_calibration_parameter = QGridLayout(self.groupbox_sediment_calibration_parameter) + self.gridLayout_groupbox_sediment_calibration_parameter = \ + QGridLayout(self.groupbox_sediment_calibration_parameter) - self.verticalLayout_groupbox_sediment_calibration.addWidget(self.groupbox_sediment_calibration_parameter) + self.verticalLayout_groupbox_sediment_calibration\ + .addWidget(self.groupbox_sediment_calibration_parameter) self.label_temperature = QLabel() self.label_temperature.setText("T = 0.00 °C") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_temperature, 0, 0, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_temperature, 0, 0, 1, 1) self.label_freq1 = QLabel("Frequency 1") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_freq1, 1, 1, 1, 2, Qt.AlignCenter) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_freq1, 1, 1, 1, 2, Qt.AlignCenter) self.label_freq2 = QLabel("Frequency 2") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_freq2, 1, 3, 1, 2, Qt.AlignCenter) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_freq2, 1, 3, 1, 2, Qt.AlignCenter) self.label_kt = QLabel() self.label_kt.setText("kt") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_kt, 2, 0, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_kt, 2, 0, 1, 1, Qt.AlignCenter) self.label_kt_freq1 = QLabel() self.label_kt_freq1.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_kt_freq1, 2, 1, 1, 1, Qt.AlignRight) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_kt_freq1, 2, 1, 1, 1, Qt.AlignRight) self.label_kt_freq1_unit = QLabel() self.label_kt_freq1_unit.setText("V.m1.5") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_kt_freq1_unit, 2, 2, 1, 1, - Qt.AlignLeft) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_kt_freq1_unit, 2, 2, 1, 1, Qt.AlignLeft) self.label_kt_freq2 = QLabel() self.label_kt_freq2.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_kt_freq2, 2, 3, 1, 1, Qt.AlignRight) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_kt_freq2, 2, 3, 1, 1, Qt.AlignRight) self.label_kt_freq2_unit = QLabel() self.label_kt_freq2_unit.setText("V.m1.5") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_kt_freq2_unit, 2, 4, 1, 1, - Qt.AlignLeft) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_kt_freq2_unit, 2, 4, 1, 1, Qt.AlignLeft) self.horizontalLine = QFrame() self.horizontalLine.setFrameShape(QFrame.HLine) self.horizontalLine.setFrameShadow(QFrame.Sunken) self.horizontalLine.setLineWidth(1) self.horizontalLine.setMidLineWidth(0) - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.horizontalLine, 3, 0, 1, 6) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.horizontalLine, 3, 0, 1, 6) self.label_ks = QLabel() self.label_ks.setText("ks") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_ks, 4, 0, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_ks, 4, 0, 1, 1, Qt.AlignCenter) self.lineEdit_ks_freq1 = QLineEdit() self.lineEdit_ks_freq1.setMaximumWidth(100) self.lineEdit_ks_freq1.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_ks_freq1, 4, 1, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.lineEdit_ks_freq1, 4, 1, 1, 1) self.label_ks_freq1_unit = QLabel() self.label_ks_freq1_unit.setText("m.kg-0.5") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_ks_freq1_unit, 4, 2, 1, 1, - Qt.AlignLeft) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_ks_freq1_unit, 4, 2, 1, 1, Qt.AlignLeft) self.lineEdit_ks_freq2 = QLineEdit() self.lineEdit_ks_freq2.setMaximumWidth(100) self.lineEdit_ks_freq2.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_ks_freq2, 4, 3, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.lineEdit_ks_freq2, 4, 3, 1, 1) self.label_ks_freq2_unit = QLabel() self.label_ks_freq2_unit.setText("m.kg-0.5") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_ks_freq2_unit, 4, 4, 1, 1, - Qt.AlignLeft) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_ks_freq2_unit, 4, 4, 1, 1, Qt.AlignLeft) self.label_sv = QLabel() self.label_sv.setText("sv") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_sv, 5, 0, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_sv, 5, 0, 1, 1, Qt.AlignCenter) self.lineEdit_sv_freq1 = QLineEdit() self.lineEdit_sv_freq1.setMaximumWidth(100) self.lineEdit_sv_freq1.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_sv_freq1, 5, 1, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.lineEdit_sv_freq1, 5, 1, 1, 1) self.label_sv_freq1_unit = QLabel() self.label_sv_freq1_unit.setText("m-1") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_sv_freq1_unit, 5, 2, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_sv_freq1_unit, 5, 2, 1, 1) self.lineEdit_sv_freq2 = QLineEdit() self.lineEdit_sv_freq2.setMaximumWidth(100) self.lineEdit_sv_freq2.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_sv_freq2, 5, 3, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.lineEdit_sv_freq2, 5, 3, 1, 1) self.label_sv_freq2_unit = QLabel() self.label_sv_freq2_unit.setText("m-1") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_sv_freq2_unit, 5, 4, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_sv_freq2_unit, 5, 4, 1, 1) self.label_X = QLabel() self.label_X.setText("X") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_X, 6, 0, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_X, 6, 0, 1, 1, Qt.AlignCenter) self.lineEdit_X = QLineEdit() self.lineEdit_X.setMaximumWidth(100) self.lineEdit_X.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_X, 6, 2, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.lineEdit_X, 6, 2, 1, 1, Qt.AlignCenter) self.label_alphas = QLabel() self.label_alphas.setText("\u03B1s") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_alphas, 7, 0, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_alphas, 7, 0, 1, 1, Qt.AlignCenter) self.lineEdit_alphas_freq1 = QLineEdit() self.lineEdit_alphas_freq1.setMaximumWidth(100) self.lineEdit_alphas_freq1.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_alphas_freq1, 7, 1, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.lineEdit_alphas_freq1, 7, 1, 1, 1) self.label_alphas_freq1_unit = QLabel() self.label_alphas_freq1_unit.setText("m-1") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_alphas_freq1_unit, 7, 2, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_alphas_freq1_unit, 7, 2, 1, 1, Qt.AlignLeft) self.lineEdit_alphas_freq2 = QLineEdit() self.lineEdit_alphas_freq2.setMaximumWidth(100) self.lineEdit_alphas_freq2.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_alphas_freq2, 7, 3, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.lineEdit_alphas_freq2, 7, 3, 1, 1) self.label_alphas_freq2_unit = QLabel() self.label_alphas_freq2_unit.setText("m-1") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_alphas_freq2_unit, 7, 4, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_alphas_freq2_unit, 7, 4, 1, 1, Qt.AlignLeft) self.label_zeta = QLabel() self.label_zeta.setText("\u03B6") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_zeta, 8, 0, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_zeta, 8, 0, 1, 1, Qt.AlignCenter) self.lineEdit_zeta_freq1 = QLineEdit() self.lineEdit_zeta_freq1.setMaximumWidth(100) self.lineEdit_zeta_freq1.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_zeta_freq1, 8, 1, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.lineEdit_zeta_freq1, 8, 1, 1, 1) self.label_zeta_freq1_unit = QLabel() self.label_zeta_freq1_unit.setText("m-1") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_zeta_freq1_unit, 8, 2, 1, 1, - Qt.AlignLeft) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_zeta_freq1_unit, 8, 2, 1, 1, Qt.AlignLeft) self.lineEdit_zeta_freq2 = QLineEdit() self.lineEdit_zeta_freq2.setMaximumWidth(100) self.lineEdit_zeta_freq2.setText("0.00") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.lineEdit_zeta_freq2, 8, 3, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.lineEdit_zeta_freq2, 8, 3, 1, 1) self.label_zeta_freq2_unit = QLabel() self.label_zeta_freq2_unit.setText("m-1") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_zeta_freq2_unit, 8, 4, 1, 1, - Qt.AlignLeft) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.label_zeta_freq2_unit, 8, 4, 1, 1, Qt.AlignLeft) self.pushbutton_save_calibration = QPushButton() self.pushbutton_save_calibration.setText("Save calibration") - self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.pushbutton_save_calibration,9, 5, 1, 1) + self.gridLayout_groupbox_sediment_calibration_parameter\ + .addWidget(self.pushbutton_save_calibration,9, 5, 1, 1) - # ++++++++++++++++++++ - # +++ Groupbox FCB +++ - self.groupbox_FCB.setTitle("Step 3 (for information) : Fluid Corrected Backscatter") + def _setup_widgets_fcb(self): + self.groupbox_FCB.setTitle( + "Step 3 (for information) : Fluid Corrected Backscatter" + ) self.horizontalLayout_groupbox_FCB = QHBoxLayout(self.groupbox_FCB) self.groupbox_FCB.setCheckable(True) self.groupbox_FCB.setChecked(False) - # --- Groupbox FCB option --- + self._setup_widgets_fcb_options() + self._setup_widgets_fcb_plot() + + def _setup_widgets_fcb_options(self): self.groupbox_FCB_option = QGroupBox() self.verticalLayout_groupbox_FCB_option = QVBoxLayout(self.groupbox_FCB_option) - self.horizontalLayout_groupbox_FCB.addWidget(self.groupbox_FCB_option, 4) + self.horizontalLayout_groupbox_FCB\ + .addWidget(self.groupbox_FCB_option, 4) self.groupbox_FCB_text = QGroupBox() self.verticalLayout_groupbox_FCB_text = QVBoxLayout(self.groupbox_FCB_text) - self.verticalLayout_groupbox_FCB_option.addWidget(self.groupbox_FCB_text) + self.verticalLayout_groupbox_FCB_option\ + .addWidget(self.groupbox_FCB_text) self.label_FCB_explanation = QLabel() - self.label_FCB_explanation.setText("When fine sediments concentration is constant \n " - "and effect on sound attenuation on sand is negligible, \n " - "this sediment attenuation alphas can be compared \n " - "to the obtained by the sediment calibration computation.") - self.verticalLayout_groupbox_FCB_text.addWidget(self.label_FCB_explanation) + self.label_FCB_explanation.setText( + "When fine sediments concentration is constant \n " + "and effect on sound attenuation on sand is negligible, \n " + "this sediment attenuation alphas can be compared \n " + "to the obtained by the sediment calibration computation." + ) + self.verticalLayout_groupbox_FCB_text\ + .addWidget(self.label_FCB_explanation) self.gridLayout_groupbox_FCB_text_alphas = QGridLayout() - self.verticalLayout_groupbox_FCB_text.addLayout(self.gridLayout_groupbox_FCB_text_alphas) + self.verticalLayout_groupbox_FCB_text\ + .addLayout(self.gridLayout_groupbox_FCB_text_alphas) self.label_FCB_explanation_alphas_positive_icon = QLabel() self.label_FCB_explanation_alphas_positive_icon.setPixmap( - QPixmap(self.path_icon + "approved.png").scaledToHeight(16, Qt.SmoothTransformation)) + QPixmap(self._path_icon("approved.png")).scaledToHeight( + 16, Qt.SmoothTransformation + ) + ) self.gridLayout_groupbox_FCB_text_alphas.addWidget( - self.label_FCB_explanation_alphas_positive_icon, 0, 0, 1, 1, Qt.AlignCenter) + self.label_FCB_explanation_alphas_positive_icon, + 0, 0, 1, 1, Qt.AlignCenter + ) self.label_FCB_explanation_alphas_positive = QLabel() - self.label_FCB_explanation_alphas_positive.setText("αs FCB > 0 : comparison with calibration") + self.label_FCB_explanation_alphas_positive.setText( + "αs FCB > 0 : comparison with calibration" + ) self.label_FCB_explanation_alphas_positive.setFont(QFont('Ubuntu', 12)) - self.gridLayout_groupbox_FCB_text_alphas.addWidget(self.label_FCB_explanation_alphas_positive, 0, 1, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_FCB_text_alphas.addWidget( + self.label_FCB_explanation_alphas_positive, + 0, 1, 1, 1, Qt.AlignLeft + ) self.label_FCB_explanation_alphas_negative_icon = QLabel() - self.label_FCB_explanation_alphas_negative_icon.setPixmap(QPixmap(self.path_icon + "no_approved.png").scaledToHeight(16, Qt.SmoothTransformation)) - self.gridLayout_groupbox_FCB_text_alphas.addWidget(self.label_FCB_explanation_alphas_negative_icon, 1, 0, 1, 1, Qt.AlignCenter) + self.label_FCB_explanation_alphas_negative_icon.setPixmap( + QPixmap(self._path_icon("no_approved.png")).scaledToHeight( + 16, Qt.SmoothTransformation + ) + ) + self.gridLayout_groupbox_FCB_text_alphas.addWidget( + self.label_FCB_explanation_alphas_negative_icon, + 1, 0, 1, 1, Qt.AlignCenter + ) self.label_FCB_explanation_alphas_negative = QLabel() - self.label_FCB_explanation_alphas_negative.setText("αs FCB < 0 : do not compare with calibration") + self.label_FCB_explanation_alphas_negative.setText( + "αs FCB < 0 : do not compare with calibration" + ) self.label_FCB_explanation_alphas_negative.setFont(QFont('Ubuntu', 12)) - self.gridLayout_groupbox_FCB_text_alphas.addWidget(self.label_FCB_explanation_alphas_negative, 1, 1, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_FCB_text_alphas.addWidget( + self.label_FCB_explanation_alphas_negative, + 1, 1, 1, 1, Qt.AlignLeft + ) self.groupbox_FCB_compute = QGroupBox() self.gridLayout_groupbox_FCB_compute = QGridLayout(self.groupbox_FCB_compute) @@ -490,51 +671,77 @@ class SedimentCalibrationTab(QWidget): self.label_frequency_FCB = QLabel() self.label_frequency_FCB.setText("Frequency ") - self.gridLayout_groupbox_FCB_compute.addWidget(self.label_frequency_FCB, 0, 0, 1, 3, Qt.AlignCenter) + self.gridLayout_groupbox_FCB_compute.addWidget( + self.label_frequency_FCB, 0, 0, 1, 3, Qt.AlignCenter + ) self.combobox_frequency_FCB = QComboBox() - self.gridLayout_groupbox_FCB_compute.addWidget(self.combobox_frequency_FCB, 0, 3, 1, 3, Qt.AlignCenter) + self.gridLayout_groupbox_FCB_compute.addWidget( + self.combobox_frequency_FCB, 0, 3, 1, 3, Qt.AlignCenter + ) self.label_from = QLabel() self.label_from.setText("From ") - self.gridLayout_groupbox_FCB_compute.addWidget(self.label_from, 1, 0, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_FCB_compute.addWidget( + self.label_from, 1, 0, 1, 1, Qt.AlignCenter + ) self.lineEdit_FCB_from = QLineEdit() self.lineEdit_FCB_from.setMaximumWidth(100) - self.gridLayout_groupbox_FCB_compute.addWidget(self.lineEdit_FCB_from, 1, 1, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_FCB_compute.addWidget( + self.lineEdit_FCB_from, 1, 1, 1, 1, Qt.AlignCenter + ) self.label_FCB_from_unit = QLabel() self.label_FCB_from_unit.setText("m") - self.gridLayout_groupbox_FCB_compute.addWidget(self.label_FCB_from_unit, 1, 2, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_FCB_compute.addWidget( + self.label_FCB_from_unit, 1, 2, 1, 1, Qt.AlignLeft + ) self.label_to = QLabel() self.label_to.setText("to ") - self.gridLayout_groupbox_FCB_compute.addWidget(self.label_to, 1, 3, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_FCB_compute.addWidget( + self.label_to, 1, 3, 1, 1, Qt.AlignCenter + ) self.lineEdit_FCB_to = QLineEdit() self.lineEdit_FCB_to.setMaximumWidth(100) - self.gridLayout_groupbox_FCB_compute.addWidget(self.lineEdit_FCB_to, 1, 4, 1, 1, Qt.AlignCenter) + self.gridLayout_groupbox_FCB_compute.addWidget( + self.lineEdit_FCB_to, 1, 4, 1, 1, Qt.AlignCenter + ) self.label_FCB_to_unit = QLabel() self.label_FCB_to_unit.setText("m") - self.gridLayout_groupbox_FCB_compute.addWidget(self.label_FCB_to_unit, 1, 5, 1, 1, Qt.AlignLeft) + self.gridLayout_groupbox_FCB_compute.addWidget( + self.label_FCB_to_unit, 1, 5, 1, 1, Qt.AlignLeft + ) self.pushbutton_FCB_fit = QPushButton() self.pushbutton_FCB_fit.setText("Compute and Plot Linear regression") - self.gridLayout_groupbox_FCB_compute.addWidget(self.pushbutton_FCB_fit, 2, 0, 1, 3, Qt.AlignCenter) + self.gridLayout_groupbox_FCB_compute.addWidget( + self.pushbutton_FCB_fit, 2, 0, 1, 3, Qt.AlignCenter + ) self.label_alphaS_FCB = QLabel() - self.label_alphaS_FCB.setText("αs = " + "0.0" + "dB/m") + self.label_alphaS_FCB.setText( + "αs = " + "0.0" + "dB/m" + ) self.label_alphaS_FCB.setFont(QFont("Ubuntu", 14, QFont.Normal)) - self.gridLayout_groupbox_FCB_compute.addWidget(self.label_alphaS_FCB, 2, 4, 1, 2) + self.gridLayout_groupbox_FCB_compute.addWidget( + self.label_alphaS_FCB, 2, 4, 1, 2 + ) - # --- Groupbox FCB plot --- + + def _setup_widgets_fcb_plot(self): self.verticalLayout_groupbox_FCB_plot_and_slider_FCB = QVBoxLayout() - self.horizontalLayout_groupbox_FCB.addLayout(self.verticalLayout_groupbox_FCB_plot_and_slider_FCB, 8) + self.horizontalLayout_groupbox_FCB.addLayout( + self.verticalLayout_groupbox_FCB_plot_and_slider_FCB, 8 + ) self.groupbox_FCB_plot = QGroupBox() self.verticalLayout_groupbox_FCB_plot = QVBoxLayout(self.groupbox_FCB_plot) - self.verticalLayout_groupbox_FCB_plot_and_slider_FCB.addWidget(self.groupbox_FCB_plot) + self.verticalLayout_groupbox_FCB_plot_and_slider_FCB\ + .addWidget(self.groupbox_FCB_plot) self.canvas_FCB = FigureCanvas() self.toolbar_FCB = NavigationToolBar(self.canvas_FCB, self) @@ -543,11 +750,16 @@ class SedimentCalibrationTab(QWidget): self.verticalLayout_groupbox_FCB_plot.addWidget(self.canvas_FCB) self.horizontalLayout_slider_FCB = QHBoxLayout() - self.verticalLayout_groupbox_FCB_plot_and_slider_FCB.addLayout(self.horizontalLayout_slider_FCB) + self.verticalLayout_groupbox_FCB_plot_and_slider_FCB\ + .addLayout(self.horizontalLayout_slider_FCB) self.pushbutton_left_to_begin_FCB = QPushButton() - self.pushbutton_left_to_begin_FCB.setIcon(self.icon_triangle_left_to_begin) - self.horizontalLayout_slider_FCB.addWidget(self.pushbutton_left_to_begin_FCB) + self.pushbutton_left_to_begin_FCB.setIcon( + self.icon_triangle_left_to_begin + ) + self.horizontalLayout_slider_FCB.addWidget( + self.pushbutton_left_to_begin_FCB + ) self.pushbutton_left_FCB = QPushButton() self.pushbutton_left_FCB.setIcon(self.icon_triangle_left) @@ -563,8 +775,12 @@ class SedimentCalibrationTab(QWidget): self.horizontalLayout_slider_FCB.addWidget(self.pushbutton_right_FCB) self.pushbutton_right_to_end_FCB = QPushButton() - self.pushbutton_right_to_end_FCB.setIcon(self.icon_triangle_right_to_end) - self.horizontalLayout_slider_FCB.addWidget(self.pushbutton_right_to_end_FCB) + self.pushbutton_right_to_end_FCB.setIcon( + self.icon_triangle_right_to_end + ) + self.horizontalLayout_slider_FCB.addWidget( + self.pushbutton_right_to_end_FCB + ) self.slider_FCB = QSlider() self.horizontalLayout_slider_FCB.addWidget(self.slider_FCB) @@ -576,37 +792,58 @@ class SedimentCalibrationTab(QWidget): self.slider_FCB.setTickInterval(1) self.slider_FCB.setValue(1) - # ============================================================================================================== - # ---------------------------------------- Connect signal of widget -------------------------------------------- - # ============================================================================================================== - self.pushbutton_update_acoustic_file.clicked.connect(self.function_pushbutton_update_acoustic_file) + def _setup_connections(self): + self.pushbutton_update_acoustic_file\ + .clicked.connect( + self.function_pushbutton_update_acoustic_file + ) - self.pushbutton_plot_sample.clicked.connect(self.function_pushbutton_plot_sample) + self.pushbutton_plot_sample\ + .clicked.connect( + self.function_pushbutton_plot_sample + ) - self.pushbutton_interpolate_Mfine_profile.clicked.connect(self.interpolate_Mfine_profile) + self.pushbutton_interpolate_Mfine_profile\ + .clicked.connect(self.interpolate_Mfine_profile) - self.groupbox_sediment_calibration_import.toggled.connect(self.groupbox_calibration_import_toggle) - self.groupbox_sediment_calibration_import.toggled.connect(self.groupbox_calibration_import_size_change) + self.groupbox_sediment_calibration_import\ + .toggled.connect(self.groupbox_calibration_import_toggle) + self.groupbox_sediment_calibration_import\ + .toggled.connect(self.groupbox_calibration_import_size_change) - self.pushbutton_import_calibration.clicked.connect(self.import_calibration_file) + self.pushbutton_import_calibration\ + .clicked.connect(self.import_calibration_file) - self.groupbox_sediment_calibration_compute.toggled.connect(self.groupbox_calibration_compute_toggle) - self.groupbox_sediment_calibration_compute.toggled.connect(self.groupbox_calibration_compute_size_change) + self.groupbox_sediment_calibration_compute\ + .toggled.connect(self.groupbox_calibration_compute_toggle) + self.groupbox_sediment_calibration_compute\ + .toggled.connect(self.groupbox_calibration_compute_size_change) - self.pushbutton_compute_calibration.clicked.connect(self.function_pushbutton_compute_calibration) + self.pushbutton_compute_calibration\ + .clicked.connect(self.function_pushbutton_compute_calibration) - self.pushbutton_save_calibration.clicked.connect(self.save_calibration) + self.pushbutton_save_calibration\ + .clicked.connect(self.save_calibration) - self.pushbutton_left_to_begin_FCB.clicked.connect(self.slider_profile_number_to_begin_FCB) - self.pushbutton_left_FCB.clicked.connect(self.slider_profile_number_to_left_FCB) - self.pushbutton_right_FCB.clicked.connect(self.slider_profile_number_to_right_FCB) - self.pushbutton_right_to_end_FCB.clicked.connect(self.slider_profile_number_to_end_FCB) - self.lineEdit_slider_FCB.returnPressed.connect(self.profile_number_on_lineEdit_FCB) - self.slider_FCB.valueChanged.connect(self.update_lineEdit_by_moving_slider_FCB) + self.pushbutton_left_to_begin_FCB\ + .clicked.connect(self.slider_profile_number_to_begin_FCB) + self.pushbutton_left_FCB\ + .clicked.connect(self.slider_profile_number_to_left_FCB) + self.pushbutton_right_FCB\ + .clicked.connect(self.slider_profile_number_to_right_FCB) + self.pushbutton_right_to_end_FCB\ + .clicked.connect(self.slider_profile_number_to_end_FCB) + self.lineEdit_slider_FCB\ + .returnPressed.connect(self.profile_number_on_lineEdit_FCB) + self.slider_FCB\ + .valueChanged.connect(self.update_lineEdit_by_moving_slider_FCB) - self.pushbutton_FCB_fit.clicked.connect(self.fit_FCB_profile_with_linear_regression_and_compute_alphaS) + self.pushbutton_FCB_fit\ + .clicked.connect( + self.fit_FCB_profile_with_linear_regression_and_compute_alphaS + ) # ============================================================================================================== # ----------------------------------- Functions for Signal processing Tab -------------------------------------- @@ -1424,8 +1661,8 @@ class SedimentCalibrationTab(QWidget): "Calibration file (*.xls, *.ods, *csv)", options=QFileDialog.DontUseNativeDialog) - dir_name = path.dirname(filename[0]) - name = path.basename(filename[0]) + dir_name = os.path.dirname(filename[0]) + name = os.path.basename(filename[0]) stg.path_calibration_file = dir_name stg.filename_calibration_file = name @@ -1465,7 +1702,7 @@ class SedimentCalibrationTab(QWidget): msgBox = QMessageBox() msgBox.setWindowTitle("Calibration import error") 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("Update data before importing calibration") msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() @@ -1956,7 +2193,7 @@ class SedimentCalibrationTab(QWidget): msgBox = QMessageBox() msgBox.setWindowTitle("Alpha computation error") - msgBox.setIconPixmap(QPixmap(self.path_icon + "no_approved.png").scaledToHeight(32, Qt.SmoothTransformation)) + msgBox.setIconPixmap(QPixmap(self._path_icon("no_approved.png")).scaledToHeight(32, Qt.SmoothTransformation)) msgBox.setText("Sediment sound attenuation is negative !") msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() @@ -1965,7 +2202,7 @@ class SedimentCalibrationTab(QWidget): msgBox = QMessageBox() msgBox.setWindowTitle("Alpha computation validation") - msgBox.setIconPixmap(QPixmap(self.path_icon + "approved.png").scaledToHeight(32, Qt.SmoothTransformation)) + msgBox.setIconPixmap(QPixmap(self._path_icon("approved.png")).scaledToHeight(32, Qt.SmoothTransformation)) msgBox.setText("Sediment sound attenuation is positive.") msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() @@ -2027,7 +2264,7 @@ class SedimentCalibrationTab(QWidget): if dir_save_cal: - stg.path_calibration_file = path.dirname(dir_save_cal) + stg.path_calibration_file = os.path.dirname(dir_save_cal) cal_array = [[' ', stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1]], stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1]]], @@ -2466,4 +2703,3 @@ class SedimentCalibrationTab(QWidget): self.lineEdit_slider_FCB.setText( str(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_FCB.currentIndex(), self.slider_FCB.value()-1])) - diff --git a/View/signal_processing_tab.py b/View/signal_processing_tab.py index b9f9cee..3d2b2df 100644 --- a/View/signal_processing_tab.py +++ b/View/signal_processing_tab.py @@ -14,19 +14,25 @@ # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see . # -from cProfile import label # by Brahim MOUDJED # # ============================================================================== # # -*- coding: utf-8 -*- +from cProfile import label -from PyQt5.QtWidgets import (QWidget, QHBoxLayout, QVBoxLayout, QPushButton, QGroupBox, QLabel, - QSpinBox, QComboBox, QLineEdit, QSlider, QGridLayout, QMessageBox, - QScrollArea, QFileDialog, QSpacerItem, QSizePolicy) +from PyQt5.QtWidgets import ( + QWidget, QHBoxLayout, QVBoxLayout, QPushButton, QGroupBox, + QLabel, QSpinBox, QComboBox, QLineEdit, QSlider, + QGridLayout, QMessageBox, QScrollArea, QFileDialog, + QSpacerItem, QSizePolicy +) from PyQt5.QtGui import QIcon -from PyQt5.QtCore import Qt, QCoreApplication, QEvent, pyqtSignal, QPropertyAnimation, QSize +from PyQt5.QtCore import ( + Qt, QCoreApplication, QEvent, pyqtSignal, QPropertyAnimation, + QSize +) import numpy as np from copy import deepcopy