Compare commits
5 Commits
0dd38af7a9
...
42e104cba9
| Author | SHA1 | Date |
|---|---|---|
|
|
42e104cba9 | |
|
|
ae6b91366a | |
|
|
5ce7ffb52b | |
|
|
abce4bac07 | |
|
|
a570ca3522 |
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import gc
|
import gc
|
||||||
|
import time
|
||||||
import logging
|
import logging
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
@ -1035,7 +1036,7 @@ class AcousticInversionTab(QWidget):
|
||||||
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_fine\
|
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_fine\
|
||||||
.addWidget(self.canvas_inverted_vs_measured_SSC_fine)
|
.addWidget(self.canvas_inverted_vs_measured_SSC_fine)
|
||||||
|
|
||||||
if stg.SSC_fine[data_id].shape == (0,):
|
if stg.SSC_fine[data_id].shape != (0,):
|
||||||
fine_id = self.combobox_fine_sample_choice.currentData()
|
fine_id = self.combobox_fine_sample_choice.currentData()
|
||||||
|
|
||||||
self.fine_sample_to_plot = [
|
self.fine_sample_to_plot = [
|
||||||
|
|
@ -1551,122 +1552,120 @@ class AcousticInversionTab(QWidget):
|
||||||
)
|
)
|
||||||
|
|
||||||
def plot_measured_vs_inverted_SSC_sand(self):
|
def plot_measured_vs_inverted_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_measured_vs_inverted_SSC_sand\
|
||||||
|
.removeWidget(self.toolbar_inverted_vs_measured_SSC_sand)
|
||||||
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand.removeWidget(
|
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand\
|
||||||
self.toolbar_inverted_vs_measured_SSC_sand)
|
.removeWidget(self.canvas_inverted_vs_measured_SSC_sand)
|
||||||
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand.removeWidget(
|
|
||||||
self.canvas_inverted_vs_measured_SSC_sand)
|
|
||||||
|
|
||||||
|
if stg.SSC_sand[data_id].shape == (0,):
|
||||||
self.canvas_inverted_vs_measured_SSC_sand = FigureCanvas()
|
self.canvas_inverted_vs_measured_SSC_sand = FigureCanvas()
|
||||||
self.toolbar_inverted_vs_measured_SSC_sand = NavigationToolBar(
|
self.toolbar_inverted_vs_measured_SSC_sand = NavigationToolBar(
|
||||||
self.canvas_inverted_vs_measured_SSC_sand, self)
|
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)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
if self.figure_measured_vs_inverted_sand is not None:
|
if self.figure_measured_vs_inverted_sand is not None:
|
||||||
self.figure_measured_vs_inverted_sand.clear()
|
self.figure_measured_vs_inverted_sand.clear()
|
||||||
plt.close(fig=self.figure_measured_vs_inverted_sand)
|
plt.close(fig=self.figure_measured_vs_inverted_sand)
|
||||||
|
|
||||||
fig, ax = plt.subplots(nrows=1, ncols=1, layout="constrained")
|
fig, ax = plt.subplots(nrows=1, ncols=1, layout="constrained")
|
||||||
|
|
||||||
self.figure_measured_vs_inverted_sand = fig
|
self.figure_measured_vs_inverted_sand = fig
|
||||||
self.axis_measured_vs_inverted_sand = ax
|
self.axis_measured_vs_inverted_sand = ax
|
||||||
|
|
||||||
|
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.canvas_inverted_vs_measured_SSC_sand = FigureCanvas(self.figure_measured_vs_inverted_sand)
|
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand\
|
||||||
self.toolbar_inverted_vs_measured_SSC_sand = NavigationToolBar(self.canvas_inverted_vs_measured_SSC_sand, self)
|
.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)
|
||||||
|
|
||||||
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand.addWidget(
|
if stg.SSC_sand[data_id].shape != (0,):
|
||||||
self.toolbar_inverted_vs_measured_SSC_sand)
|
sand_id = self.combobox_sand_sample_choice.currentData()
|
||||||
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand.addWidget(
|
|
||||||
self.canvas_inverted_vs_measured_SSC_sand)
|
|
||||||
|
|
||||||
self.sand_sample_to_plot = [int(f[1:]) - 1 for f in self.combobox_sand_sample_choice.currentData()]
|
self.sand_sample_to_plot = [
|
||||||
|
int(f[1:]) - 1 for f in sand_id
|
||||||
|
]
|
||||||
|
|
||||||
if self.sand_sample_to_plot:
|
if self.sand_sample_to_plot:
|
||||||
|
sand_range = lambda : self.sand_sample_to_plot
|
||||||
|
else:
|
||||||
|
sand_range = lambda : range(len(stg.sample_sand))
|
||||||
|
|
||||||
self.axis_measured_vs_inverted_sand.plot(
|
self.axis_measured_vs_inverted_sand.plot(
|
||||||
[stg.Ctot_sand[k] for k in self.sand_sample_to_plot],
|
[stg.Ctot_sand[k] for k in sand_range()],
|
||||||
[stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][
|
[
|
||||||
|
stg.SSC_sand[data_id][
|
||||||
stg.sand_sample_position[k][1],
|
stg.sand_sample_position[k][1],
|
||||||
stg.sand_sample_position[k][0]] for k in
|
stg.sand_sample_position[k][0]
|
||||||
self.sand_sample_to_plot],
|
] for k in sand_range()
|
||||||
|
],
|
||||||
ls=" ", marker='o', ms=5, mec='black', mfc="black"
|
ls=" ", marker='o', ms=5, mec='black', mfc="black"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.axis_measured_vs_inverted_sand.plot(
|
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()][
|
0, np.nanmax(
|
||||||
|
[
|
||||||
|
np.nanmax(
|
||||||
|
[stg.Ctot_sand[c] for c in sand_range()]
|
||||||
|
),
|
||||||
|
np.nanmax(
|
||||||
|
[
|
||||||
|
stg.SSC_sand[data_id][
|
||||||
stg.sand_sample_position[i][1],
|
stg.sand_sample_position[i][1],
|
||||||
stg.sand_sample_position[i][0]]
|
stg.sand_sample_position[i][0]
|
||||||
for i in self.sand_sample_to_plot])]) + 1],
|
] for i in sand_range()
|
||||||
[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()][
|
)
|
||||||
|
]
|
||||||
|
) + 1
|
||||||
|
],
|
||||||
|
[
|
||||||
|
0, np.nanmax(
|
||||||
|
[
|
||||||
|
np.nanmax(
|
||||||
|
[stg.Ctot_sand[c] for c in sand_range()]
|
||||||
|
),
|
||||||
|
np.nanmax(
|
||||||
|
[
|
||||||
|
stg.SSC_sand[data_id][
|
||||||
stg.sand_sample_position[i][1],
|
stg.sand_sample_position[i][1],
|
||||||
stg.sand_sample_position[i][0]]
|
stg.sand_sample_position[i][0]
|
||||||
for i in self.sand_sample_to_plot])]) + 1],
|
] for i in sand_range()
|
||||||
|
]
|
||||||
|
)
|
||||||
|
]
|
||||||
|
) + 1
|
||||||
|
],
|
||||||
ls="solid", linewidth=1, color="k"
|
ls="solid", linewidth=1, color="k"
|
||||||
)
|
)
|
||||||
|
|
||||||
# --- Display sample label on plot ---
|
# --- Display sample label on plot ---
|
||||||
for i in self.sand_sample_to_plot:
|
for i in sand_range():
|
||||||
self.axis_measured_vs_inverted_sand.text(
|
self.axis_measured_vs_inverted_sand.text(
|
||||||
stg.Ctot_sand[i],
|
stg.Ctot_sand[i],
|
||||||
stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][
|
stg.SSC_sand[data_id][
|
||||||
stg.sand_sample_position[i][1],
|
stg.sand_sample_position[i][1],
|
||||||
stg.sand_sample_position[i][0]],
|
stg.sand_sample_position[i][0]
|
||||||
|
],
|
||||||
stg.sample_sand[i][0],
|
stg.sample_sand[i][0],
|
||||||
fontstyle="normal", fontweight="light", fontsize=10)
|
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[k][1],
|
|
||||||
stg.sand_sample_position[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(
|
self.axis_measured_vs_inverted_sand\
|
||||||
[0, np.nanmax([np.nanmax([stg.Ctot_sand[c] for c in range(len(stg.sample_sand))]),
|
.set_xlabel("Measured SSC sand (g/L)")
|
||||||
np.nanmax([stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][
|
self.axis_measured_vs_inverted_sand\
|
||||||
stg.sand_sample_position[i][1],
|
.set_ylabel("Inverted SSC sand (g/L)")
|
||||||
stg.sand_sample_position[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[i][1],
|
|
||||||
stg.sand_sample_position[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[j][1],
|
|
||||||
stg.sand_sample_position[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()
|
self.figure_measured_vs_inverted_sand.canvas.draw_idle()
|
||||||
|
|
||||||
|
|
@ -1700,9 +1699,10 @@ class AcousticInversionTab(QWidget):
|
||||||
if t_ext not in filename:
|
if t_ext not in filename:
|
||||||
filename += t_ext
|
filename += t_ext
|
||||||
|
|
||||||
|
t = time.time()
|
||||||
logger.info(f"Export results to {os.path.join(dirname, filename)}")
|
logger.info(f"Export results to {os.path.join(dirname, filename)}")
|
||||||
fun(dirname, filename)
|
fun(dirname, filename)
|
||||||
logger.info(f"... export done")
|
logger.info(f"... export done in {time.time() - t:.4f} sec")
|
||||||
|
|
||||||
def save_result_in_excel_file(self, dirname, filename):
|
def save_result_in_excel_file(self, dirname, filename):
|
||||||
if ".ods" in filename:
|
if ".ods" in filename:
|
||||||
|
|
|
||||||
|
|
@ -776,6 +776,9 @@ class SampleDataTab(QWidget):
|
||||||
self.combobox_acoustic_data.showPopup()
|
self.combobox_acoustic_data.showPopup()
|
||||||
|
|
||||||
def fill_comboboxes_and_plot_transect(self):
|
def fill_comboboxes_and_plot_transect(self):
|
||||||
|
if len(stg.acoustic_data) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
self.combobox_acoustic_data.clear()
|
self.combobox_acoustic_data.clear()
|
||||||
for n, m in enumerate(stg.noise_method):
|
for n, m in enumerate(stg.noise_method):
|
||||||
if stg.noise_method[n] == 0:
|
if stg.noise_method[n] == 0:
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ python-dateutil==2.8.2
|
||||||
scikit-learn==1.2.1
|
scikit-learn==1.2.1
|
||||||
scipy==1.10.0
|
scipy==1.10.0
|
||||||
odfpy==1.4.1
|
odfpy==1.4.1
|
||||||
|
xlsxwriter==3.2.0
|
||||||
openpyxl==3.0.10
|
openpyxl==3.0.10
|
||||||
pyinstaller==6.12.0
|
pyinstaller==6.12.0
|
||||||
pyqt_file_list_widget==0.0.1
|
pyqt_file_list_widget==0.0.1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue