If the bottom is not detect in the first acoustic tab, then an error message is opened if the user try to plot the total concentration with z / h (in sample data tab).

dev-brahim
brahim 2024-07-15 10:54:34 +02:00
parent 2e2cbf629d
commit f8e7951139
2 changed files with 201 additions and 123 deletions

View File

@ -4113,10 +4113,10 @@ class AcousticDataTab(QWidget):
for k in range(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1]): for k in range(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1]):
BS_smooth[:, k] = savgol_filter(BS_smooth[:, k], 10, 2) BS_smooth[:, k] = savgol_filter(BS_smooth[:, k], 10, 2)
fig1, ax1 = plt.subplots(nrows=1, ncols=1, layout="constrained") # fig1, ax1 = plt.subplots(nrows=1, ncols=1, layout="constrained")
pcm1 = ax1.pcolormesh(stg.time_cross_section[0][0, :], -stg.depth_cross_section[0][0, :], (BS_smooth[:, :]), cmap='Blues') # pcm1 = ax1.pcolormesh(stg.time_cross_section[0][0, :], -stg.depth_cross_section[0][0, :], (BS_smooth[:, :]), cmap='Blues')
fig1.colorbar(pcm1, ax=ax1, shrink=1, location='right') # fig1.colorbar(pcm1, ax=ax1, shrink=1, location='right')
plt.show() # plt.show()
# ----------- Detecting the bottom ------------- # ----------- Detecting the bottom -------------
# for d in range(stg.nb_profiles): # for d in range(stg.nb_profiles):

View File

@ -948,6 +948,9 @@ class SampleDataTab(QWidget):
self.tableWidget_sand.itemChanged.connect(self.plot_total_concentration) self.tableWidget_sand.itemChanged.connect(self.plot_total_concentration)
self.tableWidget_sand.itemChanged.connect(self.plot_PSD_fine_and_sand_sediments) self.tableWidget_sand.itemChanged.connect(self.plot_PSD_fine_and_sand_sediments)
self.combobox_x_axis.currentIndexChanged.connect(self.plot_total_concentration)
self.combobox_y_axis.currentIndexChanged.connect(self.plot_total_concentration)
# --- Function to extract position of sample from table checkboxes to update plots --- # --- Function to extract position of sample from table checkboxes to update plots ---
def extract_position_list_and_color_list_from_table_checkboxes_fine(self): def extract_position_list_and_color_list_from_table_checkboxes_fine(self):
# if self.tableWidget_fine.columnCount() > 10: # if self.tableWidget_fine.columnCount() > 10:
@ -1420,7 +1423,7 @@ class SampleDataTab(QWidget):
stg.time_fine[position_list_fine[k]]]) == stg.time_fine[position_list_fine[k]]]) ==
np.nanmin(np.abs(stg.time_cross_section[ np.nanmin(np.abs(stg.time_cross_section[
self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] -
stg.time_fine[position_list_fine[k]])))[1][0]) stg.time_fine[position_list_fine[k]])))[0][0])
depth_bottom_to_plot_fine.append( depth_bottom_to_plot_fine.append(
stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_fine[-1]]) stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_fine[-1]])
@ -1433,17 +1436,18 @@ class SampleDataTab(QWidget):
np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_fine[position_list_fine[k]]) == np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_fine[position_list_fine[k]]) ==
np.nanmin( np.nanmin(
np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_fine[position_list_fine[k]])))[ np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_fine[position_list_fine[k]])))[
1][0]) 0][0])
depth_bottom_to_plot_fine.append( depth_bottom_to_plot_fine.append(
stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][
self.combobox_frequencies.currentIndex(), -1]) self.combobox_frequencies.currentIndex(), -1])
else: else:
indices_bottom_fine.append(np.where( indices_bottom_fine.append(np.where(
np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_fine[position_list_fine[k]]) == np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_fine[position_list_fine[k]]) ==
np.nanmin( np.nanmin(
np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_fine[position_list_fine[k]])))[ np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_fine[position_list_fine[k]])))[
1][0]) 0][0])
depth_bottom_to_plot_fine.append( depth_bottom_to_plot_fine.append(
stg.depth[self.combobox_acoustic_data.currentIndex()][ stg.depth[self.combobox_acoustic_data.currentIndex()][
self.combobox_frequencies.currentIndex(), -1]) self.combobox_frequencies.currentIndex(), -1])
@ -1476,23 +1480,33 @@ class SampleDataTab(QWidget):
[x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)], [x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)],
s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5)
elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,):
self.axis_total_concentration.scatter(
Ctot_fine_to_plot,
[x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)],
# stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][
# self.combobox_frequencies.currentIndex(), -1],
s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5)
else: else:
self.axis_total_concentration.scatter( msgBox = QMessageBox()
Ctot_fine_to_plot, msgBox.setWindowTitle("Axis choice Error")
[x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)], msgBox.setIcon(QMessageBox.Warning)
# stg.depth[self.combobox_acoustic_data.currentIndex()][ msgBox.setText("Please detect bottom before plotting axis z/h")
# self.combobox_frequencies.currentIndex(), -1], msgBox.setStandardButtons(QMessageBox.Ok)
s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) msgBox.exec()
# elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,):
#
# self.axis_total_concentration.scatter(
# Ctot_fine_to_plot,
# [x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)],
# # stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][
# # self.combobox_frequencies.currentIndex(), -1],
# s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5)
#
# else:
#
# self.axis_total_concentration.scatter(
# Ctot_fine_to_plot,
# [x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)],
# # stg.depth[self.combobox_acoustic_data.currentIndex()][
# # self.combobox_frequencies.currentIndex(), -1],
# s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5)
self.axis_total_concentration.set_ylim(-1, 0) self.axis_total_concentration.set_ylim(-1, 0)
self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText()) self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())
@ -1508,23 +1522,32 @@ class SampleDataTab(QWidget):
[x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)], [x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)],
s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5)
elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,):
self.axis_total_concentration.scatter(
Ctot_fine_percent_to_plot,
[x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)],
# stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][
# self.combobox_frequencies.currentIndex(), -1],
s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5)
else: else:
self.axis_total_concentration.scatter( msgBox = QMessageBox()
Ctot_fine_percent_to_plot, msgBox.setWindowTitle("Axis choice Error")
[x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)], msgBox.setIcon(QMessageBox.Warning)
# stg.depth[self.combobox_acoustic_data.currentIndex()][ msgBox.setText("Please detect bottom before plotting axis z/h")
# self.combobox_frequencies.currentIndex(), -1], msgBox.setStandardButtons(QMessageBox.Ok)
s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) msgBox.exec()
# elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,):
#
# self.axis_total_concentration.scatter(
# Ctot_fine_percent_to_plot,
# [x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)],
# # stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][
# # self.combobox_frequencies.currentIndex(), -1],
# s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5)
#
# else:
#
# self.axis_total_concentration.scatter(
# Ctot_fine_percent_to_plot,
# [x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)],
# # stg.depth[self.combobox_acoustic_data.currentIndex()][
# # self.combobox_frequencies.currentIndex(), -1],
# s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5)
self.axis_total_concentration.set_xlim(0, 100) self.axis_total_concentration.set_xlim(0, 100)
self.axis_total_concentration.set_ylim(-1, 0) self.axis_total_concentration.set_ylim(-1, 0)
@ -1537,6 +1560,7 @@ class SampleDataTab(QWidget):
elif not (self.lineEdit_fine_sediment.text()) and (self.lineEdit_sand_sediment.text()): elif not (self.lineEdit_fine_sediment.text()) and (self.lineEdit_sand_sediment.text()):
self.compute_Ctot_per_cent() self.compute_Ctot_per_cent()
print("Ctot sand % ", stg.Ctot_sand_per_cent)
# --- Read selected sand samples (checkboxes) --- # --- Read selected sand samples (checkboxes) ---
position_list_sand, color_list_sand = self.extract_position_list_and_color_list_from_table_checkboxes_sand() position_list_sand, color_list_sand = self.extract_position_list_and_color_list_from_table_checkboxes_sand()
@ -1550,32 +1574,47 @@ class SampleDataTab(QWidget):
Ctot_sand_percent_to_plot.append(stg.Ctot_sand_per_cent[position_list_sand[k]]) Ctot_sand_percent_to_plot.append(stg.Ctot_sand_per_cent[position_list_sand[k]])
sample_depth_to_plot_sand.append(stg.depth_sand[position_list_sand[k]]) sample_depth_to_plot_sand.append(stg.depth_sand[position_list_sand[k]])
if stg.depth_bottom[self.combobox_acoustic_data.currentIndex()].shape != (0,): if stg.depth_bottom[self.combobox_acoustic_data.currentIndex()].shape != (0,):
indices_bottom_sand.append(np.where(np.abs( indices_bottom_sand.append(np.where(np.abs(
stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[ stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[
position_list_sand[k]]) == position_list_sand[k]]) ==
np.nanmin(np.abs(stg.time_cross_section[ np.nanmin(np.abs(stg.time_cross_section[
self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] -
stg.time_sand[k])))[1][0]) stg.time_sand[k])))[0][0])
depth_bottom_to_plot_sand.append( depth_bottom_to_plot_sand.append(
stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_sand[-1]]) stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_sand[-1]])
elif stg.time_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,): elif stg.time_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,):
print("The test 0 : ", np.where(np.abs(
stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][
self.combobox_frequencies.currentIndex()] - stg.time_sand[
position_list_sand[k]]) ==
np.nanmin(np.abs(stg.time_cross_section[
self.combobox_acoustic_data.currentIndex()][
self.combobox_frequencies.currentIndex()] -
stg.time_sand[k]))))
indices_bottom_sand.append(np.where( indices_bottom_sand.append(np.where(
np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]]) == np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]]) ==
np.nanmin( np.nanmin(
np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]])))[ np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]])))[
1][0]) 0][0])
depth_bottom_to_plot_sand.append( depth_bottom_to_plot_sand.append(
stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][ stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][
self.combobox_frequencies.currentIndex(), -1]) self.combobox_frequencies.currentIndex(), -1])
else: else:
print("The test 1 : ", np.where(
np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]]) ==
np.nanmin(
np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]]))))
indices_bottom_sand.append(np.where( indices_bottom_sand.append(np.where(
np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]]) == np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]]) ==
np.nanmin( np.nanmin(
np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]])))[ np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]])))[
1][0]) 0][0])
depth_bottom_to_plot_sand.append( depth_bottom_to_plot_sand.append(
stg.depth[self.combobox_acoustic_data.currentIndex()][ stg.depth[self.combobox_acoustic_data.currentIndex()][
self.combobox_frequencies.currentIndex(), -1]) self.combobox_frequencies.currentIndex(), -1])
@ -1585,6 +1624,7 @@ class SampleDataTab(QWidget):
# --- Concentration (g/L) VS z (m) --- # --- Concentration (g/L) VS z (m) ---
if (self.combobox_x_axis.currentIndex() == 0) and (self.combobox_y_axis.currentIndex() == 0): if (self.combobox_x_axis.currentIndex() == 0) and (self.combobox_y_axis.currentIndex() == 0):
print("Je suis dans 1")
self.axis_total_concentration.scatter(Ctot_sand_to_plot, self.axis_total_concentration.scatter(Ctot_sand_to_plot,
sample_depth_to_plot_sand, sample_depth_to_plot_sand,
s=300, facecolor="None", edgecolor=color_list_sand, s=300, facecolor="None", edgecolor=color_list_sand,
@ -1594,6 +1634,8 @@ class SampleDataTab(QWidget):
# --- Concentration (%) VS z (m) --- # --- Concentration (%) VS z (m) ---
elif (self.combobox_x_axis.currentIndex() == 1) and (self.combobox_y_axis.currentIndex() == 0): elif (self.combobox_x_axis.currentIndex() == 1) and (self.combobox_y_axis.currentIndex() == 0):
print("Je suis dans 2")
print("Ctot_sand_percent_to_plot ", Ctot_sand_percent_to_plot)
self.axis_total_concentration.scatter(Ctot_sand_percent_to_plot, sample_depth_to_plot_sand, self.axis_total_concentration.scatter(Ctot_sand_percent_to_plot, sample_depth_to_plot_sand,
s=300, facecolor="None", edgecolor=color_list_sand, s=300, facecolor="None", edgecolor=color_list_sand,
alpha=0.5) alpha=0.5)
@ -1603,7 +1645,7 @@ class SampleDataTab(QWidget):
# --- Concentration (g/L) VS z / h --- # --- Concentration (g/L) VS z / h ---
elif (self.combobox_x_axis.currentIndex() == 0) and (self.combobox_y_axis.currentIndex() == 1): elif (self.combobox_x_axis.currentIndex() == 0) and (self.combobox_y_axis.currentIndex() == 1):
print("Je suis dans 3")
if stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,): if stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,):
self.axis_total_concentration.scatter( self.axis_total_concentration.scatter(
@ -1612,23 +1654,32 @@ class SampleDataTab(QWidget):
# stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_sand], # stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_sand],
s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,):
self.axis_total_concentration.scatter(
Ctot_sand_to_plot,
[x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)],
# stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][
# self.combobox_frequencies.currentIndex(), -1],
s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
else: else:
self.axis_total_concentration.scatter( msgBox = QMessageBox()
Ctot_sand_to_plot, msgBox.setWindowTitle("Axis choice Error")
[x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)], msgBox.setIcon(QMessageBox.Warning)
# stg.depth[self.combobox_acoustic_data.currentIndex()][ msgBox.setText("Please detect bottom before plotting axis z/h")
# self.combobox_frequencies.currentIndex(), -1], msgBox.setStandardButtons(QMessageBox.Ok)
s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) msgBox.exec()
# elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,):
#
# self.axis_total_concentration.scatter(
# Ctot_sand_to_plot,
# [x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)],
# # stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][
# # self.combobox_frequencies.currentIndex(), -1],
# s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
#
# else:
#
# self.axis_total_concentration.scatter(
# Ctot_sand_to_plot,
# [x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)],
# # stg.depth[self.combobox_acoustic_data.currentIndex()][
# # self.combobox_frequencies.currentIndex(), -1],
# s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
self.axis_total_concentration.set_ylim(-1, 0) self.axis_total_concentration.set_ylim(-1, 0)
self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText()) self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())
@ -1636,7 +1687,7 @@ class SampleDataTab(QWidget):
# --- Concentration (%) VS z / h --- # --- Concentration (%) VS z / h ---
elif (self.combobox_x_axis.currentIndex() == 1) and (self.combobox_y_axis.currentIndex() == 1): elif (self.combobox_x_axis.currentIndex() == 1) and (self.combobox_y_axis.currentIndex() == 1):
print("Je suis dans 4")
if stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,): if stg.BS_stream_bed[self.combobox_acoustic_data.currentIndex()].shape != (0,):
self.axis_total_concentration.scatter( self.axis_total_concentration.scatter(
@ -1645,23 +1696,32 @@ class SampleDataTab(QWidget):
# stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_sand], # stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_sand],
s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,):
self.axis_total_concentration.scatter(
Ctot_sand_percent_to_plot,
[x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)],
# stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][
# self.combobox_frequencies.currentIndex(), -1],
s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
else: else:
self.axis_total_concentration.scatter( msgBox = QMessageBox()
Ctot_sand_percent_to_plot, msgBox.setWindowTitle("Axis choice Error")
[x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)], msgBox.setIcon(QMessageBox.Warning)
# stg.depth[self.combobox_acoustic_data.currentIndex()][ msgBox.setText("Please detect bottom before plotting axis z/h")
# self.combobox_frequencies.currentIndex(), -1], msgBox.setStandardButtons(QMessageBox.Ok)
s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) msgBox.exec()
# elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,):
#
# self.axis_total_concentration.scatter(
# Ctot_sand_percent_to_plot,
# [x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)],
# # stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][
# # self.combobox_frequencies.currentIndex(), -1],
# s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
#
# else:
#
# self.axis_total_concentration.scatter(
# Ctot_sand_percent_to_plot,
# [x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)],
# # stg.depth[self.combobox_acoustic_data.currentIndex()][
# # self.combobox_frequencies.currentIndex(), -1],
# s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
self.axis_total_concentration.set_xlim(0, 100) self.axis_total_concentration.set_xlim(0, 100)
self.axis_total_concentration.set_ylim(-1, 0) self.axis_total_concentration.set_ylim(-1, 0)
@ -1682,9 +1742,9 @@ class SampleDataTab(QWidget):
sample_depth_to_plot_fine = [] sample_depth_to_plot_fine = []
indices_bottom_fine = [] indices_bottom_fine = []
depth_bottom_to_plot_fine = [] depth_bottom_to_plot_fine = []
print("time fine ", stg.time_fine) # print("time fine ", stg.time_fine)
for k in range(len(position_list_fine)): for k in range(len(position_list_fine)):
print("k = ", k, "type(k) = ", type(k)) # print("k = ", k, "type(k) = ", type(k))
Ctot_fine_to_plot.append(stg.Ctot_fine[position_list_fine[k]]) Ctot_fine_to_plot.append(stg.Ctot_fine[position_list_fine[k]])
Ctot_fine_percent_to_plot.append(stg.Ctot_fine_per_cent[position_list_fine[k]]) Ctot_fine_percent_to_plot.append(stg.Ctot_fine_per_cent[position_list_fine[k]])
sample_depth_to_plot_fine.append(stg.depth_fine[position_list_fine[k]]) sample_depth_to_plot_fine.append(stg.depth_fine[position_list_fine[k]])
@ -1694,7 +1754,7 @@ class SampleDataTab(QWidget):
stg.time_fine[position_list_fine[k]]])) == stg.time_fine[position_list_fine[k]]])) ==
np.nanmin(np.abs(stg.time_cross_section[ np.nanmin(np.abs(stg.time_cross_section[
self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] -
stg.time_fine[position_list_fine[k]])))[1][0]) stg.time_fine[position_list_fine[k]])))[0][0])
print("indices_bottom_fine ", indices_bottom_fine) print("indices_bottom_fine ", indices_bottom_fine)
depth_bottom_to_plot_fine.append( depth_bottom_to_plot_fine.append(
stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_fine[-1]]) stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_fine[-1]])
@ -1709,7 +1769,7 @@ class SampleDataTab(QWidget):
np.nanmin(np.abs(stg.time_cross_section[ np.nanmin(np.abs(stg.time_cross_section[
self.combobox_acoustic_data.currentIndex()][ self.combobox_acoustic_data.currentIndex()][
self.combobox_frequencies.currentIndex()] - self.combobox_frequencies.currentIndex()] -
stg.time_fine[position_list_fine[k]])))[1][ stg.time_fine[position_list_fine[k]])))[0][
0]) 0])
print() print()
depth_bottom_to_plot_fine.append( depth_bottom_to_plot_fine.append(
@ -1722,7 +1782,7 @@ class SampleDataTab(QWidget):
stg.time_fine[k])) == stg.time_fine[k])) ==
np.nanmin( np.nanmin(
np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()]
- stg.time_fine[k])))[1][0]) - stg.time_fine[k])))[0][0])
depth_bottom_to_plot_fine.append( depth_bottom_to_plot_fine.append(
stg.depth[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), stg.depth[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(),
@ -1764,7 +1824,7 @@ class SampleDataTab(QWidget):
stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] -
stg.time_sand[ stg.time_sand[
position_list_sand[k]]) == np.nanmin(np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - position_list_sand[k]]) == np.nanmin(np.abs(stg.time_cross_section[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] -
stg.time_sand[position_list_sand[k]])))[1][0]) stg.time_sand[position_list_sand[k]])))[0][0])
depth_bottom_to_plot_sand.append(stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_sand[-1]]) depth_bottom_to_plot_sand.append(stg.depth_bottom[self.combobox_acoustic_data.currentIndex()][indices_bottom_sand[-1]])
@ -1787,7 +1847,7 @@ class SampleDataTab(QWidget):
np.abs( np.abs(
stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]]) == stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]]) ==
np.nanmin( np.nanmin(
np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]])))[1][0]) np.abs(stg.time[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()] - stg.time_sand[position_list_sand[k]])))[0][0])
depth_bottom_to_plot_sand.append( depth_bottom_to_plot_sand.append(
stg.depth[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(), stg.depth[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex(),
@ -1840,33 +1900,42 @@ class SampleDataTab(QWidget):
[x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)], [x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)],
s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,):
self.axis_total_concentration.scatter(
Ctot_fine_to_plot,
stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][
self.combobox_frequencies.currentIndex(), -1],
s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5)
self.axis_total_concentration.scatter(
Ctot_sand_to_plot,
stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][
self.combobox_frequencies.currentIndex(), -1],
s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
else: else:
self.axis_total_concentration.scatter( msgBox = QMessageBox()
Ctot_fine_to_plot, msgBox.setWindowTitle("Axis choice Error")
stg.depth[self.combobox_acoustic_data.currentIndex()][ msgBox.setIcon(QMessageBox.Warning)
self.combobox_frequencies.currentIndex(), -1], msgBox.setText("Please detect bottom before plotting axis z/h")
s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
self.axis_total_concentration.scatter( # elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,):
Ctot_sand_to_plot, #
stg.depth[self.combobox_acoustic_data.currentIndex()][ # self.axis_total_concentration.scatter(
self.combobox_frequencies.currentIndex(), -1], # Ctot_fine_to_plot,
s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) # stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][
# self.combobox_frequencies.currentIndex(), -1],
# s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5)
#
# self.axis_total_concentration.scatter(
# Ctot_sand_to_plot,
# stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()][
# self.combobox_frequencies.currentIndex(), -1],
# s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
#
# else:
#
# self.axis_total_concentration.scatter(
# Ctot_fine_to_plot,
# stg.depth[self.combobox_acoustic_data.currentIndex()][
# self.combobox_frequencies.currentIndex(), -1],
# s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5)
#
# self.axis_total_concentration.scatter(
# Ctot_sand_to_plot,
# stg.depth[self.combobox_acoustic_data.currentIndex()][
# self.combobox_frequencies.currentIndex(), -1],
# s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
self.axis_total_concentration.set_ylim(-1, 0) self.axis_total_concentration.set_ylim(-1, 0)
self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText()) self.axis_total_concentration.set_xlabel(self.combobox_x_axis.currentText())
@ -1887,29 +1956,38 @@ class SampleDataTab(QWidget):
[x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)], [x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)],
s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,):
self.axis_total_concentration.scatter(
Ctot_fine_percent_to_plot,
[x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)],
s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5)
self.axis_total_concentration.scatter(
Ctot_sand_percent_to_plot,
[x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)],
s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
else: else:
self.axis_total_concentration.scatter( msgBox = QMessageBox()
Ctot_fine_percent_to_plot, msgBox.setWindowTitle("Axis choice Error")
[x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)], msgBox.setIcon(QMessageBox.Warning)
s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5) msgBox.setText("Please detect bottom before plotting axis z/h")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
self.axis_total_concentration.scatter( # elif stg.BS_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,):
Ctot_sand_percent_to_plot, #
[x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)], # self.axis_total_concentration.scatter(
s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5) # Ctot_fine_percent_to_plot,
# [x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)],
# s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5)
#
# self.axis_total_concentration.scatter(
# Ctot_sand_percent_to_plot,
# [x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)],
# s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
#
# else:
#
# self.axis_total_concentration.scatter(
# Ctot_fine_percent_to_plot,
# [x / y for x, y in zip(sample_depth_to_plot_fine, depth_bottom_to_plot_fine)],
# s=100, facecolor=color_list_fine, edgecolor="None", alpha=0.5)
#
# self.axis_total_concentration.scatter(
# Ctot_sand_percent_to_plot,
# [x / y for x, y in zip(sample_depth_to_plot_sand, depth_bottom_to_plot_sand)],
# s=300, facecolor="None", edgecolor=color_list_sand, alpha=0.5)
self.axis_total_concentration.set_xlim(0, 100) self.axis_total_concentration.set_xlim(0, 100)
self.axis_total_concentration.set_ylim(-1, 0) self.axis_total_concentration.set_ylim(-1, 0)