Inversion: Some refactoring.
parent
6256ddd1d7
commit
9260797c8f
|
|
@ -450,17 +450,20 @@ class AcousticInversionTab(QWidget):
|
||||||
logger.debug(f"{__name__}: Update")
|
logger.debug(f"{__name__}: Update")
|
||||||
self.blockSignals(True)
|
self.blockSignals(True)
|
||||||
|
|
||||||
|
self.update_acoustic_data_choice()
|
||||||
|
|
||||||
# TODO: Update all widgets
|
# TODO: Update all widgets
|
||||||
|
|
||||||
self.blockSignals(False)
|
self.blockSignals(False)
|
||||||
|
|
||||||
def update_acoustic_data_choice(self):
|
def update_acoustic_data_choice(self):
|
||||||
|
|
||||||
self.combobox_acoustic_data_choice.clear()
|
self.combobox_acoustic_data_choice.clear()
|
||||||
for i in range(len(stg.filename_BS_raw_data)):
|
for i in range(len(stg.filename_BS_raw_data)):
|
||||||
self.combobox_acoustic_data_choice.addItem(stg.data_preprocessed[i])
|
self.combobox_acoustic_data_choice.addItem(stg.data_preprocessed[i])
|
||||||
|
|
||||||
self.combobox_acoustic_data_choice.currentIndexChanged.connect(self.combobox_acoustic_data_choice_currentIndexChanged)
|
self.combobox_acoustic_data_choice\
|
||||||
|
.currentIndexChanged\
|
||||||
|
.connect(self.combobox_acoustic_data_choice_currentIndexChanged)
|
||||||
|
|
||||||
def combobox_acoustic_data_choice_currentIndexChanged(self):
|
def combobox_acoustic_data_choice_currentIndexChanged(self):
|
||||||
self.fill_combobox_fine_sample()
|
self.fill_combobox_fine_sample()
|
||||||
|
|
@ -475,27 +478,28 @@ class AcousticInversionTab(QWidget):
|
||||||
|
|
||||||
def function_run_inversion(self):
|
def function_run_inversion(self):
|
||||||
if (stg.alpha_s[0] < 0) or (stg.alpha_s[1] < 0):
|
if (stg.alpha_s[0] < 0) or (stg.alpha_s[1] < 0):
|
||||||
|
|
||||||
msgBox = QMessageBox()
|
msgBox = QMessageBox()
|
||||||
msgBox.setWindowTitle("Alpha computation error")
|
msgBox.setWindowTitle("Alpha computation error")
|
||||||
msgBox.setIconPixmap(
|
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("Sediment sound attenuation is negative !")
|
msgBox.setText("Sediment sound attenuation is negative !")
|
||||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||||
msgBox.exec()
|
msgBox.exec()
|
||||||
|
|
||||||
elif isinf(stg.alpha_s[0]) or isinf(stg.alpha_s[1]):
|
elif isinf(stg.alpha_s[0]) or isinf(stg.alpha_s[1]):
|
||||||
|
|
||||||
msgBox = QMessageBox()
|
msgBox = QMessageBox()
|
||||||
msgBox.setWindowTitle("Alpha computation error")
|
msgBox.setWindowTitle("Alpha computation error")
|
||||||
msgBox.setIconPixmap(
|
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("Sediment sound attenuation is infinite !")
|
msgBox.setText("Sediment sound attenuation is infinite !")
|
||||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||||
msgBox.exec()
|
msgBox.exec()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
self.compute_VBI()
|
self.compute_VBI()
|
||||||
self.compute_SSC_fine()
|
self.compute_SSC_fine()
|
||||||
self.compute_SSC_sand()
|
self.compute_SSC_sand()
|
||||||
|
|
@ -530,343 +534,335 @@ class AcousticInversionTab(QWidget):
|
||||||
)
|
)
|
||||||
|
|
||||||
def compute_SSC_fine(self):
|
def compute_SSC_fine(self):
|
||||||
|
|
||||||
stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
|
stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
|
||||||
|
|
||||||
stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()] = self.inv_hc.SSC_fine(
|
stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()] = self.inv_hc.SSC_fine(
|
||||||
zeta=stg.zeta[1],
|
zeta=stg.zeta[1],
|
||||||
r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][
|
r2D=stg.depth_2D[
|
||||||
stg.frequency_for_inversion[1]],
|
self.combobox_acoustic_data_choice.currentIndex()
|
||||||
VBI=stg.VBI_cross_section[self.combobox_acoustic_data_choice.currentIndex()],
|
][
|
||||||
|
stg.frequency_for_inversion[1]
|
||||||
|
],
|
||||||
|
VBI=stg.VBI_cross_section[
|
||||||
|
self.combobox_acoustic_data_choice.currentIndex()
|
||||||
|
],
|
||||||
freq=stg.frequencies_for_calibration[1][0],
|
freq=stg.frequencies_for_calibration[1][0],
|
||||||
X=stg.X_exponent[0],
|
X=stg.X_exponent[0],
|
||||||
j_cross_section=stg.J_cross_section[self.combobox_acoustic_data_choice.currentIndex()][1],
|
j_cross_section=stg.J_cross_section[
|
||||||
alpha_w=np.full(shape=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][
|
self.combobox_acoustic_data_choice.currentIndex()
|
||||||
stg.frequency_for_inversion[1]].shape,
|
][1],
|
||||||
fill_value=stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
|
alpha_w=np.full(
|
||||||
stg.frequency_for_inversion[1]])
|
shape=stg.depth_2D[
|
||||||
|
self.combobox_acoustic_data_choice.currentIndex()
|
||||||
|
][
|
||||||
|
stg.frequency_for_inversion[1]
|
||||||
|
].shape,
|
||||||
|
fill_value=stg.water_attenuation[
|
||||||
|
self.combobox_acoustic_data_choice.currentIndex()
|
||||||
|
][
|
||||||
|
stg.frequency_for_inversion[1]
|
||||||
|
]
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def compute_SSC_sand(self):
|
def compute_SSC_sand(self):
|
||||||
|
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||||
|
|
||||||
stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
|
stg.SSC_sand[data_id] = np.array([])
|
||||||
|
|
||||||
stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()] = self.inv_hc.SSC_sand(
|
stg.SSC_sand[data_id] = self.inv_hc.SSC_sand(
|
||||||
VBI=stg.VBI_cross_section[self.combobox_acoustic_data_choice.currentIndex()],
|
VBI=stg.VBI_cross_section[data_id],
|
||||||
freq=stg.frequencies_for_calibration[1][0],
|
freq=stg.frequencies_for_calibration[1][0],
|
||||||
X=stg.X_exponent,
|
X=stg.X_exponent,
|
||||||
ks=stg.ks[1])
|
ks=stg.ks[1]
|
||||||
|
)
|
||||||
|
|
||||||
def plot_SSC_fine(self):
|
def plot_SSC_fine(self):
|
||||||
|
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||||
|
|
||||||
if self.combobox_acoustic_data_choice.count() > 0:
|
if self.combobox_acoustic_data_choice.count() <= 0:
|
||||||
|
return
|
||||||
|
|
||||||
if stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()].shape == (0,):
|
if stg.SSC_fine[data_id].shape == (0,):
|
||||||
|
self.verticalLayout_groupbox_plot_SSC_fine.removeWidget(self.toolbar_SSC_fine)
|
||||||
|
self.verticalLayout_groupbox_plot_SSC_fine.removeWidget(self.canvas_SSC_fine)
|
||||||
|
|
||||||
self.verticalLayout_groupbox_plot_SSC_fine.removeWidget(self.toolbar_SSC_fine)
|
self.canvas_SSC_fine = FigureCanvas()
|
||||||
self.verticalLayout_groupbox_plot_SSC_fine.removeWidget(self.canvas_SSC_fine)
|
self.toolbar_SSC_fine = NavigationToolBar(self.canvas_SSC_fine, self)
|
||||||
|
|
||||||
self.canvas_SSC_fine = FigureCanvas()
|
self.verticalLayout_groupbox_plot_SSC_fine.addWidget(self.toolbar_SSC_fine)
|
||||||
self.toolbar_SSC_fine = NavigationToolBar(self.canvas_SSC_fine, self)
|
self.verticalLayout_groupbox_plot_SSC_fine.addWidget(self.canvas_SSC_fine)
|
||||||
|
|
||||||
self.verticalLayout_groupbox_plot_SSC_fine.addWidget(self.toolbar_SSC_fine)
|
elif stg.SSC_fine[data_id].shape != (0,):
|
||||||
self.verticalLayout_groupbox_plot_SSC_fine.addWidget(self.canvas_SSC_fine)
|
self.verticalLayout_groupbox_plot_SSC_fine.removeWidget(self.toolbar_SSC_fine)
|
||||||
|
self.verticalLayout_groupbox_plot_SSC_fine.removeWidget(self.canvas_SSC_fine)
|
||||||
|
|
||||||
elif stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
self.figure_SSC_fine, self.axis_SSC_fine = plt.subplots(
|
||||||
|
nrows=1, ncols=1, layout="constrained"
|
||||||
|
)
|
||||||
|
self.canvas_SSC_fine = FigureCanvas(self.figure_SSC_fine)
|
||||||
|
self.toolbar_SSC_fine = NavigationToolBar(self.canvas_SSC_fine, self)
|
||||||
|
|
||||||
self.verticalLayout_groupbox_plot_SSC_fine.removeWidget(self.toolbar_SSC_fine)
|
self.verticalLayout_groupbox_plot_SSC_fine.addWidget(self.toolbar_SSC_fine)
|
||||||
self.verticalLayout_groupbox_plot_SSC_fine.removeWidget(self.canvas_SSC_fine)
|
self.verticalLayout_groupbox_plot_SSC_fine.addWidget(self.canvas_SSC_fine)
|
||||||
|
|
||||||
self.figure_SSC_fine, self.axis_SSC_fine = plt.subplots(nrows=1, ncols=1, layout="constrained")
|
val_min = np.nanmin(stg.SSC_fine[data_id])
|
||||||
self.canvas_SSC_fine = FigureCanvas(self.figure_SSC_fine)
|
val_max = np.nanmax(stg.SSC_fine[data_id])
|
||||||
self.toolbar_SSC_fine = NavigationToolBar(self.canvas_SSC_fine, self)
|
|
||||||
|
|
||||||
self.verticalLayout_groupbox_plot_SSC_fine.addWidget(self.toolbar_SSC_fine)
|
if stg.time_cross_section[data_id].shape != (0,):
|
||||||
self.verticalLayout_groupbox_plot_SSC_fine.addWidget(self.canvas_SSC_fine)
|
time_data = stg.time_cross_section
|
||||||
|
depth_data = stg.depth_cross_section
|
||||||
|
else:
|
||||||
|
time_data = stg.time
|
||||||
|
depth_data = stg.depth
|
||||||
|
|
||||||
val_min = np.nanmin(stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()])
|
pcm_SSC_fine = self.axis_SSC_fine.pcolormesh(
|
||||||
val_max = np.nanmax(stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()])
|
time_data[data_id][stg.frequency_for_inversion[1]],
|
||||||
|
-depth_data[data_id][stg.frequency_for_inversion[1]],
|
||||||
|
stg.SSC_fine[data_id],
|
||||||
|
cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=15),
|
||||||
|
shading='gouraud'
|
||||||
|
)
|
||||||
|
|
||||||
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
if stg.depth_bottom[data_id].shape != (0,):
|
||||||
|
self.axis_SSC_fine.plot(
|
||||||
|
time_data[data_id][stg.frequency_for_inversion[1]],
|
||||||
|
-stg.depth_bottom[data_id],
|
||||||
|
color='black', linewidth=1, linestyle="solid"
|
||||||
|
)
|
||||||
|
|
||||||
pcm_SSC_fine = self.axis_SSC_fine.pcolormesh(
|
self.pcm_SSC_fine_vertical_line, = self.axis_SSC_fine.plot(
|
||||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
time_data[data_id][stg.frequency_for_inversion[1],
|
||||||
stg.frequency_for_inversion[1]],
|
self.slider_fine.value() - 1]
|
||||||
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
* np.ones(
|
||||||
stg.frequency_for_inversion[1]],
|
depth_data[data_id][
|
||||||
stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()],
|
stg.frequency_for_inversion[1]
|
||||||
cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=15), shading='gouraud')
|
].shape
|
||||||
|
),
|
||||||
|
-depth_data[data_id][stg.frequency_for_inversion[1]],
|
||||||
|
linestyle="solid", color='r', linewidth=2
|
||||||
|
)
|
||||||
|
|
||||||
if stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
# --- Plot samples of fine sediments ---
|
||||||
self.axis_SSC_fine.plot(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
time_fine_temp = deepcopy(stg.time_fine)
|
||||||
stg.frequency_for_inversion[1]],
|
depth_fine_temp = deepcopy(stg.depth_fine)
|
||||||
-stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()],
|
for s in stg.fine_sample_profile:
|
||||||
color='black', linewidth=1, linestyle="solid")
|
time_fine_temp.remove(stg.time_fine[s[1]])
|
||||||
|
depth_fine_temp.remove(stg.depth_fine[s[1]])
|
||||||
|
|
||||||
self.pcm_SSC_fine_vertical_line, = self.axis_SSC_fine.plot(
|
self.pcm_SSC_fine_meas_vs_inv, = self.axis_SSC_fine.plot(
|
||||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
time_fine_temp, depth_fine_temp,
|
||||||
stg.frequency_for_inversion[1],
|
ls=" ", marker="o", ms=5, mec="k", mfc="k"
|
||||||
self.slider_fine.value() - 1] *
|
)
|
||||||
np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]].shape),
|
|
||||||
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]],
|
|
||||||
linestyle="solid", color='r', linewidth=2)
|
|
||||||
|
|
||||||
else:
|
time_fine_temp = deepcopy(stg.time_fine)
|
||||||
|
depth_fine_temp = deepcopy(stg.depth_fine)
|
||||||
|
sample_fine_temp = deepcopy(stg.sample_fine)
|
||||||
|
for s in stg.fine_sample_profile:
|
||||||
|
sample_fine_temp.remove(s)
|
||||||
|
time_fine_temp.remove(stg.time_fine[s[1]])
|
||||||
|
depth_fine_temp.remove(stg.depth_fine[s[1]])
|
||||||
|
for i in range(len(sample_fine_temp)):
|
||||||
|
self.pcm_SSC_fine_meas_vs_inv_text = self.axis_SSC_fine.text(
|
||||||
|
time_fine_temp[i],
|
||||||
|
depth_fine_temp[i], sample_fine_temp[i][0]
|
||||||
|
)
|
||||||
|
|
||||||
pcm_SSC_fine = self.axis_SSC_fine.pcolormesh(
|
time_fine_temp, depth_fine_temp = stg.time_fine, stg.depth_fine
|
||||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
self.pcm_SSC_fine_meas_vs_inv_sample_calibration, = self.axis_SSC_fine.plot(
|
||||||
stg.frequency_for_inversion[1]],
|
[time_fine_temp[s[1]] for s in stg.fine_sample_profile],
|
||||||
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
[depth_fine_temp[s[1]] for s in stg.fine_sample_profile],
|
||||||
stg.frequency_for_inversion[1]],
|
ls=" ", marker="*", ms=12, mec="r", mfc="r"
|
||||||
stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()],
|
)
|
||||||
cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=15), shading='gouraud')
|
|
||||||
|
|
||||||
self.pcm_SSC_fine_vertical_line, = self.axis_SSC_fine.plot(
|
time_fine_temp, depth_fine_temp = stg.time_fine, stg.depth_fine
|
||||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
for i, j in stg.fine_sample_profile:
|
||||||
stg.frequency_for_inversion[1],
|
self.pcm_SSC_fine_meas_vs_inv_sample_calibration_text = self.axis_SSC_fine.text(
|
||||||
self.slider_fine.value() - 1] *
|
time_fine_temp[j]+5, depth_fine_temp[j]+0.05, i,
|
||||||
np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
color='r', fontweight='bold'
|
||||||
stg.frequency_for_inversion[
|
)
|
||||||
1]].shape),
|
|
||||||
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]],
|
|
||||||
linestyle="solid", color='r', linewidth=2)
|
|
||||||
|
|
||||||
if stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
cbar_SSC_fine = self.figure_SSC_fine.colorbar(
|
||||||
self.axis_SSC_fine.plot(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
pcm_SSC_fine, ax=self.axis_SSC_fine, shrink=1,
|
||||||
stg.frequency_for_inversion[1]],
|
location='right'
|
||||||
-stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()],
|
)
|
||||||
color='black', linewidth=1, linestyle="solid")
|
cbar_SSC_fine.set_label(label='Fine SSC (g/L', rotation=270, labelpad=15)
|
||||||
|
|
||||||
# --- Plot samples of fine sediments ---
|
self.figure_SSC_fine.supxlabel("Time (sec)", fontsize=10)
|
||||||
time_fine_temp = deepcopy(stg.time_fine)
|
self.figure_SSC_fine.supylabel("Depth (m)", fontsize=10)
|
||||||
depth_fine_temp = deepcopy(stg.depth_fine)
|
self.figure_SSC_fine.canvas.draw_idle()
|
||||||
for s in stg.fine_sample_profile:
|
|
||||||
time_fine_temp.remove(stg.time_fine[s[1]])
|
|
||||||
depth_fine_temp.remove(stg.depth_fine[s[1]])
|
|
||||||
self.pcm_SSC_fine_meas_vs_inv, = self.axis_SSC_fine.plot(
|
|
||||||
time_fine_temp, depth_fine_temp, ls=" ", marker="o", ms=5, mec="k", mfc="k")
|
|
||||||
|
|
||||||
time_fine_temp = deepcopy(stg.time_fine)
|
|
||||||
depth_fine_temp = deepcopy(stg.depth_fine)
|
|
||||||
sample_fine_temp = deepcopy(stg.sample_fine)
|
|
||||||
for s in stg.fine_sample_profile:
|
|
||||||
sample_fine_temp.remove(s)
|
|
||||||
time_fine_temp.remove(stg.time_fine[s[1]])
|
|
||||||
depth_fine_temp.remove(stg.depth_fine[s[1]])
|
|
||||||
for i in range(len(sample_fine_temp)):
|
|
||||||
self.pcm_SSC_fine_meas_vs_inv_text = self.axis_SSC_fine.text(
|
|
||||||
time_fine_temp[i],
|
|
||||||
depth_fine_temp[i], sample_fine_temp[i][0])
|
|
||||||
|
|
||||||
time_fine_temp, depth_fine_temp = stg.time_fine, stg.depth_fine
|
|
||||||
self.pcm_SSC_fine_meas_vs_inv_sample_calibration, = self.axis_SSC_fine.plot(
|
|
||||||
[time_fine_temp[s[1]] for s in stg.fine_sample_profile],
|
|
||||||
[depth_fine_temp[s[1]] for s in stg.fine_sample_profile],
|
|
||||||
ls=" ", marker="*", ms=12, mec="r", mfc="r")
|
|
||||||
|
|
||||||
time_fine_temp, depth_fine_temp = stg.time_fine, stg.depth_fine
|
|
||||||
for i, j in stg.fine_sample_profile:
|
|
||||||
self.pcm_SSC_fine_meas_vs_inv_sample_calibration_text = self.axis_SSC_fine.text(
|
|
||||||
time_fine_temp[j]+5, depth_fine_temp[j]+0.05, i, color='r', fontweight='bold')
|
|
||||||
|
|
||||||
cbar_SSC_fine = self.figure_SSC_fine.colorbar(pcm_SSC_fine, ax=self.axis_SSC_fine, shrink=1,
|
|
||||||
location='right')
|
|
||||||
cbar_SSC_fine.set_label(label='Fine SSC (g/L', rotation=270, labelpad=15)
|
|
||||||
|
|
||||||
self.figure_SSC_fine.supxlabel("Time (sec)", fontsize=10)
|
|
||||||
self.figure_SSC_fine.supylabel("Depth (m)", fontsize=10)
|
|
||||||
self.figure_SSC_fine.canvas.draw_idle()
|
|
||||||
|
|
||||||
def plot_SSC_fine_vertical_profile(self):
|
def plot_SSC_fine_vertical_profile(self):
|
||||||
|
if self.combobox_acoustic_data_choice.count() <= 0:
|
||||||
|
return
|
||||||
|
|
||||||
if self.combobox_acoustic_data_choice.count() > 0:
|
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||||
|
|
||||||
if stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()].shape == (0,):
|
if stg.SSC_fine[data_id].shape == (0,):
|
||||||
|
self.verticalLayout_groupbox_plot_vertical_profile_fine\
|
||||||
|
.removeWidget(self.toolbar_profile_fine)
|
||||||
|
self.verticalLayout_groupbox_plot_vertical_profile_fine\
|
||||||
|
.removeWidget(self.canvas_profile_fine)
|
||||||
|
|
||||||
self.verticalLayout_groupbox_plot_vertical_profile_fine.removeWidget(self.toolbar_profile_fine)
|
self.canvas_profile_fine = FigureCanvas()
|
||||||
self.verticalLayout_groupbox_plot_vertical_profile_fine.removeWidget(self.canvas_profile_fine)
|
self.toolbar_profile_fine = NavigationToolBar(self.canvas_profile_fine, self)
|
||||||
|
|
||||||
self.canvas_profile_fine = FigureCanvas()
|
self.verticalLayout_groupbox_plot_vertical_profile_fine\
|
||||||
self.toolbar_profile_fine = NavigationToolBar(self.canvas_profile_fine, self)
|
.addWidget(self.toolbar_profile_fine)
|
||||||
|
self.verticalLayout_groupbox_plot_vertical_profile_fine\
|
||||||
|
.addWidget(self.canvas_profile_fine)
|
||||||
|
|
||||||
self.verticalLayout_groupbox_plot_vertical_profile_fine.addWidget(self.toolbar_profile_fine)
|
if stg.SSC_fine[data_id].shape != (0,):
|
||||||
self.verticalLayout_groupbox_plot_vertical_profile_fine.addWidget(self.canvas_profile_fine)
|
self.slider_fine.setMaximum(
|
||||||
|
stg.SSC_fine[data_id].shape[1]
|
||||||
|
)
|
||||||
|
|
||||||
if stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
self.verticalLayout_groupbox_plot_vertical_profile_fine\
|
||||||
|
.removeWidget(self.toolbar_profile_fine)
|
||||||
|
self.verticalLayout_groupbox_plot_vertical_profile_fine\
|
||||||
|
.removeWidget(self.canvas_profile_fine)
|
||||||
|
|
||||||
self.slider_fine.setMaximum(stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()].shape[1])
|
fig, ax = plt.subplots(nrows=1, ncols=1, layout="constrained")
|
||||||
|
self.figure_vertical_profile_SSC_fine = fig
|
||||||
|
self.axis_vertical_profile_SSC_fine = ax
|
||||||
|
|
||||||
self.verticalLayout_groupbox_plot_vertical_profile_fine.removeWidget(self.toolbar_profile_fine)
|
self.canvas_profile_fine = FigureCanvas(self.figure_vertical_profile_SSC_fine)
|
||||||
self.verticalLayout_groupbox_plot_vertical_profile_fine.removeWidget(self.canvas_profile_fine)
|
self.toolbar_profile_fine = NavigationToolBar(self.canvas_profile_fine, self)
|
||||||
|
|
||||||
self.figure_vertical_profile_SSC_fine, self.axis_vertical_profile_SSC_fine = plt.subplots(
|
self.verticalLayout_groupbox_plot_vertical_profile_fine\
|
||||||
nrows=1, ncols=1, layout="constrained")
|
.addWidget(self.toolbar_profile_fine)
|
||||||
|
self.verticalLayout_groupbox_plot_vertical_profile_fine\
|
||||||
|
.addWidget(self.canvas_profile_fine)
|
||||||
|
|
||||||
self.canvas_profile_fine = FigureCanvas(self.figure_vertical_profile_SSC_fine)
|
if stg.depth_cross_section[data_id].shape != (0,):
|
||||||
self.toolbar_profile_fine = NavigationToolBar(self.canvas_profile_fine, self)
|
time_data = stg.time_cross_section
|
||||||
|
depth_data = stg.depth_cross_section
|
||||||
|
else:
|
||||||
|
time_data = stg.time
|
||||||
|
depth_data = stg.depth
|
||||||
|
|
||||||
self.verticalLayout_groupbox_plot_vertical_profile_fine.addWidget(self.toolbar_profile_fine)
|
self.plot_fine , = self.axis_vertical_profile_SSC_fine.plot(
|
||||||
self.verticalLayout_groupbox_plot_vertical_profile_fine.addWidget(self.canvas_profile_fine)
|
stg.SSC_fine[data_id][:, self.slider_fine.value() -1],
|
||||||
|
-depth_data[data_id][stg.frequency_for_inversion[1]],
|
||||||
|
linestyle="solid", linewidth=1, color="k"
|
||||||
|
)
|
||||||
|
|
||||||
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
self.pcm_SSC_fine_vertical_line.set_data(
|
||||||
|
time_data[data_id][
|
||||||
|
stg.frequency_for_inversion[1],
|
||||||
|
self.slider_fine.value() - 1
|
||||||
|
]
|
||||||
|
* np.ones(
|
||||||
|
depth_data[data_id][
|
||||||
|
stg.frequency_for_inversion[1]
|
||||||
|
].shape
|
||||||
|
),
|
||||||
|
-depth_data[data_id][
|
||||||
|
stg.frequency_for_inversion[1]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
self.figure_SSC_fine.canvas.draw_idle()
|
||||||
|
|
||||||
self.plot_fine , = self.axis_vertical_profile_SSC_fine.plot(
|
self.axis_vertical_profile_SSC_fine.set_ylim(
|
||||||
stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()][:, self.slider_fine.value() -1],
|
[
|
||||||
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
-np.nanmax(
|
||||||
stg.frequency_for_inversion[1]],
|
depth_data[data_id][stg.frequency_for_inversion[1]]
|
||||||
linestyle="solid", linewidth=1, color="k")
|
),
|
||||||
|
-np.nanmin(
|
||||||
|
depth_data[data_id][stg.frequency_for_inversion[1]]
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
self.pcm_SSC_fine_vertical_line.set_data(
|
self.axis_vertical_profile_SSC_fine.set_xlim(0, 10)
|
||||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
self.axis_vertical_profile_SSC_fine.set_xlabel("Inverted Fine SSC (g/L)")
|
||||||
stg.frequency_for_inversion[1],
|
self.axis_vertical_profile_SSC_fine.set_ylabel("Depth (m)")
|
||||||
self.slider_fine.value() - 1] *
|
self.figure_vertical_profile_SSC_fine.canvas.draw_idle()
|
||||||
np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]].shape),
|
|
||||||
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]])
|
|
||||||
self.figure_SSC_fine.canvas.draw_idle()
|
|
||||||
|
|
||||||
self.axis_vertical_profile_SSC_fine.set_ylim(
|
|
||||||
[-np.nanmax(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]]),
|
|
||||||
-np.nanmin(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]])])
|
|
||||||
|
|
||||||
else:
|
|
||||||
|
|
||||||
self.plot_fine , = self.axis_vertical_profile_SSC_fine.plot(
|
|
||||||
stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()][:, self.slider_fine.value() -1],
|
|
||||||
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]],
|
|
||||||
linestyle="solid", linewidth=1, color="k")
|
|
||||||
|
|
||||||
self.pcm_SSC_fine_vertical_line.set_data(
|
|
||||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1], self.slider_fine.value() - 1] *
|
|
||||||
np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]].shape),
|
|
||||||
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]])
|
|
||||||
self.figure_SSC_fine.canvas.draw_idle()
|
|
||||||
|
|
||||||
self.axis_vertical_profile_SSC_fine.set_ylim(
|
|
||||||
[-np.nanmax(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]]),
|
|
||||||
-np.nanmin(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]])])
|
|
||||||
|
|
||||||
self.axis_vertical_profile_SSC_fine.set_xlim(0, 10)
|
|
||||||
self.axis_vertical_profile_SSC_fine.set_xlabel("Inverted Fine SSC (g/L)")
|
|
||||||
self.axis_vertical_profile_SSC_fine.set_ylabel("Depth (m)")
|
|
||||||
self.figure_vertical_profile_SSC_fine.canvas.draw_idle()
|
|
||||||
|
|
||||||
def update_plot_SSC_fine_vertical_profile(self):
|
def update_plot_SSC_fine_vertical_profile(self):
|
||||||
|
if len(stg.filename_BS_noise_data) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
if stg.filename_BS_noise_data != []:
|
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||||
|
|
||||||
if stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
if stg.SSC_fine[data_id].shape == (0,):
|
||||||
|
return
|
||||||
|
|
||||||
self.axis_vertical_profile_SSC_fine.cla()
|
self.axis_vertical_profile_SSC_fine.cla()
|
||||||
|
|
||||||
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
if stg.depth_cross_section[data_id].shape != (0,):
|
||||||
|
time_data = stg.time_cross_section
|
||||||
|
depth_data = stg.depth_cross_section
|
||||||
|
else:
|
||||||
|
time_data = stg.time
|
||||||
|
depth_data = stg.depth
|
||||||
|
|
||||||
self.axis_vertical_profile_SSC_fine.plot(
|
self.axis_vertical_profile_SSC_fine.plot(
|
||||||
stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()][:,
|
stg.SSC_fine[data_id][:, self.slider_fine.value() - 1],
|
||||||
self.slider_fine.value() - 1],
|
-depth_data[data_id][stg.frequency_for_inversion[1]],
|
||||||
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
linestyle="solid", linewidth=1, color="k"
|
||||||
stg.frequency_for_inversion[1]],
|
)
|
||||||
linestyle="solid", linewidth=1, color="k")
|
|
||||||
|
|
||||||
self.pcm_SSC_fine_vertical_line.set_data(
|
self.pcm_SSC_fine_vertical_line.set_data(
|
||||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
time_data[data_id][stg.frequency_for_inversion[1],
|
||||||
stg.frequency_for_inversion[1],
|
self.slider_fine.value() - 1]
|
||||||
self.slider_fine.value() - 1] *
|
* np.ones(depth_data[data_id][
|
||||||
np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
stg.frequency_for_inversion[1]
|
||||||
stg.frequency_for_inversion[1]].shape),
|
].shape),
|
||||||
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
-depth_data[data_id][stg.frequency_for_inversion[1]]
|
||||||
stg.frequency_for_inversion[1]])
|
)
|
||||||
self.figure_SSC_fine.canvas.draw_idle()
|
self.figure_SSC_fine.canvas.draw_idle()
|
||||||
|
|
||||||
self.axis_vertical_profile_SSC_fine.set_ylim(
|
self.axis_vertical_profile_SSC_fine.set_ylim(
|
||||||
[-np.nanmax(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
[
|
||||||
stg.frequency_for_inversion[1]]),
|
-np.nanmax(
|
||||||
-np.nanmin(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
depth_data[data_id][stg.frequency_for_inversion[1]]
|
||||||
stg.frequency_for_inversion[1]])])
|
),
|
||||||
|
-np.nanmin(
|
||||||
|
depth_data[data_id][stg.frequency_for_inversion[1]]
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
else:
|
for f in stg.fine_sample_profile:
|
||||||
|
time_fine_calibration = (
|
||||||
self.axis_vertical_profile_SSC_fine.plot(
|
np.where(
|
||||||
stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()][:,
|
np.abs(
|
||||||
self.slider_fine.value() - 1],
|
time_data[data_id][stg.frequency_for_inversion[1]]
|
||||||
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
- stg.time_fine[f[1]]
|
||||||
stg.frequency_for_inversion[1]],
|
) == np.nanmin(
|
||||||
linestyle="solid", linewidth=1, color="k")
|
np.abs(
|
||||||
|
time_data[data_id][
|
||||||
self.pcm_SSC_fine_vertical_line.set_data(
|
stg.frequency_for_inversion[1]
|
||||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
]
|
||||||
stg.frequency_for_inversion[1], self.slider_fine.value() - 1] *
|
- stg.time_fine[f[1]]
|
||||||
np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]].shape),
|
|
||||||
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]])
|
|
||||||
self.figure_SSC_fine.canvas.draw_idle()
|
|
||||||
|
|
||||||
self.axis_vertical_profile_SSC_fine.set_ylim(
|
|
||||||
[-np.nanmax(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]]),
|
|
||||||
-np.nanmin(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]])])
|
|
||||||
|
|
||||||
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
|
||||||
|
|
||||||
for f in stg.fine_sample_profile:
|
|
||||||
|
|
||||||
time_fine_calibration = (
|
|
||||||
np.where(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]] - stg.time_fine[f[1]]) ==
|
|
||||||
np.nanmin(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]] - stg.time_fine[f[1]])))[0][0]
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
)[0][0]
|
||||||
|
)
|
||||||
|
|
||||||
if (stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
if (time_data[data_id][
|
||||||
stg.frequency_for_inversion[1], int(self.slider_fine.value())] ==
|
stg.frequency_for_inversion[1],
|
||||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
int(self.slider_fine.value())
|
||||||
stg.frequency_for_inversion[1], int(time_fine_calibration)]):
|
] == time_data[data_id][
|
||||||
|
stg.frequency_for_inversion[1],
|
||||||
|
int(time_fine_calibration)
|
||||||
|
]):
|
||||||
|
self.axis_vertical_profile_SSC_fine.scatter(
|
||||||
|
stg.Ctot_fine[f[1]], stg.depth_fine[f[1]],
|
||||||
|
marker='*', s=48, c='r', edgecolors='r'
|
||||||
|
)
|
||||||
|
self.axis_vertical_profile_SSC_fine.text(
|
||||||
|
stg.Ctot_fine[f[1]],
|
||||||
|
stg.depth_fine[f[1]], f[0]
|
||||||
|
)
|
||||||
|
|
||||||
self.axis_vertical_profile_SSC_fine.scatter(
|
self.axis_vertical_profile_SSC_fine.set_xlim(0, 10)
|
||||||
stg.Ctot_fine[f[1]], stg.depth_fine[f[1]],
|
self.axis_vertical_profile_SSC_fine\
|
||||||
marker='*', s=48, c='r', edgecolors='r')
|
.set_xlabel("Inverted Fine SSC (g/L)")
|
||||||
self.axis_vertical_profile_SSC_fine.text(stg.Ctot_fine[f[1]], stg.depth_fine[f[1]], f[0])
|
self.axis_vertical_profile_SSC_fine\
|
||||||
|
.set_ylabel("Depth (m)")
|
||||||
else:
|
self.figure_vertical_profile_SSC_fine.canvas.draw_idle()
|
||||||
|
|
||||||
for f in stg.fine_sample_profile:
|
|
||||||
|
|
||||||
time_fine_calibration = (
|
|
||||||
np.where(np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]] - stg.time_fine[f[1]]) ==
|
|
||||||
np.nanmin(np.abs(
|
|
||||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1]] - stg.time_fine[f[1]])))[0][0]
|
|
||||||
)
|
|
||||||
|
|
||||||
if (stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1], int(self.slider_fine.value())] ==
|
|
||||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
stg.frequency_for_inversion[1], int(time_fine_calibration)]):
|
|
||||||
|
|
||||||
self.axis_vertical_profile_SSC_fine.scatter(
|
|
||||||
stg.Ctot_fine[f[1]], stg.depth_fine[f[1]],
|
|
||||||
marker='*', s=48, c='r', edgecolors='r')
|
|
||||||
self.axis_vertical_profile_SSC_fine.text(stg.Ctot_fine[f[1]], stg.depth_fine[f[1]], f[0])
|
|
||||||
|
|
||||||
self.axis_vertical_profile_SSC_fine.set_xlim(0, 10)
|
|
||||||
self.axis_vertical_profile_SSC_fine.set_xlabel("Inverted Fine SSC (g/L)")
|
|
||||||
self.axis_vertical_profile_SSC_fine.set_ylabel("Depth (m)")
|
|
||||||
self.figure_vertical_profile_SSC_fine.canvas.draw_idle()
|
|
||||||
|
|
||||||
def slider_profile_number_to_begin_fine(self):
|
def slider_profile_number_to_begin_fine(self):
|
||||||
self.slider_fine.setValue(int(self.slider_fine.minimum()))
|
self.slider_fine.setValue(int(self.slider_fine.minimum()))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue