Sediment calibration: Refactoring method 'interpolate_Mfine_profile'.
parent
6628d610de
commit
8f7e679598
|
|
@ -21,9 +21,18 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import logging
|
||||
|
||||
from scipy.stats import linregress
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import pandas as pd
|
||||
from matplotlib.colors import LogNorm
|
||||
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
|
||||
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolBar
|
||||
|
||||
from PyQt5.QtWidgets import (
|
||||
QWidget, QVBoxLayout, QHBoxLayout, QGroupBox, QComboBox,
|
||||
QGridLayout, QLabel, QPushButton, QSlider, QLineEdit,
|
||||
|
|
@ -35,18 +44,10 @@ from PyQt5.QtGui import QIcon, QPixmap, QFont
|
|||
|
||||
import settings as stg
|
||||
|
||||
import numpy as np
|
||||
|
||||
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
|
||||
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolBar
|
||||
from matplotlib.colors import LogNorm
|
||||
|
||||
from scipy.stats import linregress
|
||||
|
||||
from View.checkable_combobox import CheckableComboBox
|
||||
|
||||
from Model.acoustic_inversion_method_high_concentration import AcousticInversionMethodHighConcentration
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
class SedimentCalibrationTab(QWidget):
|
||||
|
||||
|
|
@ -861,7 +862,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.compute_FCB()
|
||||
|
||||
def update_acoustic_data(self):
|
||||
|
||||
self.combobox_acoustic_data_choice.clear()
|
||||
self.combobox_acoustic_data_choice.addItems(stg.data_preprocessed)
|
||||
self.combobox_acoustic_data_choice.currentIndexChanged.connect(self.plot_acoustic_recording)
|
||||
|
|
@ -1510,89 +1510,64 @@ class SedimentCalibrationTab(QWidget):
|
|||
marker="*", mfc="b", mec="b", ms=8, ls="None")
|
||||
|
||||
def interpolate_Mfine_profile(self):
|
||||
data_choice = self.combobox_acoustic_data_choice.currentIndex()
|
||||
|
||||
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
print("test find indice of time ", np.where( np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :]
|
||||
- (stg.time_fine[stg.fine_sample_profile[-1][1]])) ==
|
||||
np.nanmin(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :]
|
||||
- (stg.time_fine[stg.fine_sample_profile[-1][1]]))) ))
|
||||
print(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :])
|
||||
print(stg.time_fine[stg.fine_sample_profile[-1][1]])
|
||||
|
||||
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
stg.range_lin_interp, stg.M_profile_fine = (
|
||||
self.inv_hc.M_profile_SCC_fine_interpolated(
|
||||
sample_depth=[-stg.depth_fine[k[1]] for k in stg.fine_sample_profile],
|
||||
M_profile=[stg.Ctot_fine[k[1]] for k in stg.fine_sample_profile],
|
||||
range_cells=stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :],
|
||||
r_bottom=stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()]
|
||||
[
|
||||
np.where( np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :]
|
||||
- stg.time_fine[stg.fine_sample_profile[-1][1]]) ==
|
||||
np.nanmin(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :]
|
||||
- stg.time_fine[stg.fine_sample_profile[-1][1]])) )[0][0]
|
||||
]
|
||||
)
|
||||
)
|
||||
if stg.depth_cross_section[data_choice].shape != (0,):
|
||||
range_cells = stg.depth_cross_section[data_choice][
|
||||
self.combobox_freq2.currentIndex(), :
|
||||
]
|
||||
|
||||
if stg.time_cross_section[data_choice].shape != (0,):
|
||||
time_data = stg.time_cross_section
|
||||
else:
|
||||
|
||||
stg.range_lin_interp, stg.M_profile_fine = (
|
||||
self.inv_hc.M_profile_SCC_fine_interpolated(
|
||||
sample_depth=[-stg.depth_fine[k[1]] for k in stg.fine_sample_profile],
|
||||
M_profile=[stg.Ctot_fine[k[1]] for k in stg.fine_sample_profile],
|
||||
range_cells=stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :],
|
||||
r_bottom=stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()]
|
||||
[
|
||||
np.where( np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :]
|
||||
- stg.time_fine[stg.fine_sample_profile[-1][1]]) ==
|
||||
np.nanmin(np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :]
|
||||
- stg.time_fine[stg.fine_sample_profile[-1][1]])) )[0][0]
|
||||
]
|
||||
)
|
||||
)
|
||||
time_data = stg.time
|
||||
|
||||
else:
|
||||
range_cells=stg.depth[data_choice][
|
||||
self.combobox_freq2.currentIndex(), :
|
||||
]
|
||||
|
||||
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
stg.range_lin_interp, stg.M_profile_fine = (
|
||||
self.inv_hc.M_profile_SCC_fine_interpolated(
|
||||
sample_depth=[-stg.depth_fine[k[1]] for k in stg.fine_sample_profile],
|
||||
M_profile=[stg.Ctot_fine[k[1]] for k in stg.fine_sample_profile],
|
||||
range_cells=stg.depth[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :],
|
||||
r_bottom=stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()]
|
||||
[
|
||||
np.where(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
self.combobox_freq2.currentIndex(), :]
|
||||
- stg.time_fine[stg.fine_sample_profile[-1][1]]) ==
|
||||
np.nanmin(np.abs(
|
||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
self.combobox_freq2.currentIndex(), :]
|
||||
- stg.time_fine[stg.fine_sample_profile[-1][1]])))[0][0]
|
||||
]
|
||||
))
|
||||
|
||||
if stg.time_cross_section[data_choice].shape != (0,):
|
||||
time_data = stg.time_cross_sectino
|
||||
else:
|
||||
time_data = stg.time
|
||||
|
||||
stg.range_lin_interp, stg.M_profile_fine = (
|
||||
self.inv_hc.M_profile_SCC_fine_interpolated(
|
||||
sample_depth=[-stg.depth_fine[k[1]] for k in stg.fine_sample_profile],
|
||||
M_profile=[stg.Ctot_fine[k[1]] for k in stg.fine_sample_profile],
|
||||
range_cells=stg.depth[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :],
|
||||
r_bottom=stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()]
|
||||
[
|
||||
np.where(np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
self.combobox_freq2.currentIndex(), :]
|
||||
- stg.time_fine[stg.fine_sample_profile[-1][1]]) ==
|
||||
np.nanmin(np.abs(
|
||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
self.combobox_freq2.currentIndex(), :]
|
||||
- stg.time_fine[stg.fine_sample_profile[-1][1]])))[0][0]
|
||||
]
|
||||
))
|
||||
sample_depth = [-stg.depth_fine[k[1]] for k in stg.fine_sample_profile]
|
||||
M_profile = [stg.Ctot_fine[k[1]] for k in stg.fine_sample_profile]
|
||||
|
||||
r_bottom = stg.depth_bottom[data_choice][
|
||||
np.where(
|
||||
np.abs(
|
||||
time_data[data_choice][
|
||||
self.combobox_freq2.currentIndex(), :
|
||||
]
|
||||
- stg.time_fine[stg.fine_sample_profile[-1][1]]
|
||||
) == np.nanmin(
|
||||
np.abs(
|
||||
time_data[data_choice][
|
||||
self.combobox_freq2.currentIndex(), :
|
||||
]
|
||||
- stg.time_fine[stg.fine_sample_profile[-1][1]])
|
||||
)
|
||||
)[0][0]
|
||||
]
|
||||
|
||||
logger.debug(
|
||||
"call 'inv_hc.M_profile_SCC_fine_interpolated' params:"
|
||||
)
|
||||
logger.debug(f"sample_depth = {sample_depth}")
|
||||
logger.debug(f"M_profile = {M_profile}")
|
||||
logger.debug(f"range_cells = {range_cells}")
|
||||
logger.debug(f"r_bottom = {r_bottom}")
|
||||
|
||||
stg.range_lin_interp, stg.M_profile_fine = (
|
||||
self.inv_hc.M_profile_SCC_fine_interpolated(
|
||||
sample_depth=sample_depth,
|
||||
M_profile=M_profile,
|
||||
range_cells=range_cells,
|
||||
r_bottom=r_bottom
|
||||
)
|
||||
)
|
||||
|
||||
stg.range_lin_interp = stg.range_lin_interp
|
||||
stg.M_profile_fine = stg.M_profile_fine
|
||||
|
|
|
|||
Loading…
Reference in New Issue