Inversion: Some refactoring.
parent
0241f33109
commit
d22e41c582
|
|
@ -1107,154 +1107,144 @@ class AcousticInversionTab(QWidget):
|
|||
self.pcm_SSC_fine_meas_vs_inv.set_data(
|
||||
[[stg.time_fine.remove(s) for s in stg.fine_sample_profile[1]][i] for i in self.fine_sample_to_plot] ,
|
||||
[[stg.depth_fine.remove(s) for s in stg.fine_sample_profile[1]][j] for j in self.fine_sample_to_plot],
|
||||
ls=" ", marker="o", ms=5, mec="k", mfc="k")
|
||||
ls=" ", marker="o", ms=5, mec="k", mfc="k"
|
||||
)
|
||||
|
||||
self.pcm_SSC_fine_meas_vs_inv_sample_calibration.set_data(
|
||||
[[stg.time_fine[s] for s in stg.fine_sample_profile[1]][i] for i in self.fine_sample_to_plot] ,
|
||||
[[stg.depth_fine[s] for s in stg.fine_sample_profile[1]][j] for j in self.fine_sample_to_plot],
|
||||
ls=" ", marker="*", ms=5, mec="r", mfc="r")
|
||||
ls=" ", marker="*", ms=5, mec="r", mfc="r"
|
||||
)
|
||||
|
||||
for i in self.fine_sample_to_plot:
|
||||
for t in stg.fine_sample_profile[0]:
|
||||
if i == t:
|
||||
self.pcm_SSC_fine_meas_vs_inv_sample_calibration_text.set_text(stg.sample_fine[i][0])
|
||||
self.pcm_SSC_fine_meas_vs_inv_sample_calibration_text.set_position(stg.time_fine[i], stg.depth_fine[i])
|
||||
self.pcm_SSC_fine_meas_vs_inv_sample_calibration_text\
|
||||
.set_text(stg.sample_fine[i][0])
|
||||
self.pcm_SSC_fine_meas_vs_inv_sample_calibration_text\
|
||||
.set_position(stg.time_fine[i], stg.depth_fine[i])
|
||||
else:
|
||||
self.pcm_SSC_fine_meas_vs_inv_text.set_text(stg.sample_fine[i][0])
|
||||
self.pcm_SSC_fine_meas_vs_inv_text.set_position(stg.time_fine[i], stg.depth_fine[i])
|
||||
self.pcm_SSC_fine_meas_vs_inv_text\
|
||||
.set_text(stg.sample_fine[i][0])
|
||||
self.pcm_SSC_fine_meas_vs_inv_text\
|
||||
.set_position(stg.time_fine[i], stg.depth_fine[i])
|
||||
|
||||
self.figure_SSC_fine.canvas.draw_idle()
|
||||
|
||||
def plot_SSC_sand(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_sand[self.combobox_acoustic_data_choice.currentIndex()].shape == (0,):
|
||||
self.verticalLayout_groupbox_plot_SSC_sand.removeWidget(self.toolbar_SSC_sand)
|
||||
self.verticalLayout_groupbox_plot_SSC_sand.removeWidget(self.canvas_SSC_sand)
|
||||
|
||||
self.verticalLayout_groupbox_plot_SSC_sand.removeWidget(self.toolbar_SSC_sand)
|
||||
self.verticalLayout_groupbox_plot_SSC_sand.removeWidget(self.canvas_SSC_sand)
|
||||
if stg.SSC_sand[data_id].shape == (0,):
|
||||
self.canvas_SSC_sand = FigureCanvas()
|
||||
self.toolbar_SSC_sand = NavigationToolBar(self.canvas_SSC_sand, self)
|
||||
else:
|
||||
self.figure_SSC_sand, self.axis_SSC_sand = plt.subplots(
|
||||
nrows=1, ncols=1, layout="constrained"
|
||||
)
|
||||
self.canvas_SSC_sand = FigureCanvas(self.figure_SSC_sand)
|
||||
self.toolbar_SSC_sand = NavigationToolBar(self.canvas_SSC_sand, self)
|
||||
|
||||
self.canvas_SSC_sand = FigureCanvas()
|
||||
self.toolbar_SSC_sand = NavigationToolBar(self.canvas_SSC_sand, self)
|
||||
self.verticalLayout_groupbox_plot_SSC_sand.addWidget(self.toolbar_SSC_sand)
|
||||
self.verticalLayout_groupbox_plot_SSC_sand.addWidget(self.canvas_SSC_sand)
|
||||
|
||||
self.verticalLayout_groupbox_plot_SSC_sand.addWidget(self.toolbar_SSC_sand)
|
||||
self.verticalLayout_groupbox_plot_SSC_sand.addWidget(self.canvas_SSC_sand)
|
||||
if stg.SSC_sand[data_id].shape != (0,):
|
||||
val_min = np.nanmin(stg.SSC_sand[data_id])
|
||||
val_max = np.nanmax(stg.SSC_sand[data_id])
|
||||
|
||||
if stg.time_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.verticalLayout_groupbox_plot_SSC_sand.removeWidget(self.toolbar_SSC_sand)
|
||||
self.verticalLayout_groupbox_plot_SSC_sand.removeWidget(self.canvas_SSC_sand)
|
||||
pcm_SSC_sand = self.axis_SSC_sand.pcolormesh(
|
||||
time_data[data_id][stg.frequency_for_inversion[1]],
|
||||
-depth_data[data_id][stg.frequency_for_inversion[1]],
|
||||
stg.SSC_sand[data_id],
|
||||
cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=10),
|
||||
shading='gouraud'
|
||||
)
|
||||
|
||||
self.figure_SSC_sand, self.axis_SSC_sand = plt.subplots(nrows=1, ncols=1, layout="constrained")
|
||||
self.canvas_SSC_sand = FigureCanvas(self.figure_SSC_sand)
|
||||
self.toolbar_SSC_sand = NavigationToolBar(self.canvas_SSC_sand, self)
|
||||
if stg.depth_bottom[data_id].shape != (0,):
|
||||
self.axis_SSC_sand.plot(
|
||||
time_data[data_id][stg.frequency_for_inversion[1]],
|
||||
-stg.depth_bottom[data_id],
|
||||
color='black', linewidth=1, linestyle="solid"
|
||||
)
|
||||
|
||||
self.verticalLayout_groupbox_plot_SSC_sand.addWidget(self.toolbar_SSC_sand)
|
||||
self.verticalLayout_groupbox_plot_SSC_sand.addWidget(self.canvas_SSC_sand)
|
||||
self.pcm_SSC_sand_vertical_line, = self.axis_SSC_sand.plot(
|
||||
time_data[data_id][stg.frequency_for_inversion[1],
|
||||
self.slider_sand.value() - 1]
|
||||
* np.ones(
|
||||
depth_data[data_id][stg.frequency_for_inversion[1]].shape
|
||||
),
|
||||
-depth_data[data_id][stg.frequency_for_inversion[1]],
|
||||
linestyle="solid", color='r', linewidth=2
|
||||
)
|
||||
|
||||
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()])
|
||||
self.plot_SSC_sand_fig, = self.axis_SSC_sand.plot(
|
||||
stg.time_sand, stg.depth_sand,
|
||||
ls=" ", marker="o", ms=5, mec="k", mfc="k"
|
||||
)
|
||||
|
||||
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
# --- Plot samples of fine sediments ---
|
||||
time_sand_temp = deepcopy(stg.time_sand)
|
||||
depth_sand_temp = deepcopy(stg.depth_sand)
|
||||
|
||||
pcm_SSC_sand = self.axis_SSC_sand.pcolormesh(
|
||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
stg.frequency_for_inversion[1]],
|
||||
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
stg.frequency_for_inversion[1]],
|
||||
stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()],
|
||||
cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=10), shading='gouraud')
|
||||
for s in stg.sand_sample_target:
|
||||
time_sand_temp.remove(stg.time_sand[s[1]])
|
||||
depth_sand_temp.remove(stg.depth_sand[s[1]])
|
||||
|
||||
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[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(
|
||||
time_sand_temp, depth_sand_temp,
|
||||
ls=" ", marker="o", ms=5, mec="k", mfc="k"
|
||||
)
|
||||
|
||||
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[1],
|
||||
self.slider_sand.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)
|
||||
time_sand_temp = deepcopy(stg.time_sand)
|
||||
depth_sand_temp = deepcopy(stg.depth_sand)
|
||||
sample_sand_temp = deepcopy(stg.sample_sand)
|
||||
for s in stg.sand_sample_target:
|
||||
sample_sand_temp.remove(s)
|
||||
time_sand_temp.remove(stg.time_sand[s[1]])
|
||||
depth_sand_temp.remove(stg.depth_sand[s[1]])
|
||||
|
||||
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")
|
||||
for i in range(len(sample_sand_temp)):
|
||||
self.axis_SSC_sand.text(
|
||||
time_sand_temp[i],
|
||||
depth_sand_temp[i],
|
||||
sample_sand_temp[i][0]
|
||||
)
|
||||
|
||||
else:
|
||||
time_sand_temp, depth_sand_temp = stg.time_sand, stg.depth_sand
|
||||
self.axis_SSC_sand.plot(
|
||||
[time_sand_temp[s[1]] for s in stg.sand_sample_target],
|
||||
[depth_sand_temp[s[1]] for s in stg.sand_sample_target],
|
||||
ls=" ", marker="*", ms=12, mec="r", mfc="r"
|
||||
)
|
||||
|
||||
pcm_SSC_sand = self.axis_SSC_sand.pcolormesh(
|
||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
stg.frequency_for_inversion[1]],
|
||||
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
stg.frequency_for_inversion[1]],
|
||||
stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()],
|
||||
cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=10), shading='gouraud')
|
||||
time_sand_temp, depth_sand_temp = stg.time_sand, stg.depth_sand
|
||||
for i, j in stg.sand_sample_target:
|
||||
self.axis_SSC_sand.text(
|
||||
time_sand_temp[j] + 5, depth_sand_temp[j] + 0.05, i,
|
||||
color='r', fontweight='bold'
|
||||
)
|
||||
|
||||
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[1]],
|
||||
-stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()],
|
||||
color='black', linewidth=1, linestyle="solid")
|
||||
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)
|
||||
|
||||
self.pcm_SSC_sand_vertical_line, = self.axis_SSC_sand.plot(
|
||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
stg.frequency_for_inversion[1],
|
||||
self.slider_sand.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]],
|
||||
linestyle="solid", color='r', linewidth=2)
|
||||
|
||||
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")
|
||||
|
||||
# --- Plot samples of fine sediments ---
|
||||
time_sand_temp = deepcopy(stg.time_sand)
|
||||
depth_sand_temp = deepcopy(stg.depth_sand)
|
||||
for s in stg.sand_sample_target:
|
||||
|
||||
time_sand_temp.remove(stg.time_sand[s[1]])
|
||||
depth_sand_temp.remove(stg.depth_sand[s[1]])
|
||||
self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot(
|
||||
time_sand_temp, depth_sand_temp, ls=" ", marker="o", ms=5, mec="k", mfc="k")
|
||||
|
||||
time_sand_temp = deepcopy(stg.time_sand)
|
||||
depth_sand_temp = deepcopy(stg.depth_sand)
|
||||
sample_sand_temp = deepcopy(stg.sample_sand)
|
||||
for s in stg.sand_sample_target:
|
||||
sample_sand_temp.remove(s)
|
||||
time_sand_temp.remove(stg.time_sand[s[1]])
|
||||
depth_sand_temp.remove(stg.depth_sand[s[1]])
|
||||
for i in range(len(sample_sand_temp)):
|
||||
self.pcm_SSC_sand_meas_vs_inv_text = self.axis_SSC_sand.text(
|
||||
time_sand_temp[i],
|
||||
depth_sand_temp[i], sample_sand_temp[i][0])
|
||||
|
||||
time_sand_temp, depth_sand_temp = stg.time_sand, stg.depth_sand
|
||||
self.pcm_SSC_sand_meas_vs_inv_sample_calibration, = self.axis_SSC_sand.plot(
|
||||
[time_sand_temp[s[1]] for s in stg.sand_sample_target],
|
||||
[depth_sand_temp[s[1]] for s in stg.sand_sample_target],
|
||||
ls=" ", marker="*", ms=12, mec="r", mfc="r")
|
||||
|
||||
time_sand_temp, depth_sand_temp = stg.time_sand, stg.depth_sand
|
||||
for i, j in stg.sand_sample_target:
|
||||
self.pcm_SSC_sand_meas_vs_inv_sample_calibration_text = self.axis_SSC_sand.text(
|
||||
time_sand_temp[j] + 5, depth_sand_temp[j] + 0.05, i, color='r', fontweight='bold')
|
||||
|
||||
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)
|
||||
|
||||
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()
|
||||
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):
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue