Sample data tab is upgraded to be able to load and plot fine sediment only or sand sediment data only
parent
1bda848671
commit
7d359983f0
|
|
@ -420,13 +420,150 @@ class SampleDataTab(QWidget):
|
|||
stg.frac_vol_sand_cumul = sand_granulo_data._frac_vol_cumul
|
||||
|
||||
def compute_Ctot_per_cent(self):
|
||||
stg.Ctot_fine_per_cent = 100 * stg.Ctot_fine / (stg.Ctot_fine + stg.Ctot_sand)
|
||||
stg.Ctot_sand_per_cent = 100 * stg.Ctot_sand / (stg.Ctot_fine + stg.Ctot_sand)
|
||||
if (self.lineEdit_fine_sediment.text()) and not (self.lineEdit_sand.text()):
|
||||
stg.Ctot_fine_per_cent = 100 * stg.Ctot_fine / (stg.Ctot_fine)
|
||||
elif not (self.lineEdit_fine_sediment.text()) and (self.lineEdit_sand.text()):
|
||||
stg.Ctot_sand_per_cent = 100 * stg.Ctot_sand / (stg.Ctot_sand)
|
||||
elif (self.lineEdit_fine_sediment.text()) and (self.lineEdit_sand.text()):
|
||||
stg.Ctot_fine_per_cent = 100 * stg.Ctot_fine / (stg.Ctot_fine + stg.Ctot_sand)
|
||||
stg.Ctot_sand_per_cent = 100 * stg.Ctot_sand / (stg.Ctot_fine + stg.Ctot_sand)
|
||||
|
||||
# ------------------------------------------------------------------------------------------------------------------
|
||||
# --- Function to fill table of values ---
|
||||
def fill_table(self):
|
||||
if (self.lineEdit_fine_sediment.text()) and (self.lineEdit_sand.text()):
|
||||
if (self.lineEdit_fine_sediment.text()) and not (self.lineEdit_sand.text()):
|
||||
|
||||
self.row = self.tableWidget_sample.setRowCount(stg.sample_depth.shape[0])
|
||||
self.col = self.tableWidget_sample.setColumnCount(6 + stg.radius_grain.shape[0])
|
||||
|
||||
# --- Set horizontal header ---
|
||||
# horizontal_header = list(map(str, ["Color", "Sample"] + stg.fine_sediment_columns +
|
||||
# stg.sand_sediment_columns[2:]))
|
||||
horizontal_header = list(itertools.chain(["Color", "Sample"],
|
||||
list(map(str, stg.fine_sediment_columns[:2])),
|
||||
list(map(str, stg.fine_sediment_columns[3:]))))
|
||||
|
||||
for horizontal_header_text in horizontal_header:
|
||||
# print(horizontal_header_text)
|
||||
self.horizontal_header_item = QTableWidgetItem()
|
||||
# print(np.where(horizontal_header == horizontal_header_text)[0][0])
|
||||
self.tableWidget_sample.setHorizontalHeaderItem(horizontal_header.index(horizontal_header_text),
|
||||
self.horizontal_header_item)
|
||||
self.horizontal_header_item.setText(horizontal_header_text)
|
||||
|
||||
# --- Set vertical header (color) ---
|
||||
self.tableWidget_sample.verticalHeader().setVisible(False)
|
||||
color_list = CSS4_COLORS
|
||||
for i in range(self.tableWidget_sample.rowCount()):
|
||||
exec("self.comboBox_sample_table" + str(i) + "= QComboBox()")
|
||||
exec("self.comboBox_sample_table" + str(i) + ".addItems(color_list)")
|
||||
eval(f"self.tableWidget_sample.setCellWidget(i, 0, self.comboBox_sample_table{i})")
|
||||
eval(f"self.comboBox_sample_table{i}.currentTextChanged."
|
||||
f"connect(self.extract_position_list_and_color_list_from_table_checkboxes)")
|
||||
eval(f"self.comboBox_sample_table{i}.currentTextChanged."
|
||||
f"connect(self.update_plot_total_concentration)")
|
||||
eval(f"self.comboBox_sample_table{i}.currentTextChanged."
|
||||
f"connect(self.update_plot_PSD_fine_and_sand_sediments)")
|
||||
eval(f"self.comboBox_sample_table{i}.currentTextChanged."
|
||||
f"connect(self.update_plot_sample_position_on_transect)")
|
||||
|
||||
# --- Fill Sample column with checkbox ---
|
||||
for i in range(self.tableWidget_sample.rowCount()):
|
||||
self.item_checkbox = QTableWidgetItem()
|
||||
self.item_checkbox.setCheckState(Qt.Unchecked)
|
||||
self.tableWidget_sample.setItem(i, 1, self.item_checkbox)
|
||||
self.item_checkbox.setText("S" + str(i + 1))
|
||||
stg.samples.append("S" + str(i + 1))
|
||||
# print(f"S{i+1} ", self.tableWidget_sample.item(i, 1).checkState())
|
||||
|
||||
# --- Fill table with data ---
|
||||
for i in range(stg.frac_vol_fine.shape[0]):
|
||||
for j in range(stg.frac_vol_fine.shape[1]):
|
||||
# self.tableWidget_sample.setItem(i, j + 2, QTableWidgetItem(str(granulo_data._data_fine.iloc[i, j])))
|
||||
self.tableWidget_sample.setItem(i, 2, QTableWidgetItem(str(stg.sample_time[i])))
|
||||
self.tableWidget_sample.setItem(i, 3, QTableWidgetItem(str(stg.sample_depth[i])))
|
||||
|
||||
self.tableWidget_sample.setItem(i, 4, QTableWidgetItem(str(stg.Ctot_fine[i])))
|
||||
self.tableWidget_sample.setItem(i, 5, QTableWidgetItem(str(stg.D50_fine[i])))
|
||||
self.tableWidget_sample.setItem(i, j + 6, QTableWidgetItem(str(stg.frac_vol_fine[i, j])))
|
||||
|
||||
# --- Connect checkbox to all checkboxes of tableWidget ---
|
||||
self.allChkBox.stateChanged.connect(self.check_allChkBox)
|
||||
|
||||
# --- Connect checkbox items of tableWidget to update plots ---
|
||||
self.tableWidget_sample.itemChanged.connect(
|
||||
self.extract_position_list_and_color_list_from_table_checkboxes)
|
||||
self.tableWidget_sample.itemChanged.connect(self.update_plot_total_concentration)
|
||||
self.tableWidget_sample.itemChanged.connect(self.update_plot_PSD_fine_and_sand_sediments)
|
||||
self.tableWidget_sample.itemChanged.connect(self.update_plot_sample_position_on_transect)
|
||||
|
||||
elif not (self.lineEdit_fine_sediment.text()) and (self.lineEdit_sand.text()):
|
||||
|
||||
self.row = self.tableWidget_sample.setRowCount(stg.sample_depth.shape[0])
|
||||
self.col = self.tableWidget_sample.setColumnCount(6 + stg.radius_grain.shape[0])
|
||||
|
||||
# --- Set horizontal header ---
|
||||
# horizontal_header = list(map(str, ["Color", "Sample"] + stg.fine_sediment_columns +
|
||||
# stg.sand_sediment_columns[2:]))
|
||||
horizontal_header = list(itertools.chain(["Color", "Sample"],
|
||||
list(map(str, stg.sand_sediment_columns[:2])),
|
||||
|
||||
list(map(str, stg.sand_sediment_columns[3:]))))
|
||||
|
||||
for horizontal_header_text in horizontal_header:
|
||||
# print(horizontal_header_text)
|
||||
self.horizontal_header_item = QTableWidgetItem()
|
||||
# print(np.where(horizontal_header == horizontal_header_text)[0][0])
|
||||
self.tableWidget_sample.setHorizontalHeaderItem(horizontal_header.index(horizontal_header_text),
|
||||
self.horizontal_header_item)
|
||||
self.horizontal_header_item.setText(horizontal_header_text)
|
||||
|
||||
# --- Set vertical header (color) ---
|
||||
self.tableWidget_sample.verticalHeader().setVisible(False)
|
||||
color_list = CSS4_COLORS
|
||||
for i in range(self.tableWidget_sample.rowCount()):
|
||||
exec("self.comboBox_sample_table" + str(i) + "= QComboBox()")
|
||||
exec("self.comboBox_sample_table" + str(i) + ".addItems(color_list)")
|
||||
eval(f"self.tableWidget_sample.setCellWidget(i, 0, self.comboBox_sample_table{i})")
|
||||
eval(f"self.comboBox_sample_table{i}.currentTextChanged."
|
||||
f"connect(self.extract_position_list_and_color_list_from_table_checkboxes)")
|
||||
eval(f"self.comboBox_sample_table{i}.currentTextChanged."
|
||||
f"connect(self.update_plot_total_concentration)")
|
||||
eval(f"self.comboBox_sample_table{i}.currentTextChanged."
|
||||
f"connect(self.update_plot_PSD_fine_and_sand_sediments)")
|
||||
eval(f"self.comboBox_sample_table{i}.currentTextChanged."
|
||||
f"connect(self.update_plot_sample_position_on_transect)")
|
||||
|
||||
# --- Fill Sample column with checkbox ---
|
||||
for i in range(self.tableWidget_sample.rowCount()):
|
||||
self.item_checkbox = QTableWidgetItem()
|
||||
self.item_checkbox.setCheckState(Qt.Unchecked)
|
||||
self.tableWidget_sample.setItem(i, 1, self.item_checkbox)
|
||||
self.item_checkbox.setText("S" + str(i + 1))
|
||||
stg.samples.append("S" + str(i + 1))
|
||||
# print(f"S{i+1} ", self.tableWidget_sample.item(i, 1).checkState())
|
||||
|
||||
# --- Fill table with data ---
|
||||
for i in range(stg.frac_vol_sand.shape[0]):
|
||||
for j in range(stg.frac_vol_sand.shape[1]):
|
||||
# self.tableWidget_sample.setItem(i, j + 2, QTableWidgetItem(str(granulo_data._data_fine.iloc[i, j])))
|
||||
self.tableWidget_sample.setItem(i, 2, QTableWidgetItem(str(stg.sample_time[i])))
|
||||
self.tableWidget_sample.setItem(i, 3, QTableWidgetItem(str(stg.sample_depth[i])))
|
||||
|
||||
self.tableWidget_sample.setItem(i, 4, QTableWidgetItem(str(stg.Ctot_sand[i])))
|
||||
self.tableWidget_sample.setItem(i, 5, QTableWidgetItem(str(stg.D50_sand[i])))
|
||||
self.tableWidget_sample.setItem(i, j + 6, QTableWidgetItem(str(stg.frac_vol_sand[i, j])))
|
||||
|
||||
# --- Connect checkbox to all checkboxes of tableWidget ---
|
||||
self.allChkBox.stateChanged.connect(self.check_allChkBox)
|
||||
|
||||
# --- Connect checkbox items of tableWidget to update plots ---
|
||||
self.tableWidget_sample.itemChanged.connect(self.extract_position_list_and_color_list_from_table_checkboxes)
|
||||
self.tableWidget_sample.itemChanged.connect(self.update_plot_total_concentration)
|
||||
self.tableWidget_sample.itemChanged.connect(self.update_plot_PSD_fine_and_sand_sediments)
|
||||
self.tableWidget_sample.itemChanged.connect(self.update_plot_sample_position_on_transect)
|
||||
|
||||
elif (self.lineEdit_fine_sediment.text()) and (self.lineEdit_sand.text()):
|
||||
|
||||
self.row = self.tableWidget_sample.setRowCount(stg.sample_depth.shape[0])
|
||||
self.col = self.tableWidget_sample.setColumnCount(8+2*stg.radius_grain.shape[0])
|
||||
|
|
@ -657,33 +794,39 @@ class SampleDataTab(QWidget):
|
|||
|
||||
if stg.BS_data_section.size == 0:
|
||||
|
||||
val_min = np.min(stg.BS_data[:, stg.freq_bottom_detection, :])
|
||||
val_max = np.max(stg.BS_data[:, stg.freq_bottom_detection, :])
|
||||
val_min = np.nanmin(stg.BS_data[stg.freq_bottom_detection, :, :])
|
||||
val_max = np.nanmax(stg.BS_data[stg.freq_bottom_detection, :, :])
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
|
||||
self.axis_plot_sample_position_on_transect.pcolormesh(
|
||||
stg.t, -stg.r, stg.BS_data[:, stg.freq_bottom_detection, :],
|
||||
stg.t[stg.freq_bottom_detection, :],
|
||||
-stg.r[stg.freq_bottom_detection, :],
|
||||
stg.BS_data[stg.freq_bottom_detection, :, :],
|
||||
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
||||
|
||||
if stg.r_bottom.size != 0:
|
||||
self.axis_plot_sample_position_on_transect.plot(
|
||||
stg.t, -stg.r_bottom, color='black', linewidth=1, linestyle="solid")
|
||||
stg.t[stg.freq_bottom_detection, :],
|
||||
-stg.r_bottom, color='black', linewidth=1, linestyle="solid")
|
||||
|
||||
else:
|
||||
|
||||
val_min = np.nanmin(stg.BS_data_section[:, stg.freq_bottom_detection, :])
|
||||
val_max = np.nanmax(stg.BS_data_section[:, stg.freq_bottom_detection, :])
|
||||
val_min = np.nanmin(stg.BS_data_section[stg.freq_bottom_detection, :, :])
|
||||
val_max = np.nanmax(stg.BS_data_section[stg.freq_bottom_detection, :, :])
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
|
||||
self.axis_plot_sample_position_on_transect.pcolormesh(
|
||||
stg.t, -stg.r, stg.BS_data_section[:, stg.freq_bottom_detection, :],
|
||||
stg.t[stg.freq_bottom_detection, :],
|
||||
-stg.r[stg.freq_bottom_detection, :],
|
||||
stg.BS_data_section[stg.freq_bottom_detection, :, :],
|
||||
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
||||
|
||||
if stg.r_bottom.size != 0:
|
||||
self.axis_plot_sample_position_on_transect.plot(
|
||||
stg.t, -stg.r_bottom, color='black', linewidth=1, linestyle="solid")
|
||||
stg.t[stg.freq_bottom_detection, :], -stg.r_bottom,
|
||||
color='black', linewidth=1, linestyle="solid")
|
||||
|
||||
self.axis_plot_sample_position_on_transect.set_xticks([])
|
||||
self.axis_plot_sample_position_on_transect.set_yticks([])
|
||||
|
|
@ -713,18 +856,20 @@ class SampleDataTab(QWidget):
|
|||
|
||||
elif stg.BS_data_section.size == 0:
|
||||
|
||||
val_min = np.nanmin(stg.BS_data[:, stg.freq_bottom_detection, :])
|
||||
val_max = np.nanmax(stg.BS_data[:, stg.freq_bottom_detection, :])
|
||||
val_min = np.nanmin(stg.BS_data[stg.freq_bottom_detection, :, :])
|
||||
val_max = np.nanmax(stg.BS_data[stg.freq_bottom_detection, :, :])
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
|
||||
self.axis_plot_sample_position_on_transect.pcolormesh(
|
||||
stg.t, -stg.r, stg.BS_data[:, self.combobox_frequencies.currentIndex(), :],
|
||||
stg.t[stg.freq_bottom_detection, :], -stg.r[stg.freq_bottom_detection, :],
|
||||
stg.BS_data[self.combobox_frequencies.currentIndex(), :, :],
|
||||
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
||||
|
||||
if stg.r_bottom.size != 0:
|
||||
self.axis_plot_sample_position_on_transect.plot(
|
||||
stg.t, -stg.r_bottom, color='black', linewidth=1, linestyle="solid")
|
||||
stg.t[stg.freq_bottom_detection, :], -stg.r_bottom,
|
||||
color='black', linewidth=1, linestyle="solid")
|
||||
|
||||
self.axis_plot_sample_position_on_transect.scatter(stg.sample_time[position_list],
|
||||
stg.sample_depth[position_list],
|
||||
|
|
@ -737,18 +882,19 @@ class SampleDataTab(QWidget):
|
|||
|
||||
else:
|
||||
|
||||
val_min = np.nanmin(stg.BS_data_section[:, stg.freq_bottom_detection, :])
|
||||
val_max = np.nanmax(stg.BS_data_section[:, stg.freq_bottom_detection, :])
|
||||
val_min = np.nanmin(stg.BS_data_section[stg.freq_bottom_detection, :, :])
|
||||
val_max = np.nanmax(stg.BS_data_section[stg.freq_bottom_detection, :, :])
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
|
||||
self.axis_plot_sample_position_on_transect.pcolormesh(
|
||||
stg.t, -stg.r, stg.BS_data_section[:, self.combobox_frequencies.currentIndex(), :],
|
||||
stg.t[stg.freq_bottom_detection, :], -stg.r[stg.freq_bottom_detection, :],
|
||||
stg.BS_data_section[self.combobox_frequencies.currentIndex(), :, :],
|
||||
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
||||
|
||||
if stg.r_bottom.size != 0:
|
||||
self.axis_plot_sample_position_on_transect.plot(
|
||||
stg.t, -stg.r_bottom, color='black', linewidth=1, linestyle="solid")
|
||||
stg.t[stg.freq_bottom_detection, :], -stg.r_bottom, color='black', linewidth=1, linestyle="solid")
|
||||
|
||||
self.axis_plot_sample_position_on_transect.scatter(stg.sample_time[position_list],
|
||||
stg.sample_depth[position_list],
|
||||
|
|
@ -785,7 +931,171 @@ class SampleDataTab(QWidget):
|
|||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
|
||||
else:
|
||||
elif (self.lineEdit_fine_sediment.text()) and not (self.lineEdit_sand.text()):
|
||||
|
||||
# --- Create canvas of Matplotlib figure ---
|
||||
if self.canvas_total_concentration == None:
|
||||
self.figure_total_concentration, self.axis_total_concentration \
|
||||
= plt.subplots(nrows=1, ncols=1, layout="constrained")
|
||||
self.canvas_total_concentration = FigureCanvas(self.figure_total_concentration)
|
||||
self.verticalLayout_plot_total_concentration.addWidget(self.canvas_total_concentration)
|
||||
else:
|
||||
self.axis_total_concentration.cla()
|
||||
|
||||
# --- Update total concentration plot according to choices of x-axis and y-axis combo-boxes ---
|
||||
|
||||
if (self.combobox_x_axis.currentIndex() == 0) and (self.combobox_y_axis.currentIndex() == 0):
|
||||
self.axis_total_concentration.scatter(stg.Ctot_fine[position_list],
|
||||
stg.sample_depth[position_list],
|
||||
s=100, facecolor=color_list, edgecolor="None", alpha=0.5)
|
||||
self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())
|
||||
self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText())
|
||||
elif (self.combobox_x_axis.currentIndex() == 0) and (self.combobox_y_axis.currentIndex() == 1):
|
||||
if stg.r_bottom.size == 0:
|
||||
self.combobox_y_axis.setCurrentIndex(0)
|
||||
self.axis_total_concentration.scatter(stg.Ctot_fine[position_list],
|
||||
stg.sample_depth[position_list],
|
||||
s=100, facecolor=color_list, edgecolor="None", alpha=0.5)
|
||||
self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())
|
||||
self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText())
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setWindowTitle("Axis choice Error")
|
||||
msgBox.setIcon(QMessageBox.Warning)
|
||||
msgBox.setText("To use z/h axis, please compute before the bottom detection algorithm "
|
||||
"\n in acoustic data tab")
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
else:
|
||||
indices = []
|
||||
for i in position_list:
|
||||
indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
self.axis_total_concentration.scatter(stg.Ctot_fine[position_list],
|
||||
-stg.sample_depth[position_list] / stg.r_bottom[indices],
|
||||
# np.max(stg.sample_depth[position_list]),
|
||||
s=100, facecolor=color_list, edgecolor="None", alpha=0.5)
|
||||
self.axis_total_concentration.set_ylim(0, 1)
|
||||
self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())
|
||||
self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText())
|
||||
elif (self.combobox_x_axis.currentIndex() == 1) and (self.combobox_y_axis.currentIndex() == 0):
|
||||
self.axis_total_concentration.scatter(stg.Ctot_fine_per_cent[position_list],
|
||||
stg.sample_depth[position_list],
|
||||
s=100, facecolor=color_list, edgecolor="None", alpha=0.5)
|
||||
self.axis_total_concentration.set_xlim(0, 100)
|
||||
self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())
|
||||
self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText())
|
||||
elif (self.combobox_x_axis.currentIndex() == 1) and (self.combobox_y_axis.currentIndex() == 1):
|
||||
if stg.r_bottom.size == 0:
|
||||
self.combobox_y_axis.setCurrentIndex(0)
|
||||
self.axis_total_concentration.scatter(stg.Ctot_fine_per_cent[position_list],
|
||||
stg.sample_depth[position_list],
|
||||
s=100, facecolor=color_list, edgecolor="None", alpha=0.5)
|
||||
self.axis_total_concentration.set_xlim(0, 100)
|
||||
self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())
|
||||
self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText())
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setWindowTitle("Axis choice Error")
|
||||
msgBox.setIcon(QMessageBox.Warning)
|
||||
msgBox.setText("To use z/h axis, please compute before the bottom detection algorithm "
|
||||
"\n in acoustic data tab")
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
else:
|
||||
indices = []
|
||||
for i in position_list:
|
||||
indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
self.axis_total_concentration.scatter(stg.Ctot_fine_per_cent[position_list],
|
||||
-stg.sample_depth[position_list] / stg.r_bottom[indices],
|
||||
# np.max(stg.sample_depth[position_list]),
|
||||
s=100, facecolor=color_list, edgecolor="None", alpha=0.5)
|
||||
self.axis_total_concentration.set_xlim(0, 100)
|
||||
self.axis_total_concentration.set_ylim(0, 1)
|
||||
self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())
|
||||
self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText())
|
||||
self.canvas_total_concentration.draw()
|
||||
|
||||
elif not (self.lineEdit_fine_sediment.text()) and (self.lineEdit_sand.text()):
|
||||
|
||||
# --- Create canvas of Matplotlib figure ---
|
||||
if self.canvas_total_concentration == None:
|
||||
self.figure_total_concentration, self.axis_total_concentration \
|
||||
= plt.subplots(nrows=1, ncols=1, layout="constrained")
|
||||
self.canvas_total_concentration = FigureCanvas(self.figure_total_concentration)
|
||||
self.verticalLayout_plot_total_concentration.addWidget(self.canvas_total_concentration)
|
||||
else:
|
||||
self.axis_total_concentration.cla()
|
||||
|
||||
# --- Update total concentration plot according to choices of x-axis and y-axis combo-boxes ---
|
||||
|
||||
if (self.combobox_x_axis.currentIndex() == 0) and (self.combobox_y_axis.currentIndex() == 0):
|
||||
self.axis_total_concentration.scatter(stg.Ctot_sand[position_list],
|
||||
stg.sample_depth[position_list],
|
||||
s=300, facecolors="None", edgecolors=color_list)
|
||||
self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())
|
||||
self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText())
|
||||
elif (self.combobox_x_axis.currentIndex() == 0) and (self.combobox_y_axis.currentIndex() == 1):
|
||||
if stg.r_bottom.size == 0:
|
||||
self.combobox_y_axis.setCurrentIndex(0)
|
||||
self.axis_total_concentration.scatter(stg.Ctot_sand[position_list],
|
||||
stg.sample_depth[position_list],
|
||||
s=300, facecolors="None", edgecolors=color_list)
|
||||
self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())
|
||||
self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText())
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setWindowTitle("Axis choice Error")
|
||||
msgBox.setIcon(QMessageBox.Warning)
|
||||
msgBox.setText("To use z/h axis, please compute before the bottom detection algorithm "
|
||||
"\n in acoustic data tab")
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
else:
|
||||
indices = []
|
||||
for i in position_list:
|
||||
indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
self.axis_total_concentration.scatter(stg.Ctot_sand[position_list],
|
||||
-stg.sample_depth[position_list] / stg.r_bottom[indices],
|
||||
# np.max(stg.sample_depth[position_list]),
|
||||
s=300, facecolors="None", edgecolors=color_list)
|
||||
self.axis_total_concentration.set_ylim(0, 1)
|
||||
self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())
|
||||
self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText())
|
||||
elif (self.combobox_x_axis.currentIndex() == 1) and (self.combobox_y_axis.currentIndex() == 0):
|
||||
self.axis_total_concentration.scatter(stg.Ctot_sand_per_cent[position_list],
|
||||
stg.sample_depth[position_list],
|
||||
s=300, facecolors="None", edgecolors=color_list)
|
||||
self.axis_total_concentration.set_xlim(0, 100)
|
||||
self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())
|
||||
self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText())
|
||||
elif (self.combobox_x_axis.currentIndex() == 1) and (self.combobox_y_axis.currentIndex() == 1):
|
||||
if stg.r_bottom.size == 0:
|
||||
self.combobox_y_axis.setCurrentIndex(0)
|
||||
self.axis_total_concentration.scatter(stg.Ctot_sand_per_cent[position_list],
|
||||
stg.sample_depth[position_list],
|
||||
s=300, facecolors="None", edgecolors=color_list)
|
||||
self.axis_total_concentration.set_xlim(0, 100)
|
||||
self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())
|
||||
self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText())
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setWindowTitle("Axis choice Error")
|
||||
msgBox.setIcon(QMessageBox.Warning)
|
||||
msgBox.setText("To use z/h axis, please compute before the bottom detection algorithm "
|
||||
"\n in acoustic data tab")
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
else:
|
||||
indices = []
|
||||
for i in position_list:
|
||||
indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
self.axis_total_concentration.scatter(stg.Ctot_sand_per_cent[position_list],
|
||||
-stg.sample_depth[position_list] / stg.r_bottom[indices],
|
||||
# np.max(stg.sample_depth[position_list]),
|
||||
s=300, facecolors="None", edgecolors=color_list)
|
||||
self.axis_total_concentration.set_xlim(0, 100)
|
||||
self.axis_total_concentration.set_ylim(0, 1)
|
||||
self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())
|
||||
self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText())
|
||||
self.canvas_total_concentration.draw()
|
||||
|
||||
elif (self.lineEdit_fine_sediment.text()) and (self.lineEdit_sand.text()):
|
||||
|
||||
# --- Create canvas of Matplotlib figure ---
|
||||
if self.canvas_total_concentration == None:
|
||||
|
|
@ -1023,7 +1333,93 @@ class SampleDataTab(QWidget):
|
|||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
|
||||
else:
|
||||
elif (self.lineEdit_fine_sediment.text()) and not (self.lineEdit_sand.text()):
|
||||
|
||||
# --- Create canvas of Matplotlib figure ---
|
||||
if self.canvas_plot_PSD == None:
|
||||
self.figure_plot_PSD, self.axis_plot_PSD = plt.subplots(nrows=1, ncols=2, layout="constrained")
|
||||
self.canvas_plot_PSD = FigureCanvas(self.figure_plot_PSD)
|
||||
self.verticalLayout_plot_PSD.addWidget(self.canvas_plot_PSD)
|
||||
else:
|
||||
self.axis_plot_PSD[0].cla()
|
||||
self.axis_plot_PSD[1].cla()
|
||||
|
||||
if self.combobox_PSD_plot.currentIndex() == 0:
|
||||
|
||||
for profil_position_num, color_plot in zip(position_list, color_list):
|
||||
self.axis_plot_PSD[0].plot(stg.radius_grain,
|
||||
stg.frac_vol_fine[profil_position_num, :],
|
||||
color=color_plot)
|
||||
self.axis_plot_PSD[0].set_xscale('log')
|
||||
self.axis_plot_PSD[0].set_xlabel('Radius ($\mu m$)')
|
||||
self.axis_plot_PSD[0].set_ylabel('Class size volume fraction')
|
||||
|
||||
self.axis_plot_PSD[1].plot()
|
||||
self.axis_plot_PSD[1].set_xscale('log')
|
||||
self.axis_plot_PSD[1].set_xlabel('Radius ($\mu m$)')
|
||||
self.axis_plot_PSD[1].set_ylabel('Class size volume fraction')
|
||||
|
||||
elif self.combobox_PSD_plot.currentIndex() == 1:
|
||||
|
||||
for profil_position_num, color_plot in zip(position_list, color_list):
|
||||
self.axis_plot_PSD[0].plot(stg.radius_grain,
|
||||
stg.frac_vol_fine_cumul[profil_position_num, :],
|
||||
color=color_plot)
|
||||
self.axis_plot_PSD[0].set_xscale('log')
|
||||
self.axis_plot_PSD[0].set_xlabel('Radius ($\mu m$)')
|
||||
self.axis_plot_PSD[0].set_ylabel('Cumulative size volume fraction')
|
||||
|
||||
self.axis_plot_PSD[1].plot()
|
||||
self.axis_plot_PSD[1].set_xscale('log')
|
||||
self.axis_plot_PSD[1].set_xlabel('Radius ($\mu m$)')
|
||||
self.axis_plot_PSD[1].set_ylabel('Cumulative size volume fraction')
|
||||
|
||||
self.canvas_plot_PSD.draw()
|
||||
|
||||
elif not (self.lineEdit_fine_sediment.text()) and (self.lineEdit_sand.text()):
|
||||
|
||||
# --- Create canvas of Matplotlib figure ---
|
||||
if self.canvas_plot_PSD == None:
|
||||
self.figure_plot_PSD, self.axis_plot_PSD = plt.subplots(nrows=1, ncols=2, layout="constrained")
|
||||
self.canvas_plot_PSD = FigureCanvas(self.figure_plot_PSD)
|
||||
self.verticalLayout_plot_PSD.addWidget(self.canvas_plot_PSD)
|
||||
else:
|
||||
self.axis_plot_PSD[0].cla()
|
||||
self.axis_plot_PSD[1].cla()
|
||||
|
||||
if self.combobox_PSD_plot.currentIndex() == 0:
|
||||
|
||||
for profil_position_num, color_plot in zip(position_list, color_list):
|
||||
self.axis_plot_PSD[0].plot()
|
||||
self.axis_plot_PSD[0].set_xscale('log')
|
||||
self.axis_plot_PSD[0].set_xlabel('Radius ($\mu m$)')
|
||||
self.axis_plot_PSD[0].set_ylabel('Class size volume fraction')
|
||||
|
||||
self.axis_plot_PSD[1].plot(stg.radius_grain,
|
||||
stg.frac_vol_sand[profil_position_num, :],
|
||||
color=color_plot)
|
||||
self.axis_plot_PSD[1].set_xscale('log')
|
||||
self.axis_plot_PSD[1].set_xlabel('Radius ($\mu m$)')
|
||||
self.axis_plot_PSD[1].set_ylabel('Class size volume fraction')
|
||||
|
||||
elif self.combobox_PSD_plot.currentIndex() == 1:
|
||||
|
||||
for profil_position_num, color_plot in zip(position_list, color_list):
|
||||
self.axis_plot_PSD[0].plot()
|
||||
self.axis_plot_PSD[0].set_xscale('log')
|
||||
self.axis_plot_PSD[0].set_xlabel('Radius ($\mu m$)')
|
||||
self.axis_plot_PSD[0].set_ylabel('Cumulative size volume fraction')
|
||||
|
||||
self.axis_plot_PSD[1].plot(stg.radius_grain,
|
||||
stg.frac_vol_sand_cumul[profil_position_num, :],
|
||||
color=color_plot)
|
||||
self.axis_plot_PSD[1].set_xscale('log')
|
||||
self.axis_plot_PSD[1].set_xlabel('Radius ($\mu m$)')
|
||||
self.axis_plot_PSD[1].set_ylabel('Cumulative size volume fraction')
|
||||
|
||||
self.canvas_plot_PSD.draw()
|
||||
|
||||
elif (self.lineEdit_fine_sediment.text()) and (self.lineEdit_sand.text()):
|
||||
|
||||
# --- Create canvas of Matplotlib figure ---
|
||||
if self.canvas_plot_PSD == None:
|
||||
|
|
|
|||
Loading…
Reference in New Issue