Sample position can be plotted without transect
parent
5b63855bd8
commit
3a83ecd768
|
|
@ -147,7 +147,7 @@ class SampleDataTab(QWidget):
|
|||
self.allChkBox = QCheckBox()
|
||||
self.horizontalLayout_checkAll_spacer_exportTable.addWidget(self.allChkBox)
|
||||
|
||||
self.horizontalSpacerItem_pushButton_export_table = QSpacerItem(240, 10, QSizePolicy.Expanding,
|
||||
self.horizontalSpacerItem_pushButton_export_table = QSpacerItem(340, 10, QSizePolicy.Expanding,
|
||||
QSizePolicy.Minimum)
|
||||
self.horizontalLayout_checkAll_spacer_exportTable.addItem(self.horizontalSpacerItem_pushButton_export_table)
|
||||
|
||||
|
|
@ -200,7 +200,7 @@ class SampleDataTab(QWidget):
|
|||
self.combobox_frequencies = QComboBox()
|
||||
self.horizontalLayout_pushbutton_combobox_transect.addWidget(self.combobox_frequencies)
|
||||
|
||||
self.combobox_frequencies.currentTextChanged.connect(self.update_plot_sample_position_on_transect)
|
||||
# self.combobox_frequencies.currentTextChanged.connect(self.update_plot_sample_position_on_transect)
|
||||
|
||||
self.horizontalLayout_Ctot_PSD_plot = QHBoxLayout()
|
||||
self.verticalLayout_groupbox_display_option.addLayout(self.horizontalLayout_Ctot_PSD_plot)
|
||||
|
|
@ -468,7 +468,7 @@ class SampleDataTab(QWidget):
|
|||
self.tableWidget_sample.setItem(i, stg.frac_vol_fine.shape[1] + 8 + j, QTableWidgetItem(str(stg.frac_vol_sand[i, j])))
|
||||
|
||||
# --- Connect checkbox to all checkboxes of tableWidget ---
|
||||
# self.allChkBox.stateChanged.connect(self.check_allChkBox)
|
||||
self.allChkBox.stateChanged.connect(self.check_allChkBox)
|
||||
|
||||
# --- Connect checkbox items of tableWidget to update plots ---
|
||||
self.tableWidget_sample.itemChanged.connect(
|
||||
|
|
@ -500,6 +500,10 @@ class SampleDataTab(QWidget):
|
|||
|
||||
return position, color_list
|
||||
|
||||
def check_allChkBox(self, state):
|
||||
for i in range(self.tableWidget_sample.rowCount()):
|
||||
self.tableWidget_sample.item(i, 1).setCheckState(state)
|
||||
|
||||
# --- Function to export data of table ---
|
||||
def export_table(self):
|
||||
if self.tableWidget_sample.columnCount() > 10:
|
||||
|
|
@ -603,30 +607,58 @@ class SampleDataTab(QWidget):
|
|||
|
||||
def plot_sample_position_on_transect(self):
|
||||
|
||||
self.combobox_frequencies.addItems(stg.freq_text)
|
||||
if stg.BS_data.size == 0:
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setWindowTitle("Plot transect Error")
|
||||
msgBox.setIcon(QMessageBox.Warning)
|
||||
msgBox.setText("Load data from acoustic data tab before plotting transect with sample position")
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
|
||||
self.canvas_plot_sample_position_on_transect = FigureCanvas()
|
||||
self.figure_plot_sample_position_on_transect, self.axis_plot_sample_position_on_transect = \
|
||||
plt.subplots(nrows=1, ncols=1, layout="constrained")
|
||||
self.canvas_plot_sample_position_on_transect = FigureCanvas(self.figure_plot_sample_position_on_transect)
|
||||
self.verticalLayout_groupbox_plot_sample_position.addWidget(self.canvas_plot_sample_position_on_transect)
|
||||
else:
|
||||
|
||||
val_min = np.min(stg.BS_data[:, stg.freq_bottom_detection, :])
|
||||
val_max = np.max(stg.BS_data[:, stg.freq_bottom_detection, :])
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
self.combobox_frequencies.addItems(stg.freq_text)
|
||||
self.combobox_frequencies.currentTextChanged.connect(self.update_plot_sample_position_on_transect)
|
||||
|
||||
self.axis_plot_sample_position_on_transect.pcolormesh(
|
||||
stg.t, -stg.r, stg.BS_data[:, stg.freq_bottom_detection, :],
|
||||
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
||||
self.verticalLayout_groupbox_plot_sample_position.removeWidget(self.canvas_plot_sample_position_on_transect)
|
||||
self.figure_plot_sample_position_on_transect, self.axis_plot_sample_position_on_transect = \
|
||||
plt.subplots(nrows=1, ncols=1, layout="constrained")
|
||||
self.canvas_plot_sample_position_on_transect = FigureCanvas(self.figure_plot_sample_position_on_transect)
|
||||
self.verticalLayout_groupbox_plot_sample_position.addWidget(self.canvas_plot_sample_position_on_transect)
|
||||
|
||||
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")
|
||||
if stg.BS_data_section.size == 0:
|
||||
|
||||
self.axis_plot_sample_position_on_transect.set_xticks([])
|
||||
self.axis_plot_sample_position_on_transect.set_yticks([])
|
||||
self.figure_plot_sample_position_on_transect.canvas.draw_idle()
|
||||
val_min = np.min(stg.BS_data[:, stg.freq_bottom_detection, :])
|
||||
val_max = np.max(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, :],
|
||||
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")
|
||||
|
||||
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, :])
|
||||
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, :],
|
||||
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")
|
||||
|
||||
self.axis_plot_sample_position_on_transect.set_xticks([])
|
||||
self.axis_plot_sample_position_on_transect.set_yticks([])
|
||||
self.figure_plot_sample_position_on_transect.canvas.draw_idle()
|
||||
|
||||
def update_plot_sample_position_on_transect(self):
|
||||
|
||||
|
|
@ -634,10 +666,26 @@ class SampleDataTab(QWidget):
|
|||
position_list, color_list = self.extract_position_list_and_color_list_from_table_checkboxes()
|
||||
|
||||
# --- Create canvas of Matplotlib figure ---
|
||||
if self.canvas_plot_sample_position_on_transect != None:
|
||||
if stg.BS_raw_data.size == 0:
|
||||
|
||||
val_min = np.min(stg.BS_data[:, stg.freq_bottom_detection, :])
|
||||
val_max = np.max(stg.BS_data[:, stg.freq_bottom_detection, :])
|
||||
self.verticalLayout_groupbox_plot_sample_position.removeWidget(self.canvas_plot_sample_position_on_transect)
|
||||
self.figure_plot_sample_position_on_transect, self.axis_plot_sample_position_on_transect = \
|
||||
plt.subplots(nrows=1, ncols=1, layout="constrained")
|
||||
self.canvas_plot_sample_position_on_transect = FigureCanvas(self.figure_plot_sample_position_on_transect)
|
||||
self.verticalLayout_groupbox_plot_sample_position.addWidget(self.canvas_plot_sample_position_on_transect)
|
||||
|
||||
self.axis_plot_sample_position_on_transect.scatter(stg.sample_time[position_list],
|
||||
stg.sample_depth[position_list],
|
||||
linestyle='None', marker="o", s=14, c=color_list)
|
||||
|
||||
self.axis_plot_sample_position_on_transect.set_xticks([])
|
||||
self.axis_plot_sample_position_on_transect.set_yticks([])
|
||||
self.figure_plot_sample_position_on_transect.canvas.draw_idle()
|
||||
|
||||
else: #self.canvas_plot_sample_position_on_transect != None:
|
||||
|
||||
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
|
||||
|
||||
|
|
@ -652,39 +700,12 @@ class SampleDataTab(QWidget):
|
|||
self.axis_plot_sample_position_on_transect.scatter(stg.sample_time[position_list],
|
||||
stg.sample_depth[position_list],
|
||||
linestyle='None', marker="o", s=14, c=color_list)
|
||||
# self.axis_transect_sample_position.scatter(granulo_data._y[position_list], granulo_data._z
|
||||
# self.model._fine_sediment_file.iloc[position_list]["y"],
|
||||
# np.max(self.model.r_bottom_cross_section) -
|
||||
# self.model._fine_sediment_file.iloc[position_list]["z"]
|
||||
# + np.min(self.model.r_bottom_cross_section),
|
||||
# linestyle='None', marker="o", s=14, c=color_list)
|
||||
|
||||
|
||||
self.axis_plot_sample_position_on_transect.set_xticks([])
|
||||
self.axis_plot_sample_position_on_transect.set_yticks([])
|
||||
self.figure_plot_sample_position_on_transect.canvas.draw_idle()
|
||||
|
||||
# self.plot_transect_bottom_with_sample_position()
|
||||
# self.axis_sampleposition.pcolormesh(self.model.dist_BS_section,
|
||||
# np.flipud(self.model.BS_raw_cross_section.r),
|
||||
# self.model.BS_averaged_cross_section_corr.V[:, 0, :],
|
||||
# cmap='viridis',
|
||||
# norm=LogNorm(vmin=val_min, vmax=val_max), shading='gouraud')
|
||||
# self.axis_sampleposition.plot(self.model.dist_BS_section,
|
||||
# np.max(self.model.r_bottom_cross_section) - self.model.r_bottom_cross_section
|
||||
# + np.min(self.model.r_bottom_cross_section),
|
||||
# color='k', linewidth=2)
|
||||
# marker_color = ["orange", "green"]
|
||||
# for i in range(len(marker_color)):
|
||||
# self.axis_sampleposition.scatter(self.model._fine_sediment_file.iloc[position_list]["y"],
|
||||
# np.max(self.model.r_bottom_cross_section) - self.model._fine_sediment_file.iloc[position_list]["z"]
|
||||
# + np.min(self.model.r_bottom_cross_section),
|
||||
# linestyle='None', marker="o", s=14, c=color_list)
|
||||
# markerfacecolor=["orange", "green"], markeredgecolor=["orange", "green"])
|
||||
# self.axis_sampleposition.set_axis_off()
|
||||
# self.axis_sampleposition.set_xticks([])
|
||||
# self.axis_sampleposition.set_yticks([])
|
||||
# self.figure_sampleposition.canvas.draw_idle()
|
||||
# self.figure_sampleposition.tight_layout()
|
||||
|
||||
# ------------------------------------------------------------------------------------------------------------------
|
||||
# --- Functions to plot total concentration ---
|
||||
|
|
@ -723,25 +744,6 @@ class SampleDataTab(QWidget):
|
|||
self.axis_total_concentration.cla()
|
||||
|
||||
# --- Update total concentration plot according to choices of x-axis and y-axis combo-boxes ---
|
||||
# if self.combobox_y_axis.currentIndex() == 0:
|
||||
# self.axis_total_concentration.scatter(granulo_data._Ctot_fine[position_list],
|
||||
# granulo_data._z[position_list],
|
||||
# s=100, facecolor=color_list, edgecolor="None", alpha=0.5)
|
||||
# self.axis_total_concentration.scatter(granulo_data._Ctot_sand[position_list],
|
||||
# granulo_data._z[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_y_axis.currentIndex() == 1:
|
||||
# self.axis_total_concentration.scatter(granulo_data._Ctot_fine[position_list],
|
||||
# granulo_data._z[position_list] / np.max(granulo_data._z[position_list]),
|
||||
# s=100, facecolor=color_list, edgecolor="None", alpha=0.5)
|
||||
# self.axis_total_concentration.scatter(granulo_data._Ctot_sand[position_list],
|
||||
# granulo_data._z[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())
|
||||
# self.canvas_total_concentration.draw()
|
||||
|
||||
if (self.combobox_x_axis.currentIndex() == 0) and (self.combobox_y_axis.currentIndex() == 0):
|
||||
self.axis_total_concentration.scatter(stg.Ctot_fine[position_list],
|
||||
|
|
@ -753,20 +755,36 @@ class SampleDataTab(QWidget):
|
|||
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):
|
||||
indices = []
|
||||
for i in position_list:
|
||||
print(i)
|
||||
print(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
print("indices : ", indices)
|
||||
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.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_xlabel(self.combobox_x_axis.currentText())
|
||||
self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText())
|
||||
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.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_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.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_fine_per_cent[position_list],
|
||||
stg.sample_depth[position_list],
|
||||
|
|
@ -774,23 +792,42 @@ class SampleDataTab(QWidget):
|
|||
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):
|
||||
indices = []
|
||||
for i in position_list:
|
||||
print(i)
|
||||
print(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
print("indices : ", indices)
|
||||
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.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_xlabel(self.combobox_x_axis.currentText())
|
||||
self.axis_total_concentration.set_ylabel(self.combobox_y_axis.currentText())
|
||||
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.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_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.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()
|
||||
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue