Button Class PSD and Cumulative PSD work : plots are updated pushing button and/or selecting checkboxes in sample table
parent
84498bb502
commit
d19b7add9f
|
|
@ -224,6 +224,8 @@ class SampleDataTab(QWidget):
|
||||||
self.pushbutton_class_PSD.setText("Class PSD")
|
self.pushbutton_class_PSD.setText("Class PSD")
|
||||||
self.horizontalLayout_groupbox_option_PSD_plot.addWidget(self.pushbutton_class_PSD)
|
self.horizontalLayout_groupbox_option_PSD_plot.addWidget(self.pushbutton_class_PSD)
|
||||||
|
|
||||||
|
self.pushbutton_class_PSD.clicked.connect(self.update_plot_fine_and_sand_sediments_PSD_class)
|
||||||
|
|
||||||
# self.pushbutton_class_PSD.clicked_signal[str].connect(self.on_clicked)
|
# self.pushbutton_class_PSD.clicked_signal[str].connect(self.on_clicked)
|
||||||
|
|
||||||
# if self.tableWidget_sample.columnCount() == 10:
|
# if self.tableWidget_sample.columnCount() == 10:
|
||||||
|
|
@ -235,6 +237,8 @@ class SampleDataTab(QWidget):
|
||||||
self.pushbutton_cumulative_PSD.setText("Cumulative PSD")
|
self.pushbutton_cumulative_PSD.setText("Cumulative PSD")
|
||||||
self.horizontalLayout_groupbox_option_PSD_plot.addWidget(self.pushbutton_cumulative_PSD)
|
self.horizontalLayout_groupbox_option_PSD_plot.addWidget(self.pushbutton_cumulative_PSD)
|
||||||
|
|
||||||
|
self.pushbutton_cumulative_PSD.clicked.connect(self.update_plot_fine_and_sand_sediments_PSD_cumul)
|
||||||
|
|
||||||
# if self.tableWidget_sample.columnCount() == 10:
|
# if self.tableWidget_sample.columnCount() == 10:
|
||||||
# self.pushbutton_cumulative_PSD.clicked.connect(self.empty_field_to_plot_fine_sediment_distribution)
|
# self.pushbutton_cumulative_PSD.clicked.connect(self.empty_field_to_plot_fine_sediment_distribution)
|
||||||
# else:
|
# else:
|
||||||
|
|
@ -799,35 +803,32 @@ class SampleDataTab(QWidget):
|
||||||
# self.canvas_plot_PSD.draw()
|
# self.canvas_plot_PSD.draw()
|
||||||
|
|
||||||
def update_plot_fine_and_sand_sediments_PSD_class(self):
|
def update_plot_fine_and_sand_sediments_PSD_class(self):
|
||||||
position_list, color_list = self.extract_position_list_and_color_list_from_table_checkboxes()
|
if self.tableWidget_sample.columnCount() > 15:
|
||||||
|
|
||||||
|
# --- Read sample data ---
|
||||||
granulo_data = deepcopy(
|
granulo_data = deepcopy(
|
||||||
GranuloLoader(self.lineEdit_fine_sediment.toolTip() + "/" + self.lineEdit_fine_sediment.text(),
|
GranuloLoader(self.lineEdit_fine_sediment.toolTip() + "/" + self.lineEdit_fine_sediment.text(),
|
||||||
self.lineEdit_sand.toolTip() + "/" + self.lineEdit_sand.text()))
|
self.lineEdit_sand.toolTip() + "/" + self.lineEdit_sand.text()))
|
||||||
|
|
||||||
if self.canvas_plot_PSD == None:
|
# --- Read selected samples (checkboxes) ---
|
||||||
|
position_list, color_list = self.extract_position_list_and_color_list_from_table_checkboxes()
|
||||||
|
|
||||||
|
if position_list == []:
|
||||||
|
|
||||||
|
msgBox = QMessageBox()
|
||||||
|
msgBox.setWindowTitle("Axis choice Error")
|
||||||
|
msgBox.setIcon(QMessageBox.Warning)
|
||||||
|
msgBox.setText("Select sample(s) before changing axis")
|
||||||
|
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||||
|
msgBox.exec()
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
# --- 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.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.canvas_plot_PSD = FigureCanvas(self.figure_plot_PSD)
|
||||||
self.verticalLayout_plot_PSD.addWidget(self.canvas_plot_PSD)
|
self.verticalLayout_plot_PSD.addWidget(self.canvas_plot_PSD)
|
||||||
|
|
||||||
for profil_position_num, color_plot in zip(position_list, color_list):
|
|
||||||
self.axis_plot_PSD[0].plot(granulo_data._r_grain,
|
|
||||||
granulo_data._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('Size class volume fraction')
|
|
||||||
|
|
||||||
self.axis_plot_PSD[1].plot(granulo_data._r_grain,
|
|
||||||
granulo_data._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('Size class volume fraction')
|
|
||||||
|
|
||||||
self.canvas_plot_PSD.draw()
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.axis_plot_PSD[0].cla()
|
self.axis_plot_PSD[0].cla()
|
||||||
self.axis_plot_PSD[1].cla()
|
self.axis_plot_PSD[1].cla()
|
||||||
|
|
@ -838,58 +839,80 @@ class SampleDataTab(QWidget):
|
||||||
color=color_plot)
|
color=color_plot)
|
||||||
self.axis_plot_PSD[0].set_xscale('log')
|
self.axis_plot_PSD[0].set_xscale('log')
|
||||||
self.axis_plot_PSD[0].set_xlabel('Radius ($\mu m$)')
|
self.axis_plot_PSD[0].set_xlabel('Radius ($\mu m$)')
|
||||||
self.axis_plot_PSD[0].set_ylabel('Size class volume fraction')
|
self.axis_plot_PSD[0].set_ylabel('Class size volume fraction')
|
||||||
|
|
||||||
self.axis_plot_PSD[1].plot(granulo_data._r_grain,
|
self.axis_plot_PSD[1].plot(granulo_data._r_grain,
|
||||||
granulo_data._frac_vol_sand[profil_position_num, :],
|
granulo_data._frac_vol_sand[profil_position_num, :],
|
||||||
color=color_plot)
|
color=color_plot)
|
||||||
self.axis_plot_PSD[1].set_xscale('log')
|
self.axis_plot_PSD[1].set_xscale('log')
|
||||||
self.axis_plot_PSD[1].set_xlabel('Radius ($\mu m$)')
|
self.axis_plot_PSD[1].set_xlabel('Radius ($\mu m$)')
|
||||||
self.axis_plot_PSD[1].set_ylabel('Size class volume fraction')
|
self.axis_plot_PSD[1].set_ylabel('Class size volume fraction')
|
||||||
|
|
||||||
self.canvas_plot_PSD.draw()
|
self.canvas_plot_PSD.draw()
|
||||||
|
|
||||||
|
else:
|
||||||
|
msgBox = QMessageBox()
|
||||||
|
msgBox.setWindowTitle("Plot PSD Error")
|
||||||
|
msgBox.setIcon(QMessageBox.Warning)
|
||||||
|
msgBox.setText("Fill table and select sample(s) before plotting PSD")
|
||||||
|
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||||
|
msgBox.exec()
|
||||||
|
|
||||||
def update_plot_fine_and_sand_sediments_PSD_cumul(self):
|
def update_plot_fine_and_sand_sediments_PSD_cumul(self):
|
||||||
|
if self.tableWidget_sample.columnCount() > 15:
|
||||||
|
|
||||||
|
# --- Read sample data ---
|
||||||
granulo_data = deepcopy(
|
granulo_data = deepcopy(
|
||||||
GranuloLoader(self.lineEdit_fine_sediment.toolTip() + "/" + self.lineEdit_fine_sediment.text(),
|
GranuloLoader(self.lineEdit_fine_sediment.toolTip() + "/" + self.lineEdit_fine_sediment.text(),
|
||||||
self.lineEdit_sand.toolTip() + "/" + self.lineEdit_sand.text()))
|
self.lineEdit_sand.toolTip() + "/" + self.lineEdit_sand.text()))
|
||||||
|
|
||||||
|
# --- Read selected samples (checkboxes) ---
|
||||||
|
position_list, color_list = self.extract_position_list_and_color_list_from_table_checkboxes()
|
||||||
|
|
||||||
|
if position_list == []:
|
||||||
|
|
||||||
|
msgBox = QMessageBox()
|
||||||
|
msgBox.setWindowTitle("Axis choice Error")
|
||||||
|
msgBox.setIcon(QMessageBox.Warning)
|
||||||
|
msgBox.setText("Select sample(s) before changing axis")
|
||||||
|
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||||
|
msgBox.exec()
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
# --- Create canvas of Matplotlib figure ---
|
||||||
if self.canvas_plot_PSD == None:
|
if self.canvas_plot_PSD == None:
|
||||||
self.figure_plot_PSD, self.axis_plot_PSD = plt.subplots(nrows=1, ncols=2, layout="constrained")
|
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.canvas_plot_PSD = FigureCanvas(self.figure_plot_PSD)
|
||||||
self.verticalLayout_plot_PSD.addWidget(self.canvas_plot_PSD)
|
self.verticalLayout_plot_PSD.addWidget(self.canvas_plot_PSD)
|
||||||
|
|
||||||
if self.pushbutton_class_PSD.sender():
|
|
||||||
if self.tableWidget_sample.columnCount() > 10:
|
|
||||||
position_list, color_list = self.extract_position_list_and_color_list_from_table_checkboxes()
|
|
||||||
self.axis_plot_PSD[0].cla()
|
|
||||||
for profil_position_num, color_plot in zip(position_list, color_list):
|
|
||||||
self.axis_plot_PSD[0].plot(granulo_data._r_grain,
|
|
||||||
granulo_data._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('Size class volume fraction')
|
|
||||||
self.canvas_plot_PSD.draw()
|
|
||||||
else:
|
else:
|
||||||
self.empty_field_for_plot_fine_PSD_class()
|
|
||||||
self.empty_field_for_plot_sand_PSD_class()
|
|
||||||
elif self.pushbutton_cumulative_PSD.sender():
|
|
||||||
if self.tableWidget_sample.columnCount() > 10:
|
|
||||||
position_list, color_list = self.extract_position_list_and_color_list_from_table_checkboxes()
|
|
||||||
self.axis_plot_PSD[0].cla()
|
self.axis_plot_PSD[0].cla()
|
||||||
|
self.axis_plot_PSD[1].cla()
|
||||||
|
|
||||||
for profil_position_num, color_plot in zip(position_list, color_list):
|
for profil_position_num, color_plot in zip(position_list, color_list):
|
||||||
self.axis_plot_PSD[0].plot(granulo_data._r_grain,
|
self.axis_plot_PSD[0].plot(granulo_data._r_grain,
|
||||||
granulo_data._frac_vol_fine_cumul[profil_position_num, :],
|
granulo_data._frac_vol_fine_cumul[profil_position_num, :],
|
||||||
color=color_plot)
|
color=color_plot)
|
||||||
self.axis_plot_PSD[0].set_xscale('log')
|
self.axis_plot_PSD[0].set_xscale('log')
|
||||||
self.axis_plot_PSD[0].set_xlabel('Radius ($\mu m$)')
|
self.axis_plot_PSD[0].set_xlabel('Radius ($\mu m$)')
|
||||||
self.axis_plot_PSD[0].set_ylabel('Cumulated size volume fraction')
|
self.axis_plot_PSD[0].set_ylabel('Cumulative size volume fraction')
|
||||||
|
|
||||||
|
self.axis_plot_PSD[1].plot(granulo_data._r_grain,
|
||||||
|
granulo_data._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()
|
self.canvas_plot_PSD.draw()
|
||||||
# else:
|
|
||||||
# self.empty_field_for_plot_fine_PSD_cumul()
|
else:
|
||||||
# self.empty_field_for_plot_sand_PSD_cumul()
|
msgBox = QMessageBox()
|
||||||
|
msgBox.setWindowTitle("Plot PSD Error")
|
||||||
|
msgBox.setIcon(QMessageBox.Warning)
|
||||||
|
msgBox.setText("Fill table and select sample(s) before plotting PSD")
|
||||||
|
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||||
|
msgBox.exec()
|
||||||
|
|
||||||
# def update_plot_fine_PSD_class(self, profil_position, color_list):
|
# def update_plot_fine_PSD_class(self, profil_position, color_list):
|
||||||
# granulo_data = deepcopy(
|
# granulo_data = deepcopy(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue