Vertical profile plot of SSC sand is added and a red vertical line display the profile position 2D field. Measured vs Inverted SSC sand is added. User can choose sample to display.

dev-brahim
brahim 2024-08-30 20:41:12 +02:00
parent ffc85d733d
commit 1b2c5954ee
1 changed files with 491 additions and 54 deletions

View File

@ -110,10 +110,15 @@ class AcousticInversionTab(QWidget):
self.horizontalLayoutBottom.addWidget(self.groupbox_plot_SSC_sand, 6)
self.groupbox_plot_SSC_sand_vertical_profile = QGroupBox()
self.horizontalLayoutBottom.addWidget(self.groupbox_plot_SSC_sand_vertical_profile, 3)
# self.horizontalLayoutBottom.addWidget(self.groupbox_plot_SSC_sand_vertical_profile, 3)
self.verticalLayout_groupbox_plot_SSC_sand_profile_and_slider = QVBoxLayout()
self.horizontalLayoutBottom.addLayout(self.verticalLayout_groupbox_plot_SSC_sand_profile_and_slider, 3)
self.groupbox_plot_measured_vs_inverted_SSC_sand = QGroupBox()
self.horizontalLayoutBottom.addWidget(self.groupbox_plot_measured_vs_inverted_SSC_sand, 3)
# self.horizontalLayoutBottom.addWidget(self.groupbox_plot_measured_vs_inverted_SSC_sand, 3)
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand_and_combobox = QVBoxLayout()
self.horizontalLayoutBottom.addLayout(self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand_and_combobox,
3)
# =====================================================
@ -238,6 +243,9 @@ class AcousticInversionTab(QWidget):
# | Group box SSC sand vertical profile |
# +++++++++++++++++++++++++++++++++++++++++++++++
self.verticalLayout_groupbox_plot_SSC_sand_profile_and_slider.addWidget(
self.groupbox_plot_SSC_sand_vertical_profile)
self.verticalLayout_groupbox_plot_vertical_profile_sand = QVBoxLayout(
self.groupbox_plot_SSC_sand_vertical_profile)
@ -248,7 +256,8 @@ class AcousticInversionTab(QWidget):
self.verticalLayout_groupbox_plot_vertical_profile_sand.addWidget(self.canvas_profile_sand)
self.horizontalLayout_slider_sand = QHBoxLayout()
self.verticalLayout_groupbox_plot_vertical_profile_sand.addLayout(self.horizontalLayout_slider_sand)
# self.verticalLayout_groupbox_plot_vertical_profile_sand.addLayout(self.horizontalLayout_slider_sand)
self.verticalLayout_groupbox_plot_SSC_sand_profile_and_slider.addLayout(self.horizontalLayout_slider_sand)
self.pushbutton_left_to_begin_sand = QPushButton()
self.pushbutton_left_to_begin_sand.setIcon(self.icon_triangle_left_to_begin)
@ -282,9 +291,12 @@ class AcousticInversionTab(QWidget):
self.slider_sand.setValue(1)
# +++++++++++++++++++++++++++++++++++++++++++++++++++
# | Group box Measured VS Inverted SSC Fine |
# | Group box Measured VS Inverted SSC Sand |
# +++++++++++++++++++++++++++++++++++++++++++++++++++
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand_and_combobox.addWidget(
self.groupbox_plot_measured_vs_inverted_SSC_sand)
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand = QVBoxLayout(
self.groupbox_plot_measured_vs_inverted_SSC_sand)
@ -297,16 +309,23 @@ class AcousticInversionTab(QWidget):
self.canvas_inverted_vs_measured_SSC_sand)
self.horizontalLayout_combobox_sand_sample_choice = QHBoxLayout()
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand.addLayout(
# self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand.addLayout(
# self.horizontalLayout_combobox_sand_sample_choice)
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand_and_combobox.addLayout(
self.horizontalLayout_combobox_sand_sample_choice)
self.label_sand_sample_choice = QLabel()
self.label_sand_sample_choice.setText("Sand sample choice : ")
self.horizontalLayout_combobox_sand_sample_choice.addWidget(self.label_sand_sample_choice)
self.combobox_sand_sample_choice = QComboBox()
self.combobox_sand_sample_choice = CheckableComboBox()
self.horizontalLayout_combobox_sand_sample_choice.addWidget(self.combobox_sand_sample_choice)
self.pushbutton_plot_sand_sample_choice = QPushButton()
self.pushbutton_plot_sand_sample_choice.setIcon(self.icon_update)
self.pushbutton_plot_sand_sample_choice.setMaximumWidth(50)
self.horizontalLayout_combobox_sand_sample_choice.addWidget(self.pushbutton_plot_sand_sample_choice)
# ==============================================================================================================
# ---------------------------------------- Connect signal of widget --------------------------------------------
# ==============================================================================================================
@ -323,15 +342,17 @@ class AcousticInversionTab(QWidget):
self.slider_fine.valueChanged.connect(self.update_lineEdit_by_moving_slider_fine)
self.slider_fine.valueChanged.connect(self.update_plot_SSC_fine_vertical_profile)
self.pushbutton_plot_fine_sample_choice.clicked.connect(self.plot_measured_vs_inverted_SSC_fine)
self.pushbutton_left_to_begin_sand.clicked.connect(self.slider_profile_number_to_begin_sand)
self.pushbutton_left_sand.clicked.connect(self.slider_profile_number_to_left_sand)
self.pushbutton_right_sand.clicked.connect(self.slider_profile_number_to_right_sand)
self.pushbutton_right_to_end_sand.clicked.connect(self.slider_profile_number_to_end_sand)
self.lineEdit_slider_sand.returnPressed.connect(self.profile_number_on_lineEdit_sand)
self.slider_sand.valueChanged.connect(self.update_lineEdit_by_moving_slider_sand)
self.slider_sand.valueChanged.connect(self.update_plot_SSC_sand_vertical_profile)
self.pushbutton_plot_fine_sample_choice.clicked.connect(self.plot_measured_vs_inverted_SSC_fine)
self.pushbutton_plot_fine_sample_choice.clicked.connect(self.update_plot_sample_position_on_concentration_field)
self.pushbutton_plot_sand_sample_choice.clicked.connect(self.plot_measured_vs_inverted_SSC_sand)
# ==================================================================================================================
# ------------------------------------ Functions for Acoustic Inversion Tab ----------------------------------------
@ -349,12 +370,18 @@ class AcousticInversionTab(QWidget):
self.compute_VBI()
self.compute_SSC_fine()
self.compute_SSC_sand()
self.fill_combobox_fine_sample()
self.plot_SSC_fine()
self.plot_SSC_sand()
self.plot_SSC_fine_vertical_profile()
self.plot_measured_vs_inverted_SSC_fine()
self.fill_combobox_sand_sample()
self.plot_SSC_sand()
self.plot_SSC_sand_vertical_profile()
self.plot_measured_vs_inverted_SSC_sand()
def compute_VBI(self):
print("compute VBI")
@ -969,88 +996,252 @@ class AcousticInversionTab(QWidget):
self.verticalLayout_groupbox_plot_SSC_sand.addWidget(self.toolbar_SSC_sand)
self.verticalLayout_groupbox_plot_SSC_sand.addWidget(self.canvas_SSC_sand)
val_min = np.nanmin(stg.SSC_sand)
val_max = np.nanmax(stg.SSC_sand)
val_min = np.nanmin(stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()])
val_max = np.nanmax(stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()])
print("ABS name ", stg.ABS_name)
if stg.ABS_name[0] == "Aquascat 1000R":
print("hey !")
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
print("hey hey !")
# print("time cross section ", stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
# stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]])
# print("depth cross section ", stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
# stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]])
# print(stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1])
pcm_SSC_sand = self.axis_SSC_sand.pcolormesh(
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]],
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]],
stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()],
cmap='rainbow', norm=LogNorm(vmin=1e-2, vmax=10), shading='gouraud')
cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=10), shading='gouraud')
if stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.axis_SSC_sand.plot(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]],
stg.frequency_for_inversion[
self.combobox_acoustic_data_choice.currentIndex()][0][1]],
-stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()],
color='black', linewidth=1, linestyle="solid")
self.pcm_SSC_sand_vertical_line, = self.axis_SSC_sand.plot(
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1],
self.slider_sand.value() - 1] *
np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][
1]].shape),
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]],
linestyle="solid", color='r', linewidth=2)
print("o+o+o+o+o+o")
print(stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1])
print([i for i, _ in stg.sand_sample_position[self.combobox_acoustic_data_choice.currentIndex()]])
# print([stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
# stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1], i]
# for i, _ in stg.fine_sample_position[self.combobox_acoustic_data_choice.currentIndex()]])
print("o+o+o+o+o+o")
# self.pcm_SSC_fine_meas_vs_inv, = self.axis_SSC_fine.plot(
# [stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
# stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1], i]
# for i, _ in stg.fine_sample_position[self.combobox_acoustic_data_choice.currentIndex()]],
# [-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
# stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1], j]
# for _, j in stg.fine_sample_position[self.combobox_acoustic_data_choice.currentIndex()]],
# ls=" ", marker="o", ms=5, mec="k", mfc="k")
self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot(stg.time_sand, stg.depth_sand,
ls=" ", marker="o", ms=5, mec="k", mfc="k")
print(stg.time_sand)
print(stg.depth_sand)
print([f for _, f in stg.sample_sand])
for i, j in stg.sample_sand:
self.pcm_SSC_sand_meas_vs_inv_text = self.axis_SSC_sand.text(
stg.time_sand[j],
stg.depth_sand[j],
i)
else:
pcm_SSC_sand = self.axis_SSC_sand.pcolormesh(
stg.time[self.combobox_acoustic_data_choice.currentIndex()][stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]],
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]],
stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]],
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]],
stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()],
cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=10), shading='gouraud')
if stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.axis_SSC_sand.plot(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]],
stg.frequency_for_inversion[
self.combobox_acoustic_data_choice.currentIndex()][0][1]],
-stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()],
color='black', linewidth=1, linestyle="solid")
self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot(
[stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1], i]
for i, _ in stg.sand_sample_position[self.combobox_acoustic_data_choice.currentIndex()]],
[-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1], j]
for _, j in stg.sand_sample_position[self.combobox_acoustic_data_choice.currentIndex()]],
ls=" ", marker="o", ms=5, mec="k", mfc="k")
cbar_SSC_sand = self.figure_SSC_sand.colorbar(pcm_SSC_sand, ax=self.axis_SSC_sand, shrink=1,
location='right')
cbar_SSC_sand.set_label(label='Sand SSC (g/L', rotation=270, labelpad=15)
cbar_SSC_sand.set_label(label='Fine SSC (g/L', rotation=270, labelpad=15)
elif stg.ABS_name[0] == "UB-SediFlow":
pcm_SSC_sand = self.axis_SSC_sand.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_sand.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")
#
# if self.combobox_fig_choice.currentText() == "Inverted SSC sand vertical profile":
# self.axis_SSC_sand.plot(stg.t[0, self.slider.value() - 1] * np.ones(stg.r.shape[1]),
# -stg.r[0, :],
# color='black', linestyle="solid", linewidth=2)
-stg.r[0, :],
stg.SSC_sand,
cmap='rainbow',
norm=LogNorm(vmin=1e-2, vmax=10),
shading='gouraud')
self.figure_SSC_sand.supxlabel("Time (sec)", fontsize=10)
self.figure_SSC_sand.supylabel("Depth (m)", fontsize=10)
self.figure_SSC_sand.canvas.draw_idle()
def plot_SSC_sand_vertical_profile(self):
if stg.filename_BS_noise_data != []:
if stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.slider_sand.setMaximum(stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()].shape[1])
self.verticalLayout_groupbox_plot_vertical_profile_sand.removeWidget(self.toolbar_profile_sand)
self.verticalLayout_groupbox_plot_vertical_profile_sand.removeWidget(self.canvas_profile_sand)
self.figure_vertical_profile_SSC_sand, self.axis_vertical_profile_SSC_sand = plt.subplots(
nrows=1, ncols=1, layout="constrained")
self.canvas_profile_sand = FigureCanvas(self.figure_vertical_profile_SSC_sand)
self.toolbar_profile_sand = NavigationToolBar(self.canvas_profile_sand)
self.verticalLayout_groupbox_plot_vertical_profile_sand.addWidget(self.toolbar_profile_sand)
self.verticalLayout_groupbox_plot_vertical_profile_sand.addWidget(self.canvas_profile_sand)
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.plot_sand , = self.axis_vertical_profile_SSC_sand.plot(
stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][:, self.slider_sand.value() -1],
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]],
linestyle="solid", linewidth=1, color="k")
self.pcm_SSC_sand_vertical_line.set_data(
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1],
self.slider_sand.value() - 1] *
np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]].shape),
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]])
self.figure_SSC_sand.canvas.draw_idle()
self.axis_vertical_profile_SSC_sand.set_ylim(
[-np.nanmax(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]]),
-np.nanmin(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]])])
else:
self.axis_vertical_profile_SSC_sand.plot(
stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][:, self.slider_sand.value() -1],
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]],
linestyle="solid", linewidth=1, color="k")
self.pcm_SSC_sand_vertical_line.set_data(
stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1], self.slider_sand.value() - 1] *
np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]].shape),
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]])
self.figure_SSC_sand.canvas.draw_idle()
self.axis_vertical_profile_SSC_sand.set_ylim(
[-np.nanmax(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]]),
-np.nanmin(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]])])
# self.axis_SSC_fine.plot([], [], )
self.axis_vertical_profile_SSC_sand.set_xlabel("Inverted Sand SSC (g/L)")
self.axis_vertical_profile_SSC_sand.set_ylabel("Depth (m)")
self.figure_vertical_profile_SSC_sand.canvas.draw_idle()
def update_plot_SSC_sand_vertical_profile(self):
if stg.filename_BS_noise_data != []:
if stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.plot_sand.set_data(
stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][:,
self.slider_sand.value() - 1],
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]])
self.pcm_SSC_sand_vertical_line.set_data(
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1],
self.slider_sand.value() - 1] *
np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]].shape),
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]])
self.figure_SSC_sand.canvas.draw_idle()
self.axis_vertical_profile_SSC_sand.set_ylim(
[-np.nanmax(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]]),
-np.nanmin(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]])])
else:
self.axis_vertical_profile_SSC_sand.set_data(
stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][:,
self.slider_sand.value() - 1],
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]])
self.pcm_SSC_sand_vertical_line.set_data(
stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1], self.slider_sand.value() - 1] *
np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]].shape),
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]])
self.figure_SSC_sand.canvas.draw_idle()
self.axis_vertical_profile_SSC_sand.set_ylim(
[-np.nanmax(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]]),
-np.nanmin(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]])])
self.axis_vertical_profile_SSC_sand.set_xlabel("Inverted Sand SSC (g/L)")
self.axis_vertical_profile_SSC_sand.set_ylabel("Depth (m)")
self.figure_vertical_profile_SSC_sand.canvas.draw_idle()
def slider_profile_number_to_begin_sand(self):
self.slider_sand.setValue(int(self.slider_sand.minimum()))
self.lineEdit_slider_sand.setText(str(self.slider_sand.value()))
@ -1073,6 +1264,252 @@ class AcousticInversionTab(QWidget):
def update_lineEdit_by_moving_slider_sand(self):
self.lineEdit_slider_sand.setText(str(self.slider_sand.value()))
# --- Plot sand SSC : measured vs inverted ---
def fill_combobox_sand_sample(self):
print("stg.sample_sand ", stg.sample_sand)
self.combobox_sand_sample_choice.addItems([f for f, _ in stg.sample_sand])
# --- Get position (index, value) of sample in acoustic measurement space ---
if ((stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,)) and
(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))):
print(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]])
print(stg.depth_fine)
for j in range(len(stg.time_sand)):
(stg.sand_sample_position[self.combobox_acoustic_data_choice.currentIndex()].
append(
(
np.where(
np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - stg.time_sand[j])
==
np.nanmin(np.abs(stg.time_cross_section[
self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - stg.time_sand[j]))
)[0][0],
np.where(
np.abs(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - (-stg.depth_sand[j]))
==
np.nanmin(np.abs(stg.depth_cross_section[
self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - (-stg.depth_sand[j])))
)[0][0]
)
)
)
print("0 stg.sand_sample_position ", stg.sand_sample_position)
elif ((stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,)) and
(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))):
for j in range(len(stg.time_sand)):
(stg.sand_sample_position[self.combobox_acoustic_data_choice.currentIndex()].
append(
(
np.where(
np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - stg.time_sand[j])
==
np.nanmin(np.abs(stg.time_cross_section[
self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - stg.time_sand[j]))
)[0][0],
np.where(
np.abs(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - (-stg.depth_sand[j]))
==
np.nanmin(np.abs(stg.depth[
self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - (-stg.depth_sand[j])))
)[0][0]
)
)
)
print("1 stg.sand_sample_position ", stg.sand_sample_position)
elif ((stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,)) and
(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))):
for j in range(len(stg.time_sand)):
(stg.sand_sample_position[self.combobox_acoustic_data_choice.currentIndex()].
append(
(
np.where(
np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - stg.time_sand[j])
==
np.nanmin(np.abs(stg.time[
self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - stg.time_sand[j]))
)[0][0],
np.where(
np.abs(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - (-stg.depth_sand[j]))
==
np.nanmin(np.abs(stg.depth_cross_section[
self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - (-stg.depth_sand[j])))
)[0][0]
)
)
)
print("2 stg.sand_sample_position ", stg.sand_sample_position)
elif ((stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,)) and
(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))):
for j in range(len(stg.time_sand)):
(stg.sand_sample_position[self.combobox_acoustic_data_choice.currentIndex()].
append(
(
np.where(
np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - stg.time_sand[j])
==
np.nanmin(np.abs(stg.time[
self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - stg.time_sand[j]))
)[0][0],
np.where(
np.abs(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - (-stg.depth_sand[j]))
==
np.nanmin(np.abs(stg.depth[
self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()][0][1]] - (-stg.depth_sand[j])))
)[0][0]
)
)
)
print("3 stg.sand_sample_position ", stg.sand_sample_position)
def plot_measured_vs_inverted_SSC_sand(self):
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand.removeWidget(
self.toolbar_inverted_vs_measured_SSC_sand)
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand.removeWidget(
self.canvas_inverted_vs_measured_SSC_sand)
self.figure_measured_vs_inverted_sand, self.axis_measured_vs_inverted_sand = (
plt.subplots(nrows=1, ncols=1, layout="constrained"))
self.canvas_inverted_vs_measured_SSC_sand = FigureCanvas(self.figure_measured_vs_inverted_sand)
self.toolbar_inverted_vs_measured_SSC_sand = NavigationToolBar(self.canvas_inverted_vs_measured_SSC_sand, self)
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand.addWidget(
self.toolbar_inverted_vs_measured_SSC_sand)
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand.addWidget(
self.canvas_inverted_vs_measured_SSC_sand)
print("self.combobox_sand_sample_choice.currentData() ", self.combobox_sand_sample_choice.currentData())
print("self.combobox_sand_sample_choice.currentIndex() ", self.combobox_sand_sample_choice.currentIndex())
print("///////////////////////////////////////////////////")
self.sand_sample_to_plot = [int(f[1:]) - 1 for f in self.combobox_sand_sample_choice.currentData()]
print("self.sand_sample_to_plot ", self.sand_sample_to_plot)
# for k in self.fine_sample_to_plot:
# print("stg.Ctot_fine[k] ", stg.Ctot_fine[k])
# print(stg.fine_sample_position[self.combobox_acoustic_data_choice.currentIndex()][k][1])
# print(stg.fine_sample_position[self.combobox_acoustic_data_choice.currentIndex()][k][0])
# print(stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()][
# stg.fine_sample_position[self.combobox_acoustic_data_choice.currentIndex()][k][1],
# stg.fine_sample_position[self.combobox_acoustic_data_choice.currentIndex()][k][0]])
if self.sand_sample_to_plot:
self.axis_measured_vs_inverted_sand.plot(
[stg.Ctot_sand[k] for k in self.sand_sample_to_plot],
[stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][
stg.sand_sample_position[self.combobox_acoustic_data_choice.currentIndex()][k][1],
stg.sand_sample_position[self.combobox_acoustic_data_choice.currentIndex()][k][0]] for k in
self.sand_sample_to_plot],
ls=" ", marker='o', ms=5, mec='black', mfc="black"
)
self.axis_measured_vs_inverted_sand.plot(
[0, np.nanmax([np.nanmax([stg.Ctot_sand[c] for c in self.sand_sample_to_plot]),
np.nanmax([stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][
stg.sand_sample_position[
self.combobox_acoustic_data_choice.currentIndex()][i][1],
stg.sand_sample_position[
self.combobox_acoustic_data_choice.currentIndex()][i][0]]
for i in self.sand_sample_to_plot])]) + 1],
[0, np.nanmax([np.nanmax([stg.Ctot_sand[c] for c in self.sand_sample_to_plot]),
np.nanmax([stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][
stg.sand_sample_position[
self.combobox_acoustic_data_choice.currentIndex()][i][1],
stg.sand_sample_position[
self.combobox_acoustic_data_choice.currentIndex()][i][0]]
for i in self.sand_sample_to_plot])]) + 1],
ls="solid", linewidth=1, color="k"
)
# --- Display sample label on plot ---
for i in self.sand_sample_to_plot:
self.axis_measured_vs_inverted_sand.text(
stg.Ctot_sand[i],
stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][
stg.sand_sample_position[self.combobox_acoustic_data_choice.currentIndex()][i][1],
stg.sand_sample_position[self.combobox_acoustic_data_choice.currentIndex()][i][0]],
stg.sample_sand[i][0],
fontstyle="normal", fontweight="light", fontsize=10)
else:
self.axis_measured_vs_inverted_sand.plot(
[stg.Ctot_sand[k] for k in range(len(stg.sample_sand))],
[stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][
stg.sand_sample_position[self.combobox_acoustic_data_choice.currentIndex()][k][1],
stg.sand_sample_position[self.combobox_acoustic_data_choice.currentIndex()][k][0]] for k in
range(len(stg.sample_sand))],
ls=" ", marker='o', ms=5, mec='black', mfc="black"
)
self.axis_measured_vs_inverted_sand.plot(
[0, np.nanmax([np.nanmax([stg.Ctot_sand[c] for c in range(len(stg.sample_sand))]),
np.nanmax([stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][
stg.sand_sample_position[
self.combobox_acoustic_data_choice.currentIndex()][i][1],
stg.sand_sample_position[
self.combobox_acoustic_data_choice.currentIndex()][i][0]]
for i in range(len(stg.sample_sand))])]) + 1],
[0, np.nanmax([np.nanmax([stg.Ctot_sand[c] for c in range(len(stg.sample_sand))]),
np.nanmax([stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][
stg.sand_sample_position[
self.combobox_acoustic_data_choice.currentIndex()][i][1],
stg.sand_sample_position[
self.combobox_acoustic_data_choice.currentIndex()][i][0]]
for i in range(len(stg.sample_sand))])]) + 1],
ls="solid", linewidth=1, color="k"
)
for j in range(len(stg.sample_sand)):
self.axis_measured_vs_inverted_sand.text(
stg.Ctot_sand[j],
stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][
stg.sand_sample_position[self.combobox_acoustic_data_choice.currentIndex()][j][1],
stg.sand_sample_position[self.combobox_acoustic_data_choice.currentIndex()][j][0]],
stg.sample_sand[j][0],
fontstyle="normal", fontweight="light", fontsize=10)
self.axis_measured_vs_inverted_sand.set_xlabel("Measured SSC sand (g/L)")
self.axis_measured_vs_inverted_sand.set_ylabel("Inverted SSC sand (g/L)")
self.figure_measured_vs_inverted_sand.canvas.draw_idle()
# --------------------------------------------------------------------------------------------------------------
@ -1083,7 +1520,7 @@ class AcousticInversionTab(QWidget):
# | | | | /
# |______| |________ |________/
# COMMENT OLD CODE LINE FROM HERE ....
# COMMENT OLD CODE LINE FROM HERE ...
# ### --- Layout of groupbox in the Top horizontal layout box
#