1601 lines
90 KiB
Python
1601 lines
90 KiB
Python
import sys
|
|
|
|
from PyQt5.QtWidgets import QWidget, QMainWindow, QApplication, QVBoxLayout, QHBoxLayout, QGroupBox, QComboBox, \
|
|
QGridLayout, QLabel, QPushButton, QSpinBox, QDoubleSpinBox, QAbstractSpinBox
|
|
from PyQt5.QtCore import QCoreApplication, Qt
|
|
from PyQt5.QtGui import QStandardItemModel
|
|
|
|
import numpy as np
|
|
|
|
from itertools import combinations
|
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
from matplotlib.colors import LogNorm, BoundaryNorm, CSS4_COLORS
|
|
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
|
|
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolBar
|
|
|
|
import datetime
|
|
|
|
from scipy import stats
|
|
|
|
import Translation.constant_string as cs
|
|
|
|
from View.checkable_combobox import CheckableComboBox
|
|
|
|
import settings as stg
|
|
|
|
from Model.acoustic_inversion_method_high_concentration import AcousticInversionMethodHighConcentration
|
|
|
|
_translate = QCoreApplication.translate
|
|
|
|
|
|
class AcousticInversionTab(QWidget):
|
|
|
|
''' This class generates the Acoustic Inversion Tab '''
|
|
|
|
def __init__(self, widget_tab):
|
|
super().__init__()
|
|
|
|
self.inv_hc = AcousticInversionMethodHighConcentration()
|
|
|
|
### --- General layout of widgets ---
|
|
|
|
self.verticalLayoutMain = QVBoxLayout(widget_tab)
|
|
|
|
self.horizontalLayoutTop = QHBoxLayout()
|
|
self.verticalLayoutMain.addLayout(self.horizontalLayoutTop, 4) # 1O units is 100% , 1 units is 10%
|
|
|
|
self.horizontalLayoutBottom = QHBoxLayout()
|
|
self.verticalLayoutMain.addLayout(self.horizontalLayoutBottom, 6)
|
|
|
|
### --- Layout of groupbox in the Top horizontal layout box
|
|
|
|
# Acoustic inversion Options | Acoustic inversion method Settings parameter
|
|
|
|
self.groupbox_acoustic_inversion_options = QGroupBox()
|
|
self.horizontalLayoutTop.addWidget(self.groupbox_acoustic_inversion_options, 3)
|
|
|
|
self.groupbox_acoustic_inversion_settings_parameter = QGroupBox()
|
|
self.horizontalLayoutTop.addWidget(self.groupbox_acoustic_inversion_settings_parameter, 7)
|
|
|
|
### --- Layout of groupbox in the Bottom horizontal layout box
|
|
|
|
# Plot SSC 2D field | Plot SSC graph sample vs inversion
|
|
|
|
self.groupbox_SSC_2D_field = QGroupBox()
|
|
self.horizontalLayoutBottom.addWidget(self.groupbox_SSC_2D_field, 6)
|
|
|
|
self.groupbox_SSC_sample_vs_inversion = QGroupBox()
|
|
self.horizontalLayoutBottom.addWidget(self.groupbox_SSC_sample_vs_inversion, 4)
|
|
|
|
# =====================================================
|
|
# TOP HORIZONTAL BOX LAYOUT
|
|
# =====================================================
|
|
|
|
# +++++++++++++++++++++++++++++++++++++++++++++++
|
|
# | Group box Acoustic inversion options |
|
|
# +++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
self.gridLayout_groupbox_acoustic_inversion_options = QGridLayout(self.groupbox_acoustic_inversion_options)
|
|
|
|
self.groupbox_acoustic_inversion_options.setTitle("Acoustic inversion option")
|
|
|
|
self.label_acoustic_inversion_method_choice = QLabel()
|
|
self.gridLayout_groupbox_acoustic_inversion_options.addWidget(
|
|
self.label_acoustic_inversion_method_choice, 0, 0, 1, 1)
|
|
self.label_acoustic_inversion_method_choice.setText("Acoustic inversion method : ")
|
|
|
|
self.combobox_acoustic_inversion_method_choice = QComboBox()
|
|
self.gridLayout_groupbox_acoustic_inversion_options.addWidget(
|
|
self.combobox_acoustic_inversion_method_choice, 0, 1, 1, 1)
|
|
self.combobox_acoustic_inversion_method_choice.addItems([" ", "Acoustic inversion method 1"])
|
|
self.combobox_acoustic_inversion_method_choice.currentIndexChanged.connect(
|
|
self.acoustic_inversion_method_choice)
|
|
# self.combobox_acoustic_inversion_method_choice.currentIndexChanged.connect(
|
|
# self.plot_transect_with_sample_position)
|
|
|
|
self.groupbox_calibration_samples = QGroupBox()
|
|
self.groupbox_calibration_samples.setTitle("Sample choice for calibration")
|
|
self.gridLayout_groupbox_acoustic_inversion_options.addWidget(self.groupbox_calibration_samples, 1, 0, 1, 2)
|
|
|
|
self.gridLayout_groupbox_calibration_samples = QGridLayout(self.groupbox_calibration_samples)
|
|
|
|
self.label_frequency = QLabel()
|
|
self.label_frequency.setText("Frequency :")
|
|
self.gridLayout_groupbox_calibration_samples.addWidget(self.label_frequency, 0, 0, 1, 1)
|
|
|
|
self.combobox_frequency = QComboBox()
|
|
self.gridLayout_groupbox_calibration_samples.addWidget(self.combobox_frequency, 0, 1, 1, 1)
|
|
self.combobox_frequency.currentIndexChanged.connect(self.update_plot_transect_with_sample_position)
|
|
|
|
self.label_sand_sample_choice = QLabel()
|
|
self.label_sand_sample_choice.setText("Sand sediments :")
|
|
self.gridLayout_groupbox_calibration_samples.addWidget(self.label_sand_sample_choice, 0, 2, 1, 1)
|
|
|
|
self.combobox_calibration_sand_sample = CheckableComboBox()
|
|
self.gridLayout_groupbox_calibration_samples.addWidget(self.combobox_calibration_sand_sample, 0, 3, 1, 1)
|
|
# self.combobox_calibration_sand_sample.currentData.connect(self.update_plot_transect_with_sample_position)
|
|
self.combobox_calibration_sand_sample.currentIndexChanged.connect(
|
|
self.update_plot_transect_with_sample_position)
|
|
# self.combobox_calibration_sand_sample.currentIndexChanged.connect(self.sample_choice)
|
|
|
|
self.label_fine_sample_choice = QLabel()
|
|
self.label_fine_sample_choice.setText("Fine sediments :")
|
|
self.gridLayout_groupbox_calibration_samples.addWidget(self.label_fine_sample_choice, 0, 4, 1, 1)
|
|
|
|
self.combobox_calibration_fine_sample = CheckableComboBox()
|
|
self.gridLayout_groupbox_calibration_samples.addWidget(self.combobox_calibration_fine_sample, 0, 5, 1, 1)
|
|
# self.combobox_calibration_fine_sample.currentData.connect(self.update_plot_transect_with_sample_position)
|
|
self.combobox_calibration_fine_sample.currentIndexChanged.connect(
|
|
self.update_plot_transect_with_sample_position)
|
|
|
|
# self.combobox_calibration_fine_sample.currentIndexChanged.connect(self.sample_choice)
|
|
|
|
self.groupbox_plot_sample_position_on_transect = QGroupBox()
|
|
self.gridLayout_groupbox_calibration_samples.addWidget(self.groupbox_plot_sample_position_on_transect, 1, 0, 1, 6)
|
|
self.verticalLayout_groupbox_plot_sample_position_on_transect = QVBoxLayout(self.groupbox_plot_sample_position_on_transect)
|
|
|
|
self.canvas_plot_sample_position_on_transect = None
|
|
# self.verticalLayout_groupbox_plot_sample_position_on_transect.addWidget(self.canvas_plot_sample_position_on_transect)
|
|
|
|
|
|
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
# | Group box Acoustic inversion method settings parameter |
|
|
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
self.gridLayout_groupbox_acoustic_inversion_settings_parameter \
|
|
= QGridLayout(self.groupbox_acoustic_inversion_settings_parameter)
|
|
|
|
self.groupbox_acoustic_inversion_settings_parameter.setTitle("Acoustic inversion method settings parameter")
|
|
|
|
self.groupbox_parameter = QGroupBox()
|
|
self.gridLayout_groupbox_acoustic_inversion_settings_parameter.addWidget(self.groupbox_parameter, 0, 0, 1, 2)
|
|
|
|
self.gridLayout_groupbox_parameter = QGridLayout(self.groupbox_parameter)
|
|
|
|
# self.label_temperature = QLabel()
|
|
# self.label_temperature.setText("Temperature : ")
|
|
# # self.gridLayout_groupbox_acoustic_inversion_settings_parameter.addWidget(self.label_temperature, 0, 0, 1, 1)
|
|
# self.gridLayout_groupbox_parameter.addWidget(self.label_temperature, 0, 0, 1, 1)
|
|
# self.spinbox_temperature = QDoubleSpinBox()
|
|
# # self.gridLayout_groupbox_acoustic_inversion_settings_parameter.addWidget(self.spinbox_temperature, 0, 1, 1, 1)
|
|
# self.gridLayout_groupbox_parameter.addWidget(self.spinbox_temperature, 0, 1, 1, 1)
|
|
# self.spinbox_temperature.valueChanged.connect(self.temperature_value)
|
|
|
|
self.label_frequencies_pairs_to_compute_VBI = QLabel()
|
|
self.label_frequencies_pairs_to_compute_VBI.setText("Frequencies for VBI")
|
|
self.gridLayout_groupbox_parameter.addWidget(
|
|
self.label_frequencies_pairs_to_compute_VBI, 0, 1, 1, 1)
|
|
|
|
# self.combobox_frequencies_VBI = QComboBox()
|
|
# self.gridLayout_groupbox_acoustic_inversion_settings_parameter.addWidget(
|
|
# self.combobox_frequencies_VBI, 1, 1, 1, 1)
|
|
# self.combobox_frequencies_VBI.currentIndexChanged.connect(self.frequencies_pair_choice_to_compute_VBI)
|
|
|
|
self.label_ks = QLabel()
|
|
self.label_ks.setText("ks")
|
|
self.gridLayout_groupbox_parameter.addWidget(self.label_ks, 0, 2, 1, 1)
|
|
|
|
self.label_sv = QLabel()
|
|
self.label_sv.setText("sv")
|
|
self.gridLayout_groupbox_parameter.addWidget(self.label_sv, 0, 3, 1, 1)
|
|
|
|
self.label_X = QLabel()
|
|
self.label_X.setText("X")
|
|
self.gridLayout_groupbox_parameter.addWidget(self.label_X, 0, 4, 1, 1)
|
|
|
|
self.label_alphas = QLabel()
|
|
self.label_alphas.setText("\u03B1s")
|
|
self.gridLayout_groupbox_parameter.addWidget(self.label_alphas, 0, 5, 1, 1)
|
|
|
|
self.label_zeta = QLabel()
|
|
self.label_zeta.setText("\u03B6")
|
|
self.gridLayout_groupbox_parameter.addWidget(self.label_zeta, 0, 6, 1, 1)
|
|
|
|
self.label_freq1 = QLabel()
|
|
self.label_freq1.setText("Frequency 1 : ")
|
|
self.gridLayout_groupbox_parameter.addWidget(self.label_freq1, 1, 0, 1, 1)
|
|
|
|
self.label_freq2 = QLabel()
|
|
self.label_freq2.setText("Frequency 2 : ")
|
|
self.gridLayout_groupbox_parameter.addWidget(self.label_freq2, 2, 0, 1, 1)
|
|
|
|
self.combobox_freq1 = QComboBox()
|
|
self.gridLayout_groupbox_parameter.addWidget(self.combobox_freq1, 1, 1, 1, 1)
|
|
|
|
self.combobox_freq2 = QComboBox()
|
|
self.gridLayout_groupbox_parameter.addWidget(self.combobox_freq2, 2, 1, 1, 1)
|
|
|
|
self.spinbox_ks_freq1 = QDoubleSpinBox()
|
|
self.spinbox_ks_freq1.setDecimals(5)
|
|
self.gridLayout_groupbox_parameter.addWidget(self.spinbox_ks_freq1, 1, 2, 1, 1)
|
|
|
|
self.spinbox_ks_freq2 = QDoubleSpinBox()
|
|
self.spinbox_ks_freq2.setDecimals(5)
|
|
self.gridLayout_groupbox_parameter.addWidget(self.spinbox_ks_freq2, 2, 2, 1, 1)
|
|
|
|
self.spinbox_sv_freq1 = QDoubleSpinBox()
|
|
self.spinbox_sv_freq1.setDecimals(5)
|
|
self.gridLayout_groupbox_parameter.addWidget(self.spinbox_sv_freq1, 1, 3, 1, 1)
|
|
|
|
self.spinbox_sv_freq2 = QDoubleSpinBox()
|
|
self.spinbox_sv_freq2.setDecimals(5)
|
|
self.gridLayout_groupbox_parameter.addWidget(self.spinbox_sv_freq2, 2, 3, 1, 1)
|
|
|
|
self.spinbox_X = QDoubleSpinBox()
|
|
self.spinbox_X.setDecimals(5)
|
|
self.gridLayout_groupbox_parameter.addWidget(self.spinbox_X, 1, 4, 1, 1)
|
|
|
|
self.spinbox_alphas_freq1 = QDoubleSpinBox()
|
|
self.spinbox_alphas_freq1.setDecimals(5)
|
|
self.gridLayout_groupbox_parameter.addWidget(self.spinbox_alphas_freq1, 1, 5, 1, 1)
|
|
|
|
self.spinbox_alphas_freq2 = QDoubleSpinBox()
|
|
self.spinbox_alphas_freq2.setDecimals(5)
|
|
self.gridLayout_groupbox_parameter.addWidget(self.spinbox_alphas_freq2, 2, 5, 1, 1)
|
|
|
|
self.spinbox_zeta_freq1 = QDoubleSpinBox()
|
|
self.spinbox_zeta_freq1.setDecimals(5)
|
|
self.gridLayout_groupbox_parameter.addWidget(self.spinbox_zeta_freq1, 1, 6, 1, 1)
|
|
|
|
self.spinbox_zeta_freq2 = QDoubleSpinBox()
|
|
self.spinbox_zeta_freq2.setDecimals(5)
|
|
self.gridLayout_groupbox_parameter.addWidget(self.spinbox_zeta_freq2, 2, 6, 1, 1)
|
|
|
|
# self.label_frequency_to_compute_SSC = QLabel()
|
|
# self.label_frequency_to_compute_SSC.setText("frequencies for SSC : ")
|
|
# # self.gridLayout_groupbox_acoustic_inversion_settings_parameter.addWidget(
|
|
# # self.label_frequency_to_compute_SSC, 2, 0, 1, 1)
|
|
# self.gridLayout_groupbox_parameter.addWidget(self.label_frequency_to_compute_SSC, 3, 0, 1, 1)
|
|
|
|
# self.combobox_frequency_SSC = QComboBox()
|
|
# # self.gridLayout_groupbox_acoustic_inversion_settings_parameter.addWidget(
|
|
# # self.combobox_frequency_SSC, 2, 1, 1, 1)
|
|
# self.gridLayout_groupbox_parameter.addWidget(self.combobox_frequency_SSC, 3, 1, 1, 1)
|
|
# self.combobox_frequency_SSC.currentIndexChanged.connect(self.frequency_choice_to_compute_SSC)
|
|
|
|
self.pushbutton_run = QPushButton()
|
|
self.pushbutton_run.setText("RUN")
|
|
self.gridLayout_groupbox_acoustic_inversion_settings_parameter.addWidget(self.pushbutton_run, 1, 0, 1, 1)
|
|
self.pushbutton_run.clicked.connect(self.compute_acoustic_inversion_method_high_concentration)
|
|
|
|
self.pushbutton_plot = QPushButton()
|
|
self.pushbutton_plot.setText("PLOT")
|
|
self.gridLayout_groupbox_acoustic_inversion_settings_parameter.addWidget(self.pushbutton_plot, 1, 1, 1, 1)
|
|
self.pushbutton_plot.clicked.connect(self.plot_SSC_fine)
|
|
self.pushbutton_plot.clicked.connect(self.plot_SSC_sand)
|
|
self.pushbutton_plot.clicked.connect(self.plot_SSC_inverse_VS_measured)
|
|
|
|
# =====================================================
|
|
# BOTTOM HORIZONTAL BOX LAYOUT
|
|
# =====================================================
|
|
|
|
# +++++++++++++++++++++++++++++++++++++++++++++++
|
|
# | Group box SSC 2D field |
|
|
# +++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
self.verticalLayout_groupbox_SSC_2D_field = QVBoxLayout(self.groupbox_SSC_2D_field)
|
|
self.groupbox_SSC_2D_field.setTitle("Suspended Sediment Concentration 2D plot")
|
|
|
|
self.figure_SSC_2D_field, self.axis_SSC_2D_field = plt.subplots(nrows=2, ncols=1, layout="constrained")
|
|
self.canvas_SSC_2D_field = FigureCanvas(self.figure_SSC_2D_field)
|
|
self.verticalLayout_groupbox_SSC_2D_field.addWidget(self.canvas_SSC_2D_field)
|
|
|
|
# +++++++++++++++++++++++++++++++++++++++++++++++
|
|
# | Group box plot samples vs inversion |
|
|
# +++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
self.verticalLayout_groupbox_SSC_sample_vs_inversion = QVBoxLayout(self.groupbox_SSC_sample_vs_inversion)
|
|
self.groupbox_SSC_sample_vs_inversion.setTitle("Suspended Sediment Concentration : sample vs inversion")
|
|
|
|
self.figure_SSC_sample_vs_inversion, self.axis_SSC_sample_vs_inversion = plt.subplots(nrows=1, ncols=1,
|
|
layout="constrained")
|
|
self.canvas_SSC_sample_vs_inversion = FigureCanvas(self.figure_SSC_sample_vs_inversion)
|
|
self.verticalLayout_groupbox_SSC_sample_vs_inversion.addWidget(self.canvas_SSC_sample_vs_inversion)
|
|
#
|
|
# self.verticalLayout_groupbox_sediment_concentration_2Dplot = QVBoxLayout(self.groupbox_sediment_concentration_2Dplot)
|
|
#
|
|
# self.figure_SSC_2Dplot, self.axis_SSC_2Dplot = plt.subplots(nrows=2, ncols=1)
|
|
# self.canvas_sediments2DPlot = FigureCanvas(self.figure_SSC_2Dplot)
|
|
# self.toolbar_concentration_2Dplot = NavigationToolBar(self.canvas_sediments2DPlot, self)
|
|
# self.plot_SSC_fine()
|
|
# self.plot_SSC_sand()
|
|
# # self.verticalLayout_groupbox_sediment_concentration_2Dplot.addWidget(self.toolbar_concentration_2Dplot)
|
|
# self.verticalLayout_groupbox_sediment_concentration_2Dplot.addWidget(self.canvas_sediments2DPlot)
|
|
#
|
|
# # self.horizontalLayout_Bottom_acousticInversionTab.addWidget(self.canvas_sediments2DPlot)
|
|
# self.horizontalLayout_Bottom_acousticInversionTab.addWidget(self.groupbox_sediment_concentration_2Dplot, 7)
|
|
#
|
|
#
|
|
# # self.groupbox_sediment_concentration_sample_vs_measurement.setTitle(
|
|
# # "Suspended sediment concentration plot : acoustic inversion theory VS measurements")
|
|
#
|
|
# self.verticalLayout_groupbox_sediment_concentration_sample_vs_measurement = QVBoxLayout(
|
|
# self.groupbox_sediment_concentration_sample_vs_measurement)
|
|
#
|
|
# self.figure_inverseSSC_vs_measuredSSC, self.axis_inverseSSC_vs_measuredSSC = plt.subplots(nrows=1, ncols=1)
|
|
# self.canvas_InverseSSC_vs_MeasuredSSC = FigureCanvas(self.figure_inverseSSC_vs_measuredSSC)
|
|
# self.toolbar_InverseSSC_vs_MeasuredSSC = NavigationToolBar(self.canvas_InverseSSC_vs_MeasuredSSC, self)
|
|
# # self.verticalLayout_groupbox_sediment_concentration_sample_vs_measurement.addWidget(
|
|
# # self.toolbar_InverseSSC_vs_MeasuredSSC)
|
|
# self.verticalLayout_groupbox_sediment_concentration_sample_vs_measurement.addWidget(
|
|
# self.canvas_InverseSSC_vs_MeasuredSSC, 3)
|
|
# # self.horizontalLayout_Bottom_acousticInversionTab.addWidget(self.canvas_InverseSSC_vs_MeasuredSSC)
|
|
#
|
|
# self.horizontalLayout_Bottom_acousticInversionTab.addWidget(
|
|
# self.groupbox_sediment_concentration_sample_vs_measurement)
|
|
#
|
|
# self.verticalLayout_acoustic_inversion_tab.addLayout(self.horizontalLayout_Bottom_acousticInversionTab, 6)
|
|
#
|
|
# self.retranslate_acoustic_inversion_tab()
|
|
|
|
# ----------------------------------------------------------------------------------------------------------------
|
|
# -------------------- Functions --------------------
|
|
|
|
# def retranslate_acoustic_inversion_tab(self):
|
|
#
|
|
# self.groupbox_AcousticInversionOption.setTitle(_translate("CONSTANT_STRING", cs.ACOUSTIC_INVERSION_OPTIONS))
|
|
# self.groupbox_sediment_concentration_2Dplot.setTitle(_translate("CONSTANT_STRING", cs.FINE_AND_SAND_SEDIMENTS_CONCENTRATION_2D_FIELD))
|
|
# self.groupbox_sediment_concentration_sample_vs_measurement.setTitle(_translate("CONSTANT_STRING", cs.SUSPENDED_SEDIMENT_CONCENTRATION_PLOT))
|
|
|
|
def acoustic_inversion_method_choice(self):
|
|
if self.combobox_acoustic_inversion_method_choice.currentIndex() == 1:
|
|
|
|
self.plot_transect_with_sample_position()
|
|
|
|
# --- add items in combobox of samples (sand and vertical fine) to calibrate acoustic inversion method ---
|
|
|
|
# samples_vertical_line = np.split(stg.samples, np.where(np.diff(stg.sample_time) != 0)[0]+1)
|
|
|
|
# self.combobox_calibration_sand_sample.addItem(" ")
|
|
# for s in samples_vertical_line:
|
|
# self.combobox_calibration_sand_sample.addItem(" - ".join([i for i in s]))
|
|
|
|
self.combobox_frequency.addItems(stg.freq_text)
|
|
|
|
self.combobox_calibration_sand_sample.addItems(stg.samples)
|
|
# self.combobox_calibration_sand_sample.currentData.connect(self.update_plot_transect_with_sample_position)
|
|
|
|
self.combobox_calibration_fine_sample.addItems(stg.samples)
|
|
# self.combobox_calibration_fine_sample.currentData.connect(self.update_plot_transect_with_sample_position)
|
|
|
|
self.combobox_freq1.addItems(stg.freq_text)
|
|
self.combobox_freq2.addItems(stg.freq_text)
|
|
|
|
|
|
# for i in range(len(samples_vertical_line)):
|
|
# self.combobox_calibration_samples.setItemChecked(i, False)
|
|
|
|
# --- add items in combobox of frequencies for VBI computation ---
|
|
# self.combobox_frequencies_VBI.addItem(" ")
|
|
# for k in combinations(stg.freq_text, 2):
|
|
# self.combobox_frequencies_VBI.addItem(k[0] + " - " + k[1])
|
|
# print(k)
|
|
# for i in range(len(list(combinations(stg.freq_text, 2)))):
|
|
# self.combobox_frequencies_VBI.setItemChecked(i, False)
|
|
|
|
# print(f"stg.fine_sediment_columns length : {len(stg.fine_sediment_columns)}")
|
|
# print(f"stg.fine_sediment_columns : {stg.fine_sediment_columns}")
|
|
# print(f"stg.frac_vol_fine.shape : {stg.frac_vol_fine.shape}")
|
|
# print(f"stg.frac_vol_fine : {stg.frac_vol_fine}")
|
|
|
|
def plot_transect_with_sample_position(self):
|
|
if self.canvas_plot_sample_position_on_transect == None:
|
|
|
|
self.verticalLayout_groupbox_plot_sample_position_on_transect.removeWidget(self.canvas_plot_sample_position_on_transect)
|
|
self.figure_plot_sample_position_on_transect, self.axis_plot_sample_position_on_transect = \
|
|
plt.subplots(nrows=1, ncols=1, layout="constrained")
|
|
self.canvas_plot_sample_position_on_transect = FigureCanvas(self.figure_plot_sample_position_on_transect)
|
|
self.verticalLayout_groupbox_plot_sample_position_on_transect.addWidget(self.canvas_plot_sample_position_on_transect)
|
|
|
|
if stg.BS_stream_bed.size == 0:
|
|
|
|
val_min = np.nanmin(stg.BS_cross_section[stg.freq_bottom_detection, :, :])
|
|
val_max = np.nanmax(stg.BS_cross_section[stg.freq_bottom_detection, :, :])
|
|
if val_min == 0:
|
|
val_min = 1e-5
|
|
|
|
self.axis_plot_sample_position_on_transect.pcolormesh(
|
|
stg.t[stg.freq_bottom_detection, :],
|
|
-stg.r[stg.freq_bottom_detection, :],
|
|
stg.BS_cross_section[stg.freq_bottom_detection, :, :],
|
|
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
|
|
|
if stg.r_bottom.size != 0:
|
|
self.axis_plot_sample_position_on_transect.plot(
|
|
stg.t[stg.freq_bottom_detection, :],
|
|
-stg.r_bottom, color='black', linewidth=1, linestyle="solid")
|
|
|
|
else:
|
|
|
|
val_min = np.nanmin(stg.BS_stream_bed[stg.freq_bottom_detection, :, :])
|
|
val_max = np.nanmax(stg.BS_stream_bed[stg.freq_bottom_detection, :, :])
|
|
if val_min == 0:
|
|
val_min = 1e-5
|
|
|
|
self.axis_plot_sample_position_on_transect.pcolormesh(
|
|
stg.t[stg.freq_bottom_detection, :],
|
|
-stg.r[stg.freq_bottom_detection, :],
|
|
stg.BS_stream_bed[stg.freq_bottom_detection, :, :],
|
|
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
|
|
|
if stg.r_bottom.size != 0:
|
|
self.axis_plot_sample_position_on_transect.plot(
|
|
stg.t[stg.freq_bottom_detection, :], -stg.r_bottom,
|
|
color='black', linewidth=1, linestyle="solid")
|
|
|
|
self.axis_plot_sample_position_on_transect.set_xticks([])
|
|
self.axis_plot_sample_position_on_transect.set_yticks([])
|
|
self.figure_plot_sample_position_on_transect.canvas.draw_idle()
|
|
|
|
def update_plot_transect_with_sample_position(self):
|
|
|
|
# --- List selected sand and fine samples ---
|
|
sand_position_list, fine_position_list = self.sample_choice()
|
|
|
|
# --- Create canvas of Matplotlib figure ---
|
|
if stg.BS_raw_data.size == 0:
|
|
|
|
self.verticalLayout_groupbox_plot_sample_position_on_transect.removeWidget(
|
|
self.canvas_plot_sample_position_on_transect)
|
|
self.figure_plot_sample_position_on_transect, self.axis_plot_sample_position_on_transect = \
|
|
plt.subplots(nrows=1, ncols=1, layout="constrained")
|
|
self.canvas_plot_sample_position_on_transect = FigureCanvas(self.figure_plot_sample_position_on_transect)
|
|
self.verticalLayout_groupbox_plot_sample_position_on_transect.addWidget(
|
|
self.canvas_plot_sample_position_on_transect)
|
|
|
|
if sand_position_list:
|
|
self.axis_plot_sample_position_on_transect.scatter(stg.sample_time[sand_position_list],
|
|
stg.sample_depth[sand_position_list],
|
|
marker="o", s=20)
|
|
|
|
if fine_position_list:
|
|
self.axis_plot_sample_position_on_transect.scatter(stg.sample_time[fine_position_list],
|
|
stg.sample_depth[fine_position_list],
|
|
marker="o", s=14)
|
|
|
|
self.axis_plot_sample_position_on_transect.set_xticks([])
|
|
self.axis_plot_sample_position_on_transect.set_yticks([])
|
|
self.figure_plot_sample_position_on_transect.canvas.draw_idle()
|
|
|
|
elif stg.BS_stream_bed.size == 0:
|
|
|
|
val_min = np.nanmin(stg.BS_cross_section[stg.freq_bottom_detection, :, :])
|
|
val_max = np.nanmax(stg.BS_cross_section[stg.freq_bottom_detection, :, :])
|
|
if val_min == 0:
|
|
val_min = 1e-5
|
|
|
|
self.axis_plot_sample_position_on_transect.pcolormesh(
|
|
stg.t[stg.freq_bottom_detection, :], -stg.r[stg.freq_bottom_detection, :],
|
|
stg.BS_cross_section[self.combobox_frequency.currentIndex(), :, :],
|
|
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
|
|
|
if stg.r_bottom.size != 0:
|
|
self.axis_plot_sample_position_on_transect.plot(
|
|
stg.t[stg.freq_bottom_detection, :], -stg.r_bottom,
|
|
color='black', linewidth=1, linestyle="solid")
|
|
|
|
if sand_position_list:
|
|
self.axis_plot_sample_position_on_transect.scatter(stg.sample_time[sand_position_list],
|
|
stg.sample_depth[sand_position_list],
|
|
marker="o", s=20)
|
|
# markeredgecolor='k', markerfacecolor='none')
|
|
|
|
if fine_position_list:
|
|
self.axis_plot_sample_position_on_transect.scatter(stg.sample_time[fine_position_list],
|
|
stg.sample_depth[fine_position_list],
|
|
marker="o", s=14)
|
|
# markeredgecolor='k', markerfacecolor='k')
|
|
|
|
self.axis_plot_sample_position_on_transect.set_xticks([])
|
|
self.axis_plot_sample_position_on_transect.set_yticks([])
|
|
self.figure_plot_sample_position_on_transect.canvas.draw_idle()
|
|
|
|
else:
|
|
|
|
val_min = np.nanmin(stg.BS_stream_bed[stg.freq_bottom_detection, :, :])
|
|
val_max = np.nanmax(stg.BS_stream_bed[stg.freq_bottom_detection, :, :])
|
|
if val_min == 0:
|
|
val_min = 1e-5
|
|
|
|
self.axis_plot_sample_position_on_transect.pcolormesh(
|
|
stg.t[stg.freq_bottom_detection, :], -stg.r[stg.freq_bottom_detection, :],
|
|
stg.BS_stream_bed[self.combobox_frequency.currentIndex(), :, :],
|
|
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
|
|
|
if stg.r_bottom.size != 0:
|
|
self.axis_plot_sample_position_on_transect.plot(
|
|
stg.t[stg.freq_bottom_detection, :], -stg.r_bottom, color='black', linewidth=1, linestyle="solid")
|
|
|
|
if sand_position_list:
|
|
self.axis_plot_sample_position_on_transect.scatter(stg.sample_time[sand_position_list],
|
|
stg.sample_depth[sand_position_list],
|
|
marker="o", s=20)
|
|
|
|
if fine_position_list:
|
|
self.axis_plot_sample_position_on_transect.scatter(stg.sample_time[fine_position_list],
|
|
stg.sample_depth[fine_position_list],
|
|
marker="o", s=14)
|
|
|
|
self.axis_plot_sample_position_on_transect.set_xticks([])
|
|
self.axis_plot_sample_position_on_transect.set_yticks([])
|
|
self.figure_plot_sample_position_on_transect.canvas.draw_idle()
|
|
|
|
def sample_choice(self):
|
|
# --- List selected sand samples ---
|
|
sand_position_list = [int(s[1:])-1 for s in self.combobox_calibration_sand_sample.currentData()]
|
|
print(f"sand_position_list : {sand_position_list}")
|
|
# print(f"sand samples checked : {sand_samples_checked}")
|
|
|
|
# --- List selected fine samples ---
|
|
fine_position_list = [int(s[1:])-1 for s in self.combobox_calibration_fine_sample.currentData()]
|
|
print(f"fine_position_list : {fine_position_list}")
|
|
# print(f"fine samples checked : {fine_samples_checked}")
|
|
return sand_position_list, fine_position_list
|
|
|
|
def frequencies_pair_choice_to_compute_VBI(self):
|
|
freq_combination = list(combinations(stg.freq, 2))
|
|
frequencies_position = []
|
|
# for i in range(self.combobox_frequencies_VBI.count()):
|
|
# if self.combobox_frequencies_VBI.itemChecked(i):
|
|
# frequencies_position.append(i)
|
|
# elif (i in frequencies_position) and (not self.combobox_frequencies_VBI.itemChecked(i)):
|
|
# frequencies_position.remove(i)
|
|
frequencies_position.append(self.combobox_frequencies_VBI.currentIndex())
|
|
print(f"frequencies_position : {frequencies_position}")
|
|
|
|
if len(frequencies_position) != 0:
|
|
# print(frequencies_position)
|
|
# print(freq_combination[frequencies_position[0]][0], freq_combination[frequencies_position[0]][1])
|
|
stg.frequencies_to_compute_VBI = (
|
|
np.array([[int(np.where(stg.freq == freq_combination[frequencies_position[0]-1][0])[0][0]),
|
|
freq_combination[frequencies_position[0]-1][0]],
|
|
[int(np.where(stg.freq == freq_combination[frequencies_position[0]-1][1])[0][0]),
|
|
freq_combination[frequencies_position[0]-1][1]]]))
|
|
print(f"stg.frequencies_to_compute_VBI : {stg.frequencies_to_compute_VBI}")
|
|
|
|
# --- add items in combobox of frequency for SSC computation ---
|
|
# for k in range(stg.frequencies_to_compute_VBI.shape[0]+1):
|
|
# self.combobox_frequency_SSC.removeItem(k)
|
|
self.combobox_frequency_SSC.clear()
|
|
for k in range(stg.frequencies_to_compute_VBI.shape[0]+1):
|
|
if k == 0:
|
|
self.combobox_frequency_SSC.addItem(" ")
|
|
else:
|
|
self.combobox_frequency_SSC.addItem(str(1e-6*stg.frequencies_to_compute_VBI[k-1, 1]) + " MHz")
|
|
# for i in range(stg.frequencies_to_compute_VBI.shape[0]):
|
|
# self.combobox_frequency_SSC.setItemChecked(i, False)
|
|
|
|
print("frequencies to compute VBI", stg.frequencies_to_compute_VBI)
|
|
|
|
def frequency_choice_to_compute_SSC(self):
|
|
print(self.combobox_frequency_SSC.currentText())
|
|
print(self.combobox_frequency_SSC.currentIndex())
|
|
# print(self.combobox_frequency_SSC.itemChecked(index))
|
|
|
|
|
|
# if self.combobox_frequency_SSC.itemChecked(index):
|
|
# # itemChecked(index)): # currentIndex() == 0) or (self.combobox_frequency_SSC.currentIndex() == 1):
|
|
# print(self.combobox_frequency_SSC.currentText())
|
|
# print(stg.freq_text)
|
|
# print(np.where(np.array(stg.freq_text) == self.combobox_frequency_SSC.currentText()))
|
|
|
|
# stg.frequency_to_compute_SSC \
|
|
# = np.array([int(np.where(np.array(stg.freq_text) == self.combobox_frequency_SSC.currentText())[0][0]),
|
|
# stg.freq[int(np.where(np.array(stg.freq_text) == self.combobox_frequency_SSC.currentText())[0][0])]])
|
|
#
|
|
# print("stg.frequency_to_compute_SSC ", stg.frequency_to_compute_SSC)
|
|
|
|
# def temperature_value(self):
|
|
# stg.temperature = self.spinbox_temperature.value()
|
|
# print(stg.temperature)
|
|
|
|
def compute_sound_velocity(self):
|
|
stg.water_velocity = self.inv_hc.water_velocity(stg.temperature)
|
|
print("water velocity ", stg.water_velocity)
|
|
|
|
# def compute_kt(self, freq_ind):
|
|
#
|
|
# # stg.kt_corrected = self.inv_hc.kt_corrected(stg.r[int(stg.frequency_to_compute_SSC[0]), :], stg.water_velocity,
|
|
# # stg.gain_rx[[int(stg.frequencies_to_compute_VBI[0, 0]), int(stg.frequencies_to_compute_VBI[1, 0])]],
|
|
# # stg.gain_tx[[int(stg.frequencies_to_compute_VBI[0, 0]), int(stg.frequencies_to_compute_VBI[1, 0])]],
|
|
# # stg.kt[[int(stg.frequencies_to_compute_VBI[0, 0]), int(stg.frequencies_to_compute_VBI[1, 0])]])
|
|
#
|
|
# if stg.ABS_name == "Aquascat 1000R":
|
|
# kt_corrected = self.inv_hc.kt_corrected(stg.r[0, :], stg.water_velocity,
|
|
# stg.gain_rx[freq_ind], stg.gain_tx[freq_ind], stg.kt[0, freq_ind])
|
|
# kt_corrected_2D = np.repeat(kt_corrected, stg.r.shape[1], axis=0)
|
|
# print("kt 2D ", kt_corrected_2D)
|
|
# print("kt 2D shape ", kt_corrected_2D.shape)
|
|
# kt_corrected_3D = np.zeros((kt_corrected_2D.shape[1], kt_corrected_2D.shape[0], stg.t.shape[1]))
|
|
# for k in range(kt_corrected_2D.shape[1]):
|
|
# kt_corrected_3D[k, :, :] = np.repeat(kt_corrected_2D, stg.t.shape[1], axis=1)[:,
|
|
# k * stg.t.shape[1]:(k + 1) * stg.t.shape[1]]
|
|
# print("kt 3D ", kt_corrected_3D)
|
|
# print("kt 3D shape ", kt_corrected_3D.shape)
|
|
# elif stg.ABS_name == "UB-SediFlow":
|
|
# stg.kt_corrected = np.array([[0.003, 0.006]])
|
|
# print("kt ", stg.kt_corrected)
|
|
# print("kt shape ", stg.kt_corrected.shape)
|
|
# stg.kt_corrected_2D = np.array(np.repeat(stg.kt_corrected, stg.r.shape[1], axis=0))
|
|
# print("kt 2D shape ", stg.kt_corrected_2D.shape)
|
|
# stg.kt_corrected_3D = np.zeros((stg.kt_corrected_2D.shape[1], stg.kt_corrected_2D.shape[0], stg.t.shape[1]))
|
|
# for k in range(stg.kt_corrected_2D.shape[1]):
|
|
# stg.kt_corrected_3D[k, :, :] = np.repeat(stg.kt_corrected_2D, stg.t.shape[1], axis=1)[:,
|
|
# k * stg.t.shape[1]:(k + 1) * stg.t.shape[1]]
|
|
# print("kt corrected 3D zeros shape ", stg.kt_corrected_3D.shape)
|
|
#
|
|
# print("kt ", stg.kt_corrected)
|
|
# # print("kt shape ", stg.kt_corrected.shape)
|
|
#
|
|
# # stg.kt_corrected_2D = np.repeat(stg.kt_corrected, stg.r.shape[1], axis=0)
|
|
#
|
|
# # stg.kt_corrected_3D = np.zeros((stg.kt_corrected_2D.shape[1], stg.kt_corrected_2D.shape[0], stg.t.shape[1]))
|
|
# # print("stg.t.shape ", stg.t.shape)
|
|
# # print("kt corrected 3D zeros shape ", stg.kt_corrected_3D.shape)
|
|
# # for k in range(stg.kt_corrected_2D.shape[1]):
|
|
# # stg.kt_corrected_3D[k, :, :] = np.repeat(stg.kt_corrected_2D, stg.t.shape[1], axis=1)[:, k*stg.t.shape[1]:(k+1)*stg.t.shape[1]]
|
|
#
|
|
# # print("kt 2D", np.repeat(stg.kt_corrected[:, :, np.newaxis], stg.t.shape[0], axis=2))
|
|
|
|
def compute_J(self, freq_ind, kt):
|
|
if stg.ABS_name == "Aquascat 1000R":
|
|
print(f"stg.BS_stream_bed.shape : {stg.BS_stream_bed.shape}")
|
|
|
|
if stg.BS_stream_bed.size != 0:
|
|
|
|
if stg.BS_stream_bed_pre_process_SNR.size != 0:
|
|
print("1/ stg.BS_stream_bed_pre_process_SNR")
|
|
stg.J_cross_section = (
|
|
self.inv_hc.j_cross_section(
|
|
stg.BS_stream_bed_pre_process_SNR[freq_ind, :, :],
|
|
stg.r_2D[freq_ind, :, :stg.BS_stream_bed_pre_process_SNR.shape[2]],
|
|
kt[freq_ind, :, :]))
|
|
|
|
elif stg.BS_stream_bed_pre_process_average.size != 0:
|
|
print("2/ stg.BS_stream_bed_pre_process_average")
|
|
stg.J_cross_section = (
|
|
self.inv_hc.j_cross_section(
|
|
stg.BS_stream_bed_pre_process_average[freq_ind, :, :],
|
|
stg.r_2D[freq_ind, :, :stg.BS_stream_bed_pre_process_average.shape[2]],
|
|
kt[freq_ind, :, :]))
|
|
|
|
else:
|
|
print("3/ stg.BS_stream_bed")
|
|
stg.J_cross_section = (
|
|
self.inv_hc.j_cross_section(
|
|
stg.BS_stream_bed[freq_ind, :, :],
|
|
stg.r_2D[freq_ind, :, :stg.BS_stream_bed.shape[2]],
|
|
kt[freq_ind, :, :]))
|
|
|
|
elif stg.BS_cross_section.size != 0:
|
|
|
|
if stg.BS_cross_section_pre_process_SNR.size != 0:
|
|
print("1/ stg.BS_cross_section_pre_process_SNR")
|
|
stg.J_cross_section = (
|
|
self.inv_hc.j_cross_section(
|
|
stg.BS_cross_section_pre_process_SNR[freq_ind, :, :],
|
|
stg.r_2D[freq_ind, :, :stg.BS_cross_section_pre_process_SNR.shape[2]],
|
|
kt[freq_ind, :, :]))
|
|
|
|
elif stg.BS_cross_section_pre_process_average.size != 0:
|
|
print("2/ stg.BS_cross_section_pre_process_average")
|
|
stg.J_cross_section = (
|
|
self.inv_hc.j_cross_section(stg.BS_cross_section_pre_process_average[freq_ind, :, :],
|
|
stg.r_2D[0, :, :stg.BS_cross_section_pre_process_average.shape[2]],
|
|
kt[freq_ind, :, :]))
|
|
|
|
else:
|
|
print("3/ stg.BS_cross_section")
|
|
stg.J_cross_section = (
|
|
self.inv_hc.j_cross_section(
|
|
stg.BS_cross_section[freq_ind, :, :],
|
|
stg.r_2D[freq_ind, :, :stg.BS_cross_section.shape[2]],
|
|
kt[freq_ind, :, :]))
|
|
|
|
elif stg.ABS_name == "UB-SediFlow":
|
|
|
|
if stg.BS_stream_bed.size != 0:
|
|
|
|
if stg.BS_stream_bed_pre_process_SNR.size != 0:
|
|
print("1/ stg.BS_stream_bed_pre_process_SNR")
|
|
stg.J_cross_section = (
|
|
self.inv_hc.j_cross_section(
|
|
stg.BS_stream_bed_pre_process_SNR[freq_ind, :, :],
|
|
stg.r_2D[freq_ind, :, :stg.BS_stream_bed_pre_process_SNR.shape[2]],
|
|
kt[freq_ind, :, :]))
|
|
|
|
elif stg.BS_stream_bed_pre_process_average.size != 0:
|
|
print("2/ stg.BS_stream_bed_pre_process_average")
|
|
stg.J_cross_section = (
|
|
self.inv_hc.j_cross_section(
|
|
stg.BS_stream_bed_pre_process_average[freq_ind, :, :],
|
|
stg.r_2D[freq_ind, :, :stg.BS_stream_bed_pre_process_average.shape[2]],
|
|
kt[freq_ind, :, :]))
|
|
|
|
|
|
|
|
else:
|
|
print("3/ stg.BS_stream_bed")
|
|
stg.J_cross_section = (
|
|
self.inv_hc.j_cross_section(
|
|
stg.BS_stream_bed[freq_ind, :, :],
|
|
stg.r_2D[freq_ind, :, :stg.BS_stream_bed.shape[2]],
|
|
kt[freq_ind, :, :]))
|
|
|
|
elif stg.BS_cross_section.size != 0:
|
|
|
|
if stg.BS_cross_section_pre_process_SNR.size != 0:
|
|
print("2/ stg.BS_cross_section_pre_process_SNR")
|
|
stg.J_cross_section = (
|
|
self.inv_hc.j_cross_section(
|
|
stg.BS_cross_section_pre_process_SNR[freq_ind, :, :],
|
|
stg.r_2D[freq_ind, :, :stg.BS_cross_section_pre_process_SNR.shape[2]],
|
|
kt[freq_ind, :, :]))
|
|
|
|
if stg.BS_cross_section_pre_process_average.size != 0:
|
|
print("1/ stg.BS_cross_section_pre_process_average")
|
|
stg.J_cross_section = (
|
|
self.inv_hc.j_cross_section(stg.BS_cross_section_pre_process_average[freq_ind, :, :],
|
|
stg.r_2D[freq_ind, :,
|
|
:stg.BS_cross_section_pre_process_average.shape[2]],
|
|
kt[freq_ind, :, :]))
|
|
|
|
|
|
|
|
else:
|
|
print("3/ stg.BS_cross_section")
|
|
stg.J_cross_section = (
|
|
self.inv_hc.j_cross_section(
|
|
stg.BS_cross_section[freq_ind, :, :],
|
|
stg.r_2D[freq_ind, :, :stg.BS_cross_section.shape[2]],
|
|
kt[freq_ind, :, :]))
|
|
|
|
|
|
|
|
# stg.J_cross_section = (
|
|
# self.inv_hc.j_cross_section(
|
|
# stg.BS_cross_section_pre_process_average[
|
|
# [int(stg.frequencies_to_compute_VBI[0, 0]), int(stg.frequencies_to_compute_VBI[1, 0])],
|
|
# :, :],
|
|
# stg.r_2D[int(stg.frequency_to_compute_SSC[0]), :, :stg.BS_cross_section_pre_process_average.shape[2]],
|
|
# stg.kt_corrected_3D))
|
|
|
|
# stg.J_cross_section = (
|
|
# self.inv_hc.j_cross_section(
|
|
# stg.BS_cross_section_pre_process_SNR[
|
|
# [int(stg.frequencies_to_compute_VBI[0, 0]), int(stg.frequencies_to_compute_VBI[1, 0])],
|
|
# :, :],
|
|
# stg.r_2D[int(stg.frequency_to_compute_SSC[0]), :,
|
|
# :stg.BS_cross_section_pre_process_SNR.shape[2]],
|
|
# stg.kt_corrected_3D))
|
|
|
|
# stg.J_cross_section = (
|
|
# self.inv_hc.j_cross_section(
|
|
# stg.BS_cross_section[
|
|
# [int(stg.frequencies_to_compute_VBI[0, 0]), int(stg.frequencies_to_compute_VBI[1, 0])],
|
|
# :, :],
|
|
# stg.r_2D[int(stg.frequency_to_compute_SSC[0]), :,
|
|
# :stg.BS_cross_section.shape[2]],
|
|
# stg.kt_corrected_3D))
|
|
|
|
# stg.J_stream_bed = (
|
|
# self.inv_hc.j_cross_section(
|
|
# stg.BS_stream_bed_pre_process_average[
|
|
# [int(stg.frequencies_to_compute_VBI[0, 0]), int(stg.frequencies_to_compute_VBI[1, 0])],
|
|
# :, :],
|
|
# stg.r_2D[int(stg.frequency_to_compute_SSC[0]), :, :stg.BS_stream_bed_pre_process_average.shape[2]],
|
|
# stg.kt_corrected_3D))
|
|
|
|
|
|
# stg.J_stream_bed = (
|
|
# self.inv_hc.j_cross_section(
|
|
# stg.BS_stream_bed_pre_process_SNR[
|
|
# [int(stg.frequencies_to_compute_VBI[0, 0]), int(stg.frequencies_to_compute_VBI[1, 0])],
|
|
# :, :],
|
|
# stg.r_2D[int(stg.frequency_to_compute_SSC[0]), :, :stg.BS_stream_bed_pre_process_SNR.shape[2]],
|
|
# stg.kt_corrected_3D))
|
|
|
|
# stg.J_stream_bed = (
|
|
# self.inv_hc.j_cross_section(
|
|
# stg.BS_stream_bed[
|
|
# [int(stg.frequencies_to_compute_VBI[0, 0]), int(stg.frequencies_to_compute_VBI[1, 0])],
|
|
# :, :],
|
|
# stg.r_2D[int(stg.frequency_to_compute_SSC[0]), :,
|
|
# :stg.BS_stream_bed.shape[2]],
|
|
# stg.kt_corrected_3D))
|
|
|
|
# elif (stg.BS_data_section_averaged.size == 0) and (stg.BS_data_section_SNR_filter.size == 0):
|
|
# stg.J_cross_section = (
|
|
# self.inv_hc.j_cross_section(
|
|
# stg.BS_data_section[[int(stg.frequencies_to_compute_VBI[0, 0]),
|
|
# int(stg.frequencies_to_compute_VBI[1, 0])], :, :],
|
|
# stg.r_2D[int(stg.frequency_to_compute_SSC[0]), :, :stg.BS_data_section.shape[2]], stg.kt_corrected_3D))
|
|
# elif (stg.BS_data_section_averaged.size != 0) and (stg.BS_data_section_SNR_filter.size == 0):
|
|
# print("Je suis dans ce J")
|
|
# stg.J_cross_section = (
|
|
# self.inv_hc.j_cross_section(
|
|
# stg.BS_data_section_averaged[[0, 2], :, :],
|
|
# stg.r_2D[[0, 2], :, :stg.BS_data_section_averaged.shape[2]],
|
|
# stg.kt_corrected_3D[[0, 1], :, :]))
|
|
# stg.J_cross_section = (
|
|
# self.inv_hc.j_cross_section(
|
|
# stg.BS_data_section_averaged[[int(stg.frequencies_to_compute_VBI[0, 0]),
|
|
# int(stg.frequencies_to_compute_VBI[1, 0])], :, :],
|
|
# stg.r_2D[int(stg.frequency_to_compute_SSC[0]), :, :stg.BS_data_section_averaged.shape[2]], stg.kt_corrected_3D))
|
|
# else:
|
|
# print("stg.r_2D.shape ", stg.r_2D.shape)
|
|
# print("stg.kt_corrected_3D.shape ", stg.kt_corrected_3D.shape)
|
|
# stg.J_cross_section = (
|
|
# self.inv_hc.j_cross_section(
|
|
# stg.BS_data_section_SNR_filter[[int(stg.frequencies_to_compute_VBI[0, 0]),
|
|
# int(stg.frequencies_to_compute_VBI[1, 0])], :, :],
|
|
# stg.r_2D[int(stg.frequency_to_compute_SSC[0]), :, :stg.BS_data_section_SNR_filter.shape[2]], stg.kt_corrected_3D))
|
|
#
|
|
# print("J ", stg.J_cross_section)
|
|
# print("J sahpe ", stg.J_cross_section.shape)
|
|
|
|
# if stg.BS_data_section.size == 0:
|
|
# stg.J_cross_section = (
|
|
# self.inv_hc.j_cross_section(
|
|
# stg.BS_data[
|
|
# [int(stg.frequencies_to_compute_VBI[0, 0]), int(stg.frequencies_to_compute_VBI[1, 0])],
|
|
# :, :], stg.r_2D[int(stg.frequency_to_compute_SSC[0]), :, :stg.BS_data.shape[2]],
|
|
# stg.kt_corrected_3D))
|
|
# elif (stg.BS_data_section_averaged.size == 0) and (stg.BS_data_section_SNR_filter.size == 0):
|
|
# stg.J_cross_section = (
|
|
# self.inv_hc.j_cross_section(
|
|
# stg.BS_data_section[[int(stg.frequencies_to_compute_VBI[0, 0]),
|
|
# int(stg.frequencies_to_compute_VBI[1, 0])], :, :],
|
|
# np.array([stg.r_2D[0, :, :stg.BS_data_section.shape[2]]]),
|
|
# stg.kt_corrected_3D))
|
|
# elif (stg.BS_data_section_averaged.size != 0) and (stg.BS_data_section_SNR_filter.size == 0):
|
|
# print("Je suis dans ce J")
|
|
# stg.J_cross_section = (
|
|
# self.inv_hc.j_cross_section(
|
|
# stg.BS_data_section_averaged[[0, 2], :, :],
|
|
# stg.r_2D[[0, 2], :, :stg.BS_data_section_averaged.shape[2]],
|
|
# stg.kt_corrected_3D[[0, 1], :, :]))
|
|
# # stg.J_cross_section = (
|
|
# # self.inv_hc.j_cross_section(
|
|
# # stg.BS_data_section_averaged[[int(stg.frequencies_to_compute_VBI[0, 0]),
|
|
# # int(stg.frequencies_to_compute_VBI[1, 0])], :, :],
|
|
# # stg.r_2D[int(stg.frequency_to_compute_SSC[0]), :, :stg.BS_data_section_averaged.shape[2]], stg.kt_corrected_3D))
|
|
# else:
|
|
# print("stg.r_2D.shape ", stg.r_2D.shape)
|
|
# print("stg.kt_corrected_3D.shape ", stg.kt_corrected_3D.shape)
|
|
# stg.J_cross_section = (
|
|
# self.inv_hc.j_cross_section(
|
|
# stg.BS_data_section_SNR_filter[[int(stg.frequencies_to_compute_VBI[0, 0]),
|
|
# int(stg.frequencies_to_compute_VBI[1, 0])], :, :],
|
|
# stg.r_2D[int(stg.frequency_to_compute_SSC[0]), :, :stg.BS_data_section_SNR_filter.shape[2]],
|
|
# stg.kt_corrected_3D))
|
|
#
|
|
# print("J ", stg.J_cross_section)
|
|
# print("J sahpe ", stg.J_cross_section.shape)
|
|
|
|
return stg.J_cross_section
|
|
|
|
# def compute_alpha_s(self, freq, freq_ind):
|
|
# stg.sv = self.compute_sv(freq)
|
|
# j_cross_section = self.compute_J(freq_ind)
|
|
# stg.alpha_s = np.log(stg.sv / j_cross_section) / (4 * stg.sample_depth[10]) - stg.water_attenuation
|
|
# return
|
|
|
|
# def compute_zeta(self):
|
|
# stg.zeta_freq1 = self.inv_hc.zeta(0, 2)
|
|
# stg.zeta_freq2 = self.inv_hc.zeta()
|
|
# # stg.zeta = self.inv_hc.zeta(int(stg.frequencies_to_compute_VBI[0, 0]), int(stg.frequencies_to_compute_VBI[1, 0]))
|
|
# print("zeta ", stg.zeta)
|
|
|
|
# def compute_X(self):
|
|
# stg.X_exponent = self.inv_hc.X_exponent(2) #self.inv_hc.X_exponent(self.combobox_frequencies_VBI.currentIndex())
|
|
# print("X ", stg.X_exponent)
|
|
|
|
# def compute_VBI(self):
|
|
# stg.VBI_cross_section = self.inv_hc.VBI_cross_section(3e5,
|
|
# 1e6,
|
|
# stg.zeta[0],
|
|
# # zeta is already limited to the frequencies pairs so that we just need to select indices 0 and 1
|
|
# stg.zeta[1],
|
|
# stg.J_cross_section[0, :, :],
|
|
# stg.J_cross_section[1, :, :],
|
|
# stg.r_2D[0, :, :stg.t.shape[1]],
|
|
# stg.water_attenuation[0],
|
|
# stg.water_attenuation[1],
|
|
# stg.X_exponent)
|
|
|
|
# stg.VBI_cross_section = self.inv_hc.VBI_cross_section(stg.frequencies_to_compute_VBI[0, 1], stg.frequencies_to_compute_VBI[1, 1],
|
|
# stg.zeta[0], # zeta is already limited to the frequencies pairs so that we just need to select indices 0 and 1
|
|
# stg.zeta[1],
|
|
# stg.J_cross_section[0, :, :],
|
|
# stg.J_cross_section[1, :, :],
|
|
# stg.r_2D[int(stg.frequency_to_compute_SSC[0]), :, :stg.t.shape[1]],
|
|
# stg.water_attenuation[0],
|
|
# stg.water_attenuation[1],
|
|
# stg.X_exponent)
|
|
# print("VBI shape ", stg.VBI_cross_section.shape)
|
|
# print(int(self.combobox_frequency_SSC.currentIndex()))
|
|
# print(stg.zeta[int(self.combobox_frequency_SSC.currentIndex())])
|
|
|
|
def range_cells_function(self):
|
|
""" Computing the real cell size, that depends on the temperature """
|
|
# defaut Aquascat cell size
|
|
aquascat_cell_size = stg.r[0, 1] - stg.r[0, 0]
|
|
# Pulse duration
|
|
tau = aquascat_cell_size * 2 / 1500 # figure 2.9 1500 vitesse du son entrée pour le paramètrage des mesures aquascat
|
|
# Sound speed
|
|
cel = self.inv_hc.water_velocity(self.spinbox_temperature.value())
|
|
# Real cell size
|
|
real_cell_size = cel * tau / 2 # voir fig 2.9
|
|
|
|
# Converting to real cell profile
|
|
real_r = np.zeros((stg.freq.shape[0], stg.r.shape[1]))
|
|
for i in range(stg.freq.shape[0]):
|
|
real_r[i, :] = stg.r[i, :] / aquascat_cell_size * real_cell_size # (/ aquascat_cell_size) pour ramener BS.r entre 0 et 1
|
|
# (* real_cell_size) pour remettre les échelles spatiales sur la taille réelle des cellules
|
|
|
|
# R with right shape (numpy array)
|
|
R_real = real_r # np.repeat(real_r, len(stg.freq), axis=1)
|
|
print(f"R_real = {R_real.shape}")
|
|
|
|
return R_real
|
|
|
|
def compute_acoustic_inversion_method_high_concentration(self):
|
|
|
|
# --- List selected sand and fine samples ---
|
|
sand_position_list, fine_position_list = self.sample_choice()
|
|
|
|
if stg.ABS_name == "Aquascat 1000R":
|
|
|
|
freq1 = int(self.combobox_freq1.currentIndex()) # 0 = 300kHz et 1 = 500kHz
|
|
freq2 = int(self.combobox_freq2.currentIndex()) # 2 = 1MHz
|
|
print(f"freq1 = {freq1}, freq2 = {freq2}")
|
|
|
|
stg.water_velocity = self.inv_hc.water_velocity(stg.temperature)
|
|
|
|
alpha_w_freq1, alpha_w_freq2 = (self.inv_hc.water_attenuation(freq=stg.freq[freq1], T=stg.temperature),
|
|
self.inv_hc.water_attenuation(freq=stg.freq[freq2], T=stg.temperature))
|
|
print(f"alpha_w_freq1 = {alpha_w_freq1}, alpha_w_freq2 = {alpha_w_freq2}")
|
|
|
|
self.compute_sound_velocity()
|
|
|
|
# print("ks value : ", self.inv_hc.ks(a_s=stg.sand_sediment_columns[5:], rho_s=2500, freq=stg.freq[0], pdf=stg.frac_vol_sand[2, :]))
|
|
|
|
# ks_freq1, ks_freq2 = (
|
|
# self.inv_hc.ks(num_sample=2, freq=stg.freq[freq1], pdf=stg.frac_vol_sand_cumul[2, :]),
|
|
# self.inv_hc.ks(num_sample=2, freq=stg.freq[freq2], pdf=stg.frac_vol_sand_cumul[2, :]))
|
|
ks_freq1, ks_freq2 = (
|
|
self.inv_hc.ks(num_sample=sand_position_list[0], freq=stg.freq[freq1], pdf=stg.frac_vol_sand_cumul[sand_position_list[0], :]),
|
|
self.inv_hc.ks(num_sample=sand_position_list[0], freq=stg.freq[freq2], pdf=stg.frac_vol_sand_cumul[sand_position_list[0], :]))
|
|
# 6 = V11 , 10 = V12 sur le notebook d'Adrien
|
|
# ks_freq1, ks_freq2 = self.inv_hc.ks()[0], self.inv_hc.ks()[2]
|
|
print(f"ks_freq1 = {ks_freq1}, ks_freq2 = {ks_freq2}")
|
|
|
|
# f = self.inv_hc.form_factor_function_MoateThorne2012(np.log(np.logspace(-10, -2, 3000)), stg.freq[2])
|
|
# fig, ax = plt.subplots(nrows=1, ncols=1)
|
|
# ax.plot(list(range(len(np.log(np.logspace(-10, -2, 3000))))), f, color="k", ls="solid")
|
|
# plt.show()
|
|
|
|
# sv_freq1, sv_freq2 = (
|
|
# self.inv_hc.sv(ks=ks_freq1, M_sand=stg.Ctot_sand[2]),
|
|
# self.inv_hc.sv(ks=ks_freq2, M_sand=stg.Ctot_sand[2]))
|
|
sv_freq1, sv_freq2 = (
|
|
self.inv_hc.sv(ks=ks_freq1, M_sand=stg.Ctot_sand[sand_position_list[0]]),
|
|
self.inv_hc.sv(ks=ks_freq2, M_sand=stg.Ctot_sand[sand_position_list[0]]))
|
|
print(f"sv_freq1 = {sv_freq1}, sv_freq2 = {sv_freq2}")
|
|
|
|
X_exponent = self.inv_hc.X_exponent(freq1=stg.freq[freq1], freq2=stg.freq[freq2], sv_freq1=sv_freq1, sv_freq2=sv_freq2)
|
|
# X_exponent = self.inv_hc.X_exponent(ind=2)
|
|
print(f"X_exponent = {X_exponent}")
|
|
|
|
stg.kt = np.array([[0.04], [0.01838], [0.03267], [0.01376]])
|
|
kt = np.array([])
|
|
for i, v in enumerate(stg.kt):
|
|
kt = np.append(kt, self.inv_hc.kt_corrected(r=stg.r[i, :],
|
|
water_velocity=stg.water_velocity,
|
|
RxGain=stg.gain_rx[i],
|
|
TxGain=stg.gain_tx[i],
|
|
kt_ref=stg.kt[i]))
|
|
kt = np.reshape(kt, (len(kt), 1))
|
|
print(f"kt = {kt}")
|
|
kt2D = np.repeat(np.array(kt), stg.r.shape[1], axis=1)
|
|
print(f"kt2D.shape = {kt2D.shape}")
|
|
# print(f"kt2D = {kt2D}")
|
|
kt3D = np.repeat(kt2D[:, :, np.newaxis], stg.t.shape[1], axis=2)
|
|
print(f"kt3D.shape = {kt3D.shape}")
|
|
# print(f"kt3D = {kt3D}")
|
|
|
|
# kt_freq1, kt_freq2 = (
|
|
# self.inv_hc.kt_corrected(r=stg.r[0, :], water_velocity=stg.water_velocity, RxGain=stg.gain_rx[0],
|
|
# TxGain=stg.gain_tx[0], kt_ref=stg.kt[0]),
|
|
# self.inv_hc.kt_corrected(r=stg.r[2, :], water_velocity=stg.water_velocity, RxGain=stg.gain_rx[2],
|
|
# TxGain=stg.gain_tx[2], kt_ref=stg.kt[2]))
|
|
# print(f"kt_freq1 = {kt_freq1}, kt_freq2 = {kt_freq2}")
|
|
# kt2D_freq1 = np.full((stg.r.shape[1], stg.t.shape[1]), kt_freq1)
|
|
# kt2D_freq2 = np.full((stg.r.shape[1], stg.t.shape[1]), kt_freq2)
|
|
# print(f"kt2D_freq1 = {kt2D_freq1.shape}")
|
|
# print(f"kt2D_freq2 = {kt2D_freq2.shape}")
|
|
# kt3D = np.repeat(kt2D[:, :, np.newaxis], stg.t.shape[1], axis=2)
|
|
# print(f"kt_3D = {kt3D.shape}")
|
|
# print(f"kt_3D = {kt3D}")
|
|
|
|
# kt_freq1, kt_freq2 = (
|
|
# np.full((stg.r.shape[1], stg.t.shape[1]), stg.kt[0]),
|
|
# np.full((stg.r.shape[1], stg.t.shape[1]), stg.kt[2]))
|
|
# print(f"kt_freq1 = {kt_freq1.shape}, kt_freq2 = {kt_freq2.shape}")
|
|
|
|
J_freq1, J_freq2 = self.compute_J(freq_ind=freq1, kt=kt3D), self.compute_J(freq_ind=freq2, kt=kt3D)
|
|
print(f"J_freq1 = {J_freq1.shape}, J_freq2 = {J_freq2.shape}")
|
|
|
|
# fig, ax = plt.subplots(nrows=1, ncols=1)
|
|
# pcm = ax.pcolormesh(stg.t[0, :], stg.r[0, :], J_freq2, cmap='rainbow', shading='gouraud')
|
|
# fig.colorbar(pcm, ax=ax, shrink=1, location='right')
|
|
# plt.show()
|
|
|
|
# print("***************************")
|
|
# print(sv_freq1.shape)
|
|
# print(J_freq1.shape)
|
|
# print(np.repeat(stg.r[0, :][:, np.newaxis], stg.t.shape[1], axis=1).shape)
|
|
# print(np.full((stg.r.shape[1], stg.t.shape[1]), alpha_w_freq1).shape)
|
|
# print("***************************")
|
|
|
|
r_sample_ind = []
|
|
t_sample_ind = []
|
|
for i in range(len(stg.sample_depth[fine_position_list])): #:3
|
|
# for i in range(len(stg.sample_depth[:3])): #:3
|
|
# print(-stg.sample_depth[i])
|
|
# print(-stg.sample_time[i])
|
|
r_sample_ind.append(np.where(np.abs(stg.r[0, :] - (-stg.sample_depth[i])) ==
|
|
np.nanmin(np.abs(stg.r[0, :] - (-stg.sample_depth[i])))))
|
|
# print(np.abs(stg.t[0, :] - (-stg.sample_time[i])))
|
|
t_sample_ind.append(np.where(np.abs(stg.t[0, :] - (stg.sample_time[i])) ==
|
|
np.nanmin(np.abs(stg.t[0, :] - (stg.sample_time[i])))))
|
|
print(f"r_sample_ind = {r_sample_ind}")
|
|
print(f"t_sample_ind = {t_sample_ind}")
|
|
# print("J_freq1[r_sample_ind[1][0], t_sample_ind[1][0]] ", J_freq1[r_sample_ind[1][0], t_sample_ind[1][0]])
|
|
|
|
# ind_r_min = int(ind_X_min_around_sample[p, k])
|
|
# print(f"ind_r_min = {ind_r_min}")
|
|
# ind_r_max = int(ind_X_max_around_sample[p, k])
|
|
# print(f"ind_r_max = {ind_r_max}")
|
|
# ind_t_min = int(ind_r_min_around_sample[p, k])
|
|
# print(f"ind_t_min = {ind_t_min}")
|
|
# ind_t_max = int(ind_r_max_around_sample[p, k])
|
|
# print(f"ind_t_max = {ind_t_max}")
|
|
|
|
# print(f"stg.BS freq1 = {stg.BS_stream_bed_pre_process_average[freq1, r_sample_ind[-1], t_sample_ind[-1]]}")
|
|
# print(f"stg.BS freq2 = {stg.BS_stream_bed_pre_process_average[freq2, r_sample_ind[-1], t_sample_ind[-1]]}")
|
|
#
|
|
# print(f"J_freq1[r_sample_ind[-1], t_sample_ind[-1]] {J_freq1[r_sample_ind[-1], t_sample_ind[-1]]}")
|
|
# print(f"J_freq2[r_sample_ind[-1], t_sample_ind[-1]] {J_freq2[r_sample_ind[-1], t_sample_ind[-1]]}")
|
|
#
|
|
# print(f"stg.r[0, r_sample_ind[-1]] {stg.r[2, r_sample_ind[-1]]}")
|
|
|
|
|
|
alpha_s_freq1, alpha_s_freq2 = (
|
|
self.inv_hc.alpha_s(sv=sv_freq1, j_cross_section=J_freq1[r_sample_ind[-1], t_sample_ind[-1]], depth=stg.r[freq1, r_sample_ind[-1]], alpha_w=alpha_w_freq1),
|
|
self.inv_hc.alpha_s(sv=sv_freq2, j_cross_section=J_freq2[r_sample_ind[-1], t_sample_ind[-1]], depth=stg.r[freq2, r_sample_ind[-1]], alpha_w=alpha_w_freq2))
|
|
print(f"alpha_s_freq1 = {alpha_s_freq1}, alpha_s_freq2 = {alpha_s_freq2}")
|
|
|
|
# range_lin_interp, M_profile_fine = self.inv_hc.M_profile_SCC_fine_interpolated(
|
|
# sample_depth=-stg.sample_depth[:3], #:3
|
|
# M_profile=stg.Ctot_fine[:3], #:3
|
|
# range_cells=stg.r[0, :],
|
|
# r_bottom=stg.r_bottom[t_sample_ind[0][0]])
|
|
range_lin_interp, M_profile_fine = self.inv_hc.M_profile_SCC_fine_interpolated(sample_depth=-stg.sample_depth[fine_position_list], #:3
|
|
M_profile=stg.Ctot_fine[fine_position_list], #:3
|
|
range_cells=stg.r[0, :],
|
|
r_bottom=stg.r_bottom[t_sample_ind[0][0]])
|
|
print(f"range_lin_interp : {range_lin_interp}")
|
|
print(f"M_profile_fine : {M_profile_fine}")
|
|
|
|
M_profile_fine = M_profile_fine[:len(range_lin_interp)]
|
|
print(f"M_profile_fine : {M_profile_fine}")
|
|
|
|
|
|
# print("----------------------")
|
|
# print(f"r_sample_ind[-1][0] = {r_sample_ind[-1][0][0]}")
|
|
# print(f"M_profile_fine[:r_sample_ind[-1][0]] = ", M_profile_fine[:r_sample_ind[-1][0][0]])
|
|
# print(f"stg.r[0, r_sample_ind[-1][0]] = ", stg.r[0, r_sample_ind[-1][0][0]])
|
|
# print("----------------------")
|
|
|
|
zeta_freq1, zeta_freq2 = (self.inv_hc.zeta(alpha_s=alpha_s_freq1, r=stg.r[freq1, :], M_profile_fine=M_profile_fine),
|
|
self.inv_hc.zeta(alpha_s=alpha_s_freq2, r=stg.r[freq2, :], M_profile_fine=M_profile_fine))
|
|
# zeta_freq1, zeta_freq2 = (
|
|
# self.inv_hc.zeta(r=stg.r[0, :r_sample_ind[-1][0][0]], M_profile_fine=M_profile_fine[:r_sample_ind[-1][0][0]]),
|
|
# self.inv_hc.zeta(r=stg.r[0, :r_sample_ind[-1][0][0]], M_profile_fine=M_profile_fine[:r_sample_ind[-1][0][0]]))
|
|
print(f"zeta_freq1 = {zeta_freq1}, zeta_freq2 = {zeta_freq2}")
|
|
# plt.figure()
|
|
# plt.plot(stg.r[0, :], Mprofile, 'b.', -stg.sample_depth[:3], stg.Ctot_fine[:3], 'ko')
|
|
# plt.show()
|
|
|
|
# --- Fill spinboxes with values of parameters ---
|
|
self.spinbox_ks_freq1.setValue(ks_freq1)
|
|
self.spinbox_ks_freq2.setValue(ks_freq2)
|
|
self.spinbox_sv_freq1.setValue(sv_freq1)
|
|
self.spinbox_sv_freq2.setValue(sv_freq2)
|
|
self.spinbox_X.setValue(X_exponent)
|
|
self.spinbox_alphas_freq1.setValue(alpha_s_freq1)
|
|
self.spinbox_alphas_freq2.setValue(alpha_s_freq2)
|
|
self.spinbox_zeta_freq1.setValue(zeta_freq1)
|
|
self.spinbox_zeta_freq2.setValue(zeta_freq2)
|
|
|
|
# fig, ax = plt.subplots(nrows=2, ncols=1)
|
|
# pcm1 = ax[0].pcolormesh(stg.t[0, :], -stg.r[0, :], J_freq1,
|
|
# cmap='rainbow', vmin=0, vmax=1e-5, shading='gouraud')
|
|
# cbar1 = fig.colorbar(pcm1, ax=ax[0], shrink=1, location='right')
|
|
# cbar1.set_label(label='J (/m', rotation=270, labelpad=15)
|
|
# pcm2 = ax[1].pcolormesh(stg.t[0, :], -stg.r[0, :], J_freq2,
|
|
# cmap='rainbow', vmin=0, vmax=1e-4, shading='gouraud')
|
|
# cbar2 = fig.colorbar(pcm2, ax=ax[1], shrink=1, location='right')
|
|
# cbar2.set_label(label='J (/m', rotation=270, labelpad=15)
|
|
# fig.supxlabel("Time (sec)", fontsize=10)
|
|
# fig.supylabel("Depth (m)", fontsize=10)
|
|
# plt.show()
|
|
|
|
stg.VBI_cross_section = self.inv_hc.VBI_cross_section(stg.freq[freq1], stg.freq[freq2],
|
|
zeta_freq1, zeta_freq2,
|
|
J_freq1, J_freq2,
|
|
stg.r_2D[freq1, :, :stg.t.shape[1]],
|
|
alpha_w_freq1, alpha_w_freq2,
|
|
X_exponent)
|
|
|
|
stg.SSC_fine = self.inv_hc.SSC_fine(zeta_freq2, stg.r_2D[freq2, :, :stg.t.shape[1]],
|
|
stg.VBI_cross_section, stg.freq[freq2], X_exponent, J_freq2,
|
|
np.full(shape=(stg.r.shape[1], stg.t.shape[1]), fill_value=alpha_w_freq2))
|
|
|
|
stg.SSC_sand = self.inv_hc.SSC_sand(stg.VBI_cross_section, stg.freq[freq2], X_exponent, ks_freq2)
|
|
|
|
elif stg.ABS_name == "UB-SediFlow":
|
|
|
|
freq1 = int(self.combobox_freq1.currentIndex()) # 0 = 500kHz
|
|
freq2 = int(self.combobox_freq2.currentIndex()) # 1 = 1MHz
|
|
|
|
stg.water_velocity = self.inv_hc.water_velocity(stg.temperature)
|
|
|
|
alpha_w_freq1, alpha_w_freq2 = (self.inv_hc.water_attenuation(freq=stg.freq[freq1], T=stg.temperature),
|
|
self.inv_hc.water_attenuation(freq=stg.freq[freq2], T=stg.temperature))
|
|
print(f"alpha_w_freq1 = {alpha_w_freq1}, alpha_w_freq2 = {alpha_w_freq2}")
|
|
|
|
self.compute_sound_velocity()
|
|
|
|
# ks_freq1, ks_freq2 = 0.11373812635175432, 0.35705575378038723
|
|
# ks_freq1, ks_freq2 = (self.inv_hc.form_factor_function_MoateThorne2012(a=100e-6, freq=stg.freq[freq1])/np.sqrt(2500*100e-6),
|
|
# self.inv_hc.form_factor_function_MoateThorne2012(a=100e-6, freq=stg.freq[freq2])/np.sqrt(2500*100e-6))
|
|
|
|
ks_freq1, ks_freq2 = (
|
|
self.inv_hc.ks(num_sample=sand_position_list[0], freq=stg.freq[freq1], pdf=stg.frac_vol_sand_cumul[sand_position_list[0], :]),
|
|
self.inv_hc.ks(num_sample=sand_position_list[0], freq=stg.freq[freq2], pdf=stg.frac_vol_sand_cumul[sand_position_list[0], :]))
|
|
# ks_freq1 = 0.05261498026985425
|
|
# ks_freq2 = 0.19303997854869764
|
|
print(f"ks_freq1 = {ks_freq1}, ks_freq2 = {ks_freq2}")
|
|
|
|
# Fine sediments 19/05/2021 15h11 - 15h42 (locale) = 13h10 - 13h42 (UTC) --> 6 samples
|
|
# 52 to 428 / fixed at 234
|
|
# 14h10 = position 766
|
|
# Sand sediments 20/05/2021 12h04 - 12h20 (locale) = 10h04 - 10h20 (UTC) --> 2 samples
|
|
# 777 to 972 / fixed at 777
|
|
|
|
sv_freq1, sv_freq2 = (
|
|
self.inv_hc.sv(ks=ks_freq1, M_sand=stg.Ctot_sand[sand_position_list[0]]),
|
|
self.inv_hc.sv(ks=ks_freq2, M_sand=stg.Ctot_sand[sand_position_list[0]]))
|
|
# sv_freq1 = 0.0004956686799986783
|
|
# sv_freq2 = 0.006672171109602389
|
|
print(f"sv_freq1 = {sv_freq1}, sv_freq2 = {sv_freq2}")
|
|
|
|
X_exponent = self.inv_hc.X_exponent(freq1=stg.freq[freq1], freq2=stg.freq[freq2],
|
|
sv_freq1=sv_freq1, sv_freq2=sv_freq2)
|
|
# X_exponent = 3.750708280862506
|
|
print(f"X_exponent = {X_exponent}")
|
|
|
|
# stg.kt = np.array([[1.38e-3], [6.02e-4]]) # Values of kt for 500kHz and 1MHz
|
|
stg.kt = np.array([[0.5], [0.5]])
|
|
|
|
kt = stg.kt
|
|
# kt = np.array([])
|
|
# for i, v in enumerate(stg.kt):
|
|
# kt = np.append(kt, self.inv_hc.kt_corrected(r=stg.r[i, :],
|
|
# water_velocity=stg.water_velocity,
|
|
# RxGain=0,
|
|
# TxGain=0,
|
|
# kt_ref=stg.kt[i]))
|
|
# kt = np.reshape(kt, (len(kt), 1))
|
|
print(f"kt = {kt}, kt.shape = {kt.shape}")
|
|
kt2D = np.repeat(np.array(kt), stg.r.shape[1], axis=1)
|
|
print(f"kt2D.shape = {kt2D.shape}")
|
|
# print(f"kt2D = {kt2D}")
|
|
kt3D = np.repeat(kt2D[:, :, np.newaxis], stg.t.shape[1], axis=2)
|
|
print(f"kt3D.shape = {kt3D.shape}")
|
|
|
|
J_freq1, J_freq2 = self.compute_J(freq_ind=freq1, kt=kt3D), self.compute_J(freq_ind=freq2, kt=kt3D)
|
|
print(f"J_freq1 = {J_freq1.shape}, J_freq2 = {J_freq2.shape}")
|
|
|
|
r_sample_ind = []
|
|
t_sample_ind = []
|
|
for i in range(len(stg.sample_depth[fine_position_list])):
|
|
# print(-stg.sample_depth[i])
|
|
# print(-stg.sample_time[i])
|
|
r_sample_ind.append(np.where(np.abs(stg.r[freq1, :] - (-stg.sample_depth[i])) ==
|
|
np.nanmin(np.abs(stg.r[freq1, :] - (-stg.sample_depth[i])))))
|
|
# print(np.abs(stg.t[0, :] - (-stg.sample_time[i])))
|
|
t_sample_ind.append(np.where(np.abs(stg.t[freq1, :] - (stg.sample_time[i])) ==
|
|
np.nanmin(np.abs(stg.t[freq1, :] - (stg.sample_time[i])))))
|
|
print(f"r_sample_ind = {r_sample_ind}")
|
|
print(f"t_sample_ind = {t_sample_ind}")
|
|
|
|
print(f"stg.BS freq1 = {stg.BS_cross_section[freq1, r_sample_ind[-1], t_sample_ind[-1]]}")
|
|
print(f"stg.BS freq2 = {stg.BS_cross_section[freq2, r_sample_ind[-1], t_sample_ind[-1]]}")
|
|
|
|
print(f"J_freq1[r_sample_ind[-1], t_sample_ind[-1]] : {J_freq1[r_sample_ind[-1][0][0], t_sample_ind[-1][0][0]]}")
|
|
# print(f"J_freq1[r_sample_ind[-1]+-n, t_sample_ind[-1]+-n] : {J_freq1[r_sample_ind[-1][0][0], t_sample_ind[-1][0][0]:t_sample_ind[-1][0][0]].mean(axis=0)}")
|
|
|
|
# delta_t = 0
|
|
alpha_s_freq1, alpha_s_freq2 = (
|
|
self.inv_hc.alpha_s(sv=sv_freq1,
|
|
j_cross_section=np.mean(J_freq1[r_sample_ind[-1][0][0], t_sample_ind[-1][0][0]]),
|
|
depth=stg.r[freq1, r_sample_ind[-1][0][0]], alpha_w=alpha_w_freq1),
|
|
self.inv_hc.alpha_s(sv=sv_freq2,
|
|
j_cross_section=np.mean(J_freq2[r_sample_ind[-1][0][0], t_sample_ind[-1][0][0]]),
|
|
# j_cross_section=J_freq2[r_sample_ind[-1], t_sample_ind[-1]],
|
|
depth=stg.r[freq2, r_sample_ind[-1][0][0]], alpha_w=alpha_w_freq2))
|
|
|
|
# avec J (alpha_w = 0.03578217234512747)
|
|
# alpha_s_freq1 = -0.12087339
|
|
# alpha_s_freq2 = -0.01437704
|
|
|
|
# avec log(J)
|
|
# alpha_s_freq1 = -1.91967628
|
|
# alpha_s_freq2 = -1.87942544
|
|
|
|
# --- Calculation of alpha_s with FCB slope ---
|
|
|
|
# R_real = np.repeat(self.range_cells_function()[:, :, np.newaxis], stg.t.shape[1], axis=2)
|
|
# water_attenuation = np.full((2, stg.r.shape[1], stg.t.shape[1]), 1)
|
|
# water_attenuation[0, :, :] = alpha_w_freq1*water_attenuation[0, :, :]
|
|
# water_attenuation[1, :, :] = alpha_w_freq2*water_attenuation[1, :, :]
|
|
# if stg.BS_stream_bed.size == 0:
|
|
# stg.FCB = (np.log(stg.BS_cross_section[[freq1, freq2], :, :]) + np.log(R_real[[freq1, freq2], :, :]) +
|
|
# 2 * water_attenuation * R_real[[freq1, freq2], :, :])
|
|
# elif (stg.BS_stream_bed_pre_process_average.size == 0) and (stg.BS_stream_bed_pre_process_SNR.size == 0):
|
|
# stg.FCB = (np.log(stg.BS_stream_bed[[freq1, freq2], :, :]) + np.log(R_real[[freq1, freq2], :, :]) +
|
|
# 2 * water_attenuation * R_real[[freq1, freq2], :, :])
|
|
# elif stg.BS_stream_bed_pre_process_SNR.size == 0:
|
|
# stg.FCB = (np.log(stg.BS_stream_bed_pre_process_average[[freq1, freq2], :, :]) + np.log(R_real[[freq1, freq2], :, :]) +
|
|
# 2 * water_attenuation * R_real[[freq1, freq2], :, :])
|
|
# else:
|
|
# stg.FCB = (np.log(stg.BS_stream_bed_pre_process_SNR[[freq1, freq2], :, :]) + np.log(R_real[[freq1, freq2], :, :]) +
|
|
# 2 * water_attenuation * R_real[[freq1, freq2], :, :])
|
|
#
|
|
# print(f"FCB shape : {stg.FCB.shape}")
|
|
#
|
|
# y1 = stg.FCB[freq1, 5:138, t_sample_ind[-1][0][0]]
|
|
# x1 = stg.r[freq1, 5:138]
|
|
# lin_reg_compute1 = stats.linregress(x1, y1)
|
|
#
|
|
# y2 = stg.FCB[freq2, 5:138, t_sample_ind[-1][0][0]]
|
|
# x2 = stg.r[freq2, 5:138]
|
|
# lin_reg_compute2 = stats.linregress(x2, y2)
|
|
#
|
|
# print(f"lin_reg_compute1 : {lin_reg_compute1}")
|
|
# print(f"lin_reg_compute2 : {lin_reg_compute2}")
|
|
#
|
|
# fig, ax = plt.subplots(nrows=1, ncols=2)
|
|
# ax[0].plot(x1, y1, ls='solid', c='k')
|
|
# ax[0].plot(x1, x1*lin_reg_compute1.slope + lin_reg_compute1.intercept, ls='dashed', c='b')
|
|
# ax[0].set_xlabel("Distance from transducer (m)")
|
|
# ax[0].set_ylabel("FCB")
|
|
# ax[0].set_title("Frequency 500kHz")
|
|
# ax[1].plot(x2, y2, ls='solid', c='k')
|
|
# ax[1].plot(x2, x2*lin_reg_compute2.slope + lin_reg_compute2.intercept, ls='solid', c='r')
|
|
# ax[1].set_xlabel("Distance from transducer (m)")
|
|
# ax[1].set_ylabel("FCB")
|
|
# ax[1].set_title("Frequency 1MHz")
|
|
# plt.show()
|
|
#
|
|
# alpha_s_freq1 , alpha_s_freq2 = -0.5*lin_reg_compute1.slope, -0.5*lin_reg_compute2.slope
|
|
# alpha_s_freq1 = 0.35107724188865586
|
|
# alpha_s_freq2 = 0.37059368399238274
|
|
print(f"alpha_s_freq1 = {alpha_s_freq1}, alpha_s_freq2 = {alpha_s_freq2}")
|
|
|
|
range_lin_interp, M_profile_fine = self.inv_hc.M_profile_SCC_fine_interpolated(
|
|
sample_depth=-stg.sample_depth[:],
|
|
M_profile=stg.Ctot_fine[:],
|
|
range_cells=stg.r[0, :],
|
|
r_bottom=np.array([])) # stg.r_bottom[t_sample_ind[0][0]] is empty
|
|
# M_profile_fine = M_profile_fine[:len(range_lin_interp)]
|
|
# range_lin_interp, M_profile_fine = 3.2, 6.5
|
|
|
|
print(f"range_lin_interp : {range_lin_interp}")
|
|
print(f"M_profile_fine : {M_profile_fine}")
|
|
|
|
# zeta_freq1, zeta_freq2 = (alpha_s_freq1 / (M_profile_fine[0]*(3.19127224 - 0.52102404)),
|
|
# alpha_s_freq2 / (M_profile_fine[0]*(3.19127224 - 0.52102404)))
|
|
zeta_freq1, zeta_freq2 = (
|
|
self.inv_hc.zeta(alpha_s=alpha_s_freq1, r=stg.r[freq1, :], M_profile_fine=M_profile_fine),
|
|
self.inv_hc.zeta(alpha_s=alpha_s_freq2, r=stg.r[freq2, :], M_profile_fine=M_profile_fine))
|
|
# zeta_freq1, zeta_freq2 = zeta_freq1*1e-8, zeta_freq2*1e-8
|
|
# zeta_freq1 = 0.06417348381928434
|
|
# zeta_freq2 = 0.06774089842814904
|
|
# zeta_freq1, zeta_freq2 = 0.03018602, 0.05496619
|
|
print(f"zeta_freq1 = {zeta_freq1}, zeta_freq2 = {zeta_freq2}")
|
|
|
|
# zeta_freq1, zeta_freq2 = 1e-10*self.inv_hc.zeta(ind=1), 1e1*self.inv_hc.zeta(ind=2)
|
|
# print(f"zeta_freq1 = {zeta_freq1}, zeta_freq2 = {zeta_freq2}")
|
|
|
|
# --- Fill spinboxes with values of parameters ---
|
|
self.spinbox_ks_freq1.setValue(ks_freq1)
|
|
self.spinbox_ks_freq2.setValue(ks_freq2)
|
|
self.spinbox_sv_freq1.setValue(sv_freq1)
|
|
self.spinbox_sv_freq2.setValue(sv_freq2)
|
|
self.spinbox_X.setValue(X_exponent)
|
|
self.spinbox_alphas_freq1.setValue(alpha_s_freq1)
|
|
self.spinbox_alphas_freq2.setValue(alpha_s_freq2)
|
|
self.spinbox_zeta_freq1.setValue(zeta_freq1)
|
|
self.spinbox_zeta_freq2.setValue(zeta_freq2)
|
|
|
|
# fig, ax = plt.subplots(nrows=2, ncols=1)
|
|
# pcm1 = ax[0].pcolormesh(stg.t[0, :], -stg.r[0, :], J_freq1,
|
|
# cmap='rainbow', shading='gouraud')
|
|
# cbar1 = fig.colorbar(pcm1, ax=ax[0], shrink=1, location='right')
|
|
# cbar1.set_label(label='J (/m', rotation=270, labelpad=15)
|
|
# pcm2 = ax[1].pcolormesh(stg.t[0, :], -stg.r[0, :], J_freq2,
|
|
# cmap='rainbow', shading='gouraud')
|
|
# cbar2 = fig.colorbar(pcm2, ax=ax[1], shrink=1, location='right')
|
|
# cbar2.set_label(label='J (/m', rotation=270, labelpad=15)
|
|
# fig.supxlabel("Time (sec)", fontsize=10)
|
|
# fig.supylabel("Depth (m)", fontsize=10)
|
|
# plt.show()
|
|
|
|
stg.VBI_cross_section = self.inv_hc.VBI_cross_section(stg.freq[freq1], stg.freq[freq2],
|
|
zeta_freq1, zeta_freq2,
|
|
J_freq1, J_freq2,
|
|
stg.r_2D[freq2, :, :stg.t.shape[1]],
|
|
alpha_w_freq1, alpha_w_freq2,
|
|
X_exponent)
|
|
|
|
|
|
|
|
stg.SSC_fine = self.inv_hc.SSC_fine(zeta_freq2, stg.r_2D[freq2, :, :stg.t.shape[1]],
|
|
stg.VBI_cross_section, stg.freq[freq2], X_exponent, J_freq2,
|
|
np.full(shape=(stg.r.shape[1], stg.t.shape[1]), fill_value=alpha_w_freq2))
|
|
# stg.SSC_fine = self.inv_hc.SSC_fine(stg.zeta[int(self.combobox_frequency_SSC.currentIndex())],
|
|
# stg.r_2D[int(stg.frequency_to_compute_SSC[0]), :, :stg.t.shape[1]],
|
|
# stg.VBI_cross_section,
|
|
# stg.frequency_to_compute_SSC[1],
|
|
# stg.X_exponent,
|
|
# stg.J_cross_section[self.combobox_frequency_SSC.currentIndex(), :, :])
|
|
# print("SSC fine shape ", stg.SSC_fine.shape)
|
|
|
|
stg.SSC_sand = self.inv_hc.SSC_sand(stg.VBI_cross_section, stg.freq[freq2], X_exponent, ks_freq2)
|
|
# stg.SSC_sand = self.inv_hc.SSC_sand(stg.VBI_cross_section,
|
|
# stg.frequency_to_compute_SSC[1],
|
|
# stg.X_exponent,
|
|
# stg.ks)
|
|
|
|
# print("SSC sand shape ", stg.SSC_sand.shape)
|
|
|
|
# def plot_SSC_2D_fields(self):
|
|
#
|
|
# if self.canvas_SSC_2D_field == None:
|
|
#
|
|
# self.figure_SSC_2D_field, self.axis_SSC_2D_field = plt.subplots(nrows=2, ncols=1, layout="constrained")
|
|
# self.canvas_SSC_2D_field = FigureCanvas(self.figure_SSC_2D_field)
|
|
# self.verticalLayout_groupbox_SSC_2D_field.addWidget(self.canvas_SSC_2D_field)
|
|
#
|
|
# self.plot_SSC_fine()
|
|
# self.plot_SSC_sand()
|
|
#
|
|
# else:
|
|
#
|
|
# self.verticalLayout_groupbox_SSC_2D_field.removeWidget(self.canvas_SSC_2D_field)
|
|
# self.verticalLayout_groupbox_SSC_2D_field.addWidget(self.canvas_SSC_2D_field)
|
|
#
|
|
# self.plot_SSC_fine()
|
|
# self.plot_SSC_sand()
|
|
|
|
def plot_SSC_fine(self):
|
|
|
|
# val_min = 1e-2
|
|
# val_max = 15
|
|
val_min = np.nanmin(stg.SSC_fine)
|
|
val_max = np.nanmax(stg.SSC_fine)
|
|
print('val_min fine = ', val_min)
|
|
print('val_max fine =', val_max)
|
|
# print('val_min fine = ', np.nanmin(stg.VBI_cross_section))
|
|
# print('val_max fine =', np.nanmax(stg.VBI_cross_section))
|
|
# if val_min == 0:
|
|
# val_min = 0.5
|
|
# print('val_min update =', val_min)
|
|
|
|
# pcm_SSC_fine = self.axis_SSC_2D_field[0].pcolormesh(stg.t[0, :],
|
|
# -stg.r[0, :],
|
|
# stg.SSC_fine,
|
|
# # np.log(stg.VBI_cross_section/1.1932980954310682e-27),
|
|
# # cmap='jet',
|
|
# # vmin=val_min, vmax=val_max)
|
|
# cmap = 'rainbow',
|
|
# norm=LogNorm(vmin=1e-1, vmax=15))
|
|
# # shading='gouraud')
|
|
if stg.ABS_name == "Aquascat 1000R":
|
|
|
|
self.verticalLayout_groupbox_SSC_2D_field.removeWidget(self.canvas_SSC_2D_field)
|
|
self.verticalLayout_groupbox_SSC_2D_field.addWidget(self.canvas_SSC_2D_field)
|
|
|
|
pcm_SSC_fine = self.axis_SSC_2D_field[0].pcolormesh(stg.t[0, :],
|
|
-stg.r[0, :],
|
|
stg.SSC_fine,
|
|
cmap='rainbow',
|
|
norm=LogNorm(vmin=1e0, vmax=15),
|
|
shading='gouraud')
|
|
|
|
cbar_SSC_fine = self.figure_SSC_2D_field.colorbar(pcm_SSC_fine, ax=self.axis_SSC_2D_field[0], shrink=1,
|
|
location='right')
|
|
cbar_SSC_fine.set_label(label='Fine SSC (g/L', rotation=270, labelpad=15)
|
|
# pcm_SSC_fine = self.axis_SSC_2D_field[0].pcolormesh(stg.t[int(stg.frequency_to_compute_SSC[0]), :],
|
|
# -stg.r[int(stg.frequency_to_compute_SSC[0]), :],
|
|
# stg.SSC_fine,
|
|
# cmap='rainbow',
|
|
# norm=LogNorm(vmin=1e-2, vmax=15),
|
|
# shading='gouraud')
|
|
elif stg.ABS_name == "UB-SediFlow":
|
|
pcm_SSC_fine = self.axis_SSC_2D_field[0].pcolormesh(stg.t[0, :],
|
|
-stg.r[0, :],
|
|
stg.SSC_fine,
|
|
cmap='rainbow',
|
|
norm=LogNorm(vmin=1e-2, vmax=10),
|
|
shading='gouraud')
|
|
|
|
|
|
if stg.r_bottom.size != 0:
|
|
self.axis_SSC_2D_field[0].plot(stg.t[0, :],
|
|
-stg.r_bottom,
|
|
color='black', linewidth=1, linestyle="solid")
|
|
# self.axis_SSC_2D_field[0].plot(stg.t[int(stg.frequency_to_compute_SSC[0]), :],
|
|
# -stg.r_bottom,
|
|
# color='black', linewidth=1, linestyle="solid")
|
|
|
|
def plot_SSC_sand(self):
|
|
|
|
val_min = 1e-2
|
|
val_max = 2
|
|
val_min = np.nanmin(stg.SSC_sand)
|
|
val_max = np.nanmax(stg.SSC_sand)
|
|
# val_min = np.nanmin(np.log(stg.VBI_cross_section))
|
|
# val_max = np.nanmax(np.log(stg.VBI_cross_section))
|
|
print('val_min sand = ', val_min)
|
|
print('val_max sand =', val_max)
|
|
# print('val_min sand = ', np.nanmin(stg.VBI_cross_section))
|
|
# print('val_max sand = ', np.nanmax(stg.VBI_cross_section))
|
|
# if val_min == 0:
|
|
# val_min = 0.5
|
|
# print('val_min update =', val_min)
|
|
|
|
# print(stg.SSC_sand)
|
|
|
|
if stg.ABS_name == "Aquascat 1000R":
|
|
|
|
self.verticalLayout_groupbox_SSC_2D_field.removeWidget(self.canvas_SSC_2D_field)
|
|
self.verticalLayout_groupbox_SSC_2D_field.addWidget(self.canvas_SSC_2D_field)
|
|
|
|
pcm_SSC_sand = self.axis_SSC_2D_field[1].pcolormesh(stg.t[0, :],
|
|
-stg.r[0, :],
|
|
(stg.SSC_sand),
|
|
cmap='rainbow',
|
|
# vmin=-60, vmax=-45)
|
|
# vmin=1e-2, vmax=10)
|
|
# vmin=val_min, vmax=val_max,
|
|
norm=LogNorm(vmin=1e-2, vmax=2),
|
|
shading='gouraud')
|
|
|
|
cbar_SSC_sand = self.figure_SSC_2D_field.colorbar(pcm_SSC_sand, ax=self.axis_SSC_2D_field[1], shrink=1,
|
|
location='right')
|
|
cbar_SSC_sand.set_label(label='Sand SSC (g/L', rotation=270, labelpad=15)
|
|
|
|
elif stg.ABS_name == "UB-SediFlow":
|
|
pcm_SSC_sand = self.axis_SSC_2D_field[1].pcolormesh(stg.t[0, :],
|
|
-stg.r[0, 5:155],
|
|
(stg.SSC_sand[5:155, :]),
|
|
cmap="plasma",
|
|
# cmap='rainbow',
|
|
vmin=0, vmax=10,
|
|
# vmin=1e-2, vmax=10)
|
|
# vmin=val_min, vmax=val_max,
|
|
# norm=LogNorm(vmin=1e-2, vmax=1),
|
|
shading='gouraud')
|
|
# self.axis_SSC_2D_field[1].plot(stg.t[1, 52] * np.ones(len(stg.r[1, 5:152])), -stg.r[1, 5:152],
|
|
# c='b', ls='solid', lw=2)
|
|
# self.axis_SSC_2D_field[1].plot(stg.t[1, ] * np.ones(len(stg.r[1, 5:152])), -stg.r[1, 5:152],
|
|
# c='red', ls='solid', lw=2)
|
|
self.axis_SSC_2D_field[1].plot(stg.t[1, 777] * np.ones(len(stg.r[1, 5:152])), -stg.r[1, 5:152],
|
|
c='red', ls='solid', lw=2)
|
|
|
|
# pcm_SSC_sand = self.axis_SSC_2D_field[1].pcolormesh(stg.t[int(stg.frequency_to_compute_SSC[0]), :],
|
|
# -stg.r[int(stg.frequency_to_compute_SSC[0]), :],
|
|
# stg.SSC_sand,
|
|
# cmap='rainbow',
|
|
# # vmin=val_min, vmax=val_max,
|
|
# norm=LogNorm(vmin=1e-2, vmax=2),
|
|
# shading='gouraud')
|
|
|
|
if stg.r_bottom.size:
|
|
self.axis_SSC_2D_field[1].plot(stg.t[0, :],
|
|
-stg.r_bottom,
|
|
color='black', linewidth=1, linestyle="solid")
|
|
# self.axis_SSC_2D_field[1].plot(stg.t[int(stg.frequency_to_compute_SSC[0]), :],
|
|
# -stg.r_bottom,
|
|
# color='black', linewidth=1, linestyle="solid")
|
|
|
|
self.figure_SSC_2D_field.supxlabel("Time (sec)", fontsize=10)
|
|
self.figure_SSC_2D_field.supylabel("Depth (m)", fontsize=10)
|
|
self.figure_SSC_2D_field.canvas.draw_idle()
|
|
|
|
def plot_SSC_inverse_VS_measured(self):
|
|
|
|
sample_depth_position = []
|
|
for i in range(stg.sample_depth.shape[0]):
|
|
sample_depth_position.append(
|
|
np.where(np.abs(stg.r[0, :] + stg.sample_depth[i]) ==
|
|
np.min(np.abs(stg.r[0, :] + stg.sample_depth[i])))[0][0])
|
|
|
|
sample_time_position = []
|
|
for j in range(stg.sample_time.shape[0]):
|
|
sample_time_position.append(
|
|
np.where(np.abs(stg.t[0, :] - stg.sample_time[j]) ==
|
|
np.min(np.abs(stg.t[0, :] - stg.sample_time[j])))[0][0])
|
|
|
|
self.verticalLayout_groupbox_SSC_sample_vs_inversion.removeWidget(self.canvas_SSC_sample_vs_inversion)
|
|
self.verticalLayout_groupbox_SSC_sample_vs_inversion.addWidget(self.canvas_SSC_sample_vs_inversion)
|
|
|
|
print("Ctot fine : ", stg.Ctot_fine)
|
|
print("SCC fine : ", stg.SSC_fine[sample_depth_position, sample_time_position])
|
|
print("Ctot sand : ", stg.Ctot_sand)
|
|
print("SCC sand : ", stg.SSC_sand[sample_depth_position, sample_time_position])
|
|
|
|
if stg.ABS_name == "Aquascat 1000R":
|
|
self.axis_SSC_sample_vs_inversion.plot(stg.Ctot_fine, stg.SSC_fine[sample_depth_position, sample_time_position], ls=" ", marker='v', color='black', label='Fine SSC')
|
|
self.axis_SSC_sample_vs_inversion.plot(stg.Ctot_sand,
|
|
stg.SSC_sand[sample_depth_position, sample_time_position],
|
|
ls=" ", marker='x', color='black', label='Sand SSC')
|
|
|
|
self.axis_SSC_sample_vs_inversion.set_xscale('log')
|
|
self.axis_SSC_sample_vs_inversion.set_yscale('log')
|
|
self.axis_SSC_sample_vs_inversion.plot([0, 10], [0, 10], color='black', lw=1)
|
|
self.axis_SSC_sample_vs_inversion.set_xlabel('Measured SSC (g/l)', weight='bold')
|
|
self.axis_SSC_sample_vs_inversion.set_ylabel('Inverse SSC (g/l)', weight='bold')
|
|
self.axis_SSC_sample_vs_inversion.legend()
|
|
|
|
elif stg.ABS_name == "UB-SediFlow":
|
|
# self.axis_SSC_sample_vs_inversion.plot(stg.Ctot_sand,
|
|
# stg.SSC_sand[sample_depth_position, sample_time_position],
|
|
# ls=" ", marker='x', color='black', label='Sand SSC')
|
|
|
|
# fig, ax = plt.subplots(nrows=2, ncols=10)
|
|
# for j in range(2):
|
|
# for i in range(10):
|
|
# ax[j, i].plot(stg.r[1, :145], stg.SSC_sand[:145, 750+j*10+i])
|
|
# plt.show()
|
|
# fig, ax = plt.subplots(nrows=1, ncols=1)
|
|
# for i in range(20):
|
|
# ax.plot(stg.r[1, :145], stg.SSC_sand[:145, 750+i])
|
|
# plt.show()
|
|
|
|
# self.axis_SSC_sample_vs_inversion.plot(stg.r[1, :145], stg.SSC_sand[:145, 40], color='blue', ls='solid')
|
|
# self.axis_SSC_sample_vs_inversion.plot(stg.r[1, 5:152], stg.SSC_sand[5:152, 52],
|
|
# color='blue', ls='solid') #, marker='o', mec='k', mfc='k', ms=3)
|
|
# self.axis_SSC_sample_vs_inversion.plot(stg.r[1, 5:152], stg.SSC_sand[5:152, 766],
|
|
# color='red', ls='solid')
|
|
self.axis_SSC_sample_vs_inversion.plot(stg.r[1, 5:138], stg.SSC_sand[5:138, 777], color='red', ls='solid')
|
|
|
|
self.axis_SSC_sample_vs_inversion.set_xlabel('Depth (m)', weight='bold')
|
|
self.axis_SSC_sample_vs_inversion.set_ylabel('Sand concentration (g/l)', weight='bold')
|
|
|
|
self.figure_SSC_sample_vs_inversion.canvas.draw_idle()
|
|
|
|
|
|
|
|
|
|
|
|
|