Bottom can be detected before (BS_raw_data) and after (BS_cross_section) change limits of the acoustic recording.

dev-brahim
brahim 2024-07-12 14:55:29 +02:00
parent 250fed45fc
commit ab9d3c026e
1 changed files with 475 additions and 322 deletions

View File

@ -3013,7 +3013,54 @@ class AcousticDataTab(QWidget):
for f, _ in enumerate(stg.freq[self.fileListWidget.currentRow()]): for f, _ in enumerate(stg.freq[self.fileListWidget.currentRow()]):
self.axis_BS[f].cla() self.axis_BS[f].cla()
if stg.BS_cross_section[self.fileListWidget.currentRow()].shape == (0,): if stg.BS_cross_section[self.fileListWidget.currentRow()].shape != (0,):
val_min = np.nanmin(stg.BS_cross_section[self.fileListWidget.currentRow()][f, :, :])
val_max = np.nanmax(stg.BS_cross_section[self.fileListWidget.currentRow()][f, :, :])
if val_min == 0:
val_min = 1e-5
if self.combobox_ABS_system_choice.currentIndex() == 1:
pcm = self.axis_BS[f].pcolormesh(
stg.time_cross_section[self.fileListWidget.currentRow()][f, :],
-stg.depth_cross_section[self.fileListWidget.currentRow()][f, :],
stg.BS_cross_section[self.fileListWidget.currentRow()][f, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif self.combobox_ABS_system_choice.currentIndex() == 2:
pcm = self.axis_BS[f].pcolormesh(
stg.time_cross_section[self.fileListWidget.currentRow()][f, :],
-stg.depth_cross_section[self.fileListWidget.currentRow()][f, :],
np.log(stg.BS_cross_section[self.fileListWidget.currentRow()][f, :,
:]),
cmap='Blues')
# --- Plot red solid line on transect to visualize position of plotted profile ---
slider_value = \
[self.slider.value() - 1 if self.slider.value() - 1 <=
stg.time_cross_section[self.fileListWidget.currentRow()].shape[
1] - 1
else np.max(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1] - 1)][0]
self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot(
stg.time_cross_section[self.fileListWidget.currentRow()][
0, # self.combobox_frequency_profile.currentIndex(),
slider_value] * np.ones(
stg.depth_cross_section[self.fileListWidget.currentRow()].shape[1]),
-stg.depth_cross_section[self.fileListWidget.currentRow()][
self.combobox_frequency_profile.currentIndex(), :],
color='red', linestyle="solid", linewidth=2)
# --- Plot river bottom line ---
# if (len(stg.depth_bottom) != 0) and (len(stg.depth_bottom) == self.fileListWidget.count()):
if stg.depth_bottom[self.fileListWidget.currentRow()].shape != (0,):
# print("stg.depth_bottom ", stg.depth_bottom)
# print("len(stg.depth_bottom) ", len(stg.depth_bottom))
self.axis_BS[f].plot(stg.time_cross_section[self.fileListWidget.currentRow()][
self.combobox_frequency_bathymetry.currentIndex(), :],
-stg.depth_bottom[self.fileListWidget.currentRow()],
color='black', linewidth=1, linestyle="solid")
else:
val_min = np.nanmin(stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, :]) val_min = np.nanmin(stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, :])
val_max = np.nanmax(stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, :]) val_max = np.nanmax(stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, :])
@ -3052,52 +3099,8 @@ class AcousticDataTab(QWidget):
color='red', linestyle="solid", linewidth=2) color='red', linestyle="solid", linewidth=2)
# --- Plot river bottom line --- # --- Plot river bottom line ---
if len(stg.depth_bottom[self.fileListWidget.currentRow()]) != 0: if stg.depth_bottom[self.fileListWidget.currentRow()].shape != (0,):
self.axis_BS[f].plot(stg.time[self.fileListWidget.currentRow()][ self.axis_BS[f].plot(stg.time[self.fileListWidget.currentRow()][
self.combobox_frequency_bathymetry.currentIndex(), :],
-stg.depth[self.fileListWidget.currentRow()],
color='black', linewidth=1, linestyle="solid")
else:
val_min = np.nanmin(stg.BS_cross_section[self.fileListWidget.currentRow()][f, :, :])
val_max = np.nanmax(stg.BS_cross_section[self.fileListWidget.currentRow()][f, :, :])
if val_min == 0:
val_min = 1e-5
if self.combobox_ABS_system_choice.currentIndex() == 1:
pcm = self.axis_BS[f].pcolormesh(stg.time_cross_section[self.fileListWidget.currentRow()][f, :],
-stg.depth_cross_section[self.fileListWidget.currentRow()][f, :],
stg.BS_cross_section[self.fileListWidget.currentRow()][f, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif self.combobox_ABS_system_choice.currentIndex() == 2:
pcm = self.axis_BS[f].pcolormesh(stg.time_cross_section[self.fileListWidget.currentRow()][f, :],
-stg.depth_cross_section[self.fileListWidget.currentRow()][f, :],
np.log(stg.BS_cross_section[self.fileListWidget.currentRow()][f, :,
:]),
cmap='Blues')
# --- Plot red solid line on transect to visualize position of plotted profile ---
slider_value = \
[self.slider.value() - 1 if self.slider.value() - 1 <=
stg.time_cross_section[self.fileListWidget.currentRow()].shape[1] - 1
else np.max(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1] - 1)][0]
self.axis_BS[self.combobox_frequency_profile.currentIndex()].plot(
stg.time_cross_section[self.fileListWidget.currentRow()][
0, # self.combobox_frequency_profile.currentIndex(),
slider_value] * np.ones(
stg.depth_cross_section[self.fileListWidget.currentRow()].shape[1]),
-stg.depth_cross_section[self.fileListWidget.currentRow()][
self.combobox_frequency_profile.currentIndex(), :],
color='red', linestyle="solid", linewidth=2)
# --- Plot river bottom line ---
# if (len(stg.depth_bottom) != 0) and (len(stg.depth_bottom) == self.fileListWidget.count()):
if len(stg.depth_bottom[self.fileListWidget.currentRow()]) != 0:
# print("stg.depth_bottom ", stg.depth_bottom)
# print("len(stg.depth_bottom) ", len(stg.depth_bottom))
self.axis_BS[f].plot(stg.time_cross_section[self.fileListWidget.currentRow()][
self.combobox_frequency_bathymetry.currentIndex(), :], self.combobox_frequency_bathymetry.currentIndex(), :],
-stg.depth_bottom[self.fileListWidget.currentRow()], -stg.depth_bottom[self.fileListWidget.currentRow()],
color='black', linewidth=1, linestyle="solid") color='black', linewidth=1, linestyle="solid")
@ -3422,77 +3425,99 @@ class AcousticDataTab(QWidget):
# if (len(stg.BS_cross_section) == 0) and (len(stg.BS_raw_data) != 0): # if (len(stg.BS_cross_section) == 0) and (len(stg.BS_raw_data) != 0):
if self.fileListWidget.currentRow() != -1: if self.fileListWidget.currentRow() != -1:
if stg.BS_cross_section[self.fileListWidget.currentRow()].shape == (0,): if stg.BS_cross_section[self.fileListWidget.currentRow()].shape != (0,):
self.axis_profile.cla() self.axis_profile.cla()
self.axis_profile.plot(stg.BS_raw_data[self.fileListWidget.currentRow()][
self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1],
-stg.depth[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), :],
linestyle='solid', color='k', linewidth=1)
self.axis_profile.text(.95, .05, stg.freq_text[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex()],
fontsize=10, fontweight='bold', fontname="Ubuntu",
fontstyle="normal", c="black", alpha=0.2,
horizontalalignment='right', verticalalignment='bottom',
transform=self.axis_profile.transAxes)
self.fig_profile.supxlabel("Acoustic Backscatter Signal (V)")
self.fig_profile.supylabel("Depth (m)")
# self.fig_profile.canvas.draw()
self.fig_profile.canvas.draw_idle()
# self.fig_profile.canvas.flush_events()
# plt.close(self.fig_profile)
else:
# --- Set slider value ---
self.slider.setMaximum(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1]) self.slider.setMaximum(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1])
slider_value = [self.slider.value() - 1 if self.slider.value() - 1 <= stg.time_cross_section[
slider_value = [self.slider.value() - 1 if self.slider.value() -1 <= stg.time_cross_section[self.fileListWidget.currentRow()].shape[1]-1 self.fileListWidget.currentRow()].shape[1] - 1
else np.max(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1]-1)][0] else np.max(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1] - 1)][0]
self.axis_profile.cla()
# --- Profile plot --- # --- Profile plot ---
self.axis_profile.plot(stg.BS_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), :, slider_value], self.axis_profile.plot(stg.BS_cross_section[self.fileListWidget.currentRow()][
-stg.depth_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), :], self.combobox_frequency_profile.currentIndex(), :, slider_value],
-stg.depth_cross_section[self.fileListWidget.currentRow()][
self.combobox_frequency_profile.currentIndex(), :],
linestyle='solid', color='k', linewidth=1) linestyle='solid', color='k', linewidth=1)
# --- Plot upper limit line ---
# self.axis_profile.plot([0,
# stg.BS_cross_section[self.combobox_frequency_profile.currentIndex(),
# stg.ind_bottom[slider_value],
# slider_value]],
# -stg.
# )
# --- Plot lower limit line ---
# --- Write frequency on graph --- # --- Write frequency on graph ---
self.axis_profile.text(.95, .90, stg.freq_text[self.fileListWidget.currentRow()][
self.axis_profile.text(.95, .90, stg.freq_text[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex()], self.combobox_frequency_profile.currentIndex()],
fontsize=14, fontweight='bold', fontname="Ubuntu", fontsize=14, fontweight='bold', fontname="Ubuntu",
fontstyle="normal", c="black", alpha=0.2, fontstyle="normal", c="black", alpha=0.2,
horizontalalignment='right', verticalalignment='bottom', horizontalalignment='right', verticalalignment='bottom',
transform=self.axis_profile.transAxes) transform=self.axis_profile.transAxes)
# --- Plot bottom line --- # --- Plot bottom line ---
if stg.depth_bottom[self.fileListWidget.currentRow()].shape != (0,):
# print("len(stg.depth_bottom) ", len(stg.depth_bottom))
# print("self.fileListWidget.currentRow() ", self.fileListWidget.count())
# if (len(stg.depth_bottom) != 0) and (len(stg.depth_bottom) == self.fileListWidget.count()):
if len(stg.depth_bottom[self.fileListWidget.currentRow()]) != 0:
self.axis_profile.plot([0, self.axis_profile.plot([0,
np.nanmax(stg.BS_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), np.nanmax(stg.BS_cross_section[self.fileListWidget.currentRow()][
self.combobox_frequency_profile.currentIndex(),
:, slider_value])], :, slider_value])],
-stg.depth[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), stg.ind_bottom[self.fileListWidget.currentRow()][slider_value]]*np.ones(2), -stg.depth[self.fileListWidget.currentRow()][
self.combobox_frequency_profile.currentIndex(),
stg.ind_bottom[self.fileListWidget.currentRow()][
slider_value]] * np.ones(2),
linestyle='solid', color='r', linewidth=1) linestyle='solid', color='r', linewidth=1)
position_x = (stg.depth[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), stg.ind_bottom[self.fileListWidget.currentRow()][slider_value]] / position_x = (stg.depth[self.fileListWidget.currentRow()][
np.nanmax(stg.depth[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), :])) self.combobox_frequency_profile.currentIndex(),
stg.ind_bottom[self.fileListWidget.currentRow()][slider_value]] /
np.nanmax(stg.depth[self.fileListWidget.currentRow()][
self.combobox_frequency_profile.currentIndex(), :]))
self.axis_profile.text(.95, 1-position_x + 0.05, "River bed", self.axis_profile.text(.95, 1 - position_x + 0.05, "River bed",
fontsize=10, fontweight='normal', fontname="Ubuntu",
fontstyle="italic", c="red", alpha=0.2,
horizontalalignment='right', verticalalignment='bottom',
transform=self.axis_profile.transAxes)
else:
self.axis_profile.cla()
# --- Set slider value ---
self.slider.setMaximum(stg.time[self.fileListWidget.currentRow()].shape[1])
slider_value = [self.slider.value() - 1 if self.slider.value() - 1 <= stg.time[
self.fileListWidget.currentRow()].shape[1] - 1
else np.max(stg.time[self.fileListWidget.currentRow()].shape[1] - 1)][0]
# --- Profile plot ---
self.axis_profile.plot(stg.BS_raw_data[self.fileListWidget.currentRow()][
self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1],
-stg.depth[self.fileListWidget.currentRow()][
self.combobox_frequency_profile.currentIndex(), :],
linestyle='solid', color='k', linewidth=1)
# --- Write frequency on graph ---
self.axis_profile.text(.95, .05, stg.freq_text[self.fileListWidget.currentRow()][
self.combobox_frequency_profile.currentIndex()],
fontsize=10, fontweight='bold', fontname="Ubuntu",
fontstyle="normal", c="black", alpha=0.2,
horizontalalignment='right', verticalalignment='bottom',
transform=self.axis_profile.transAxes)
# --- Plot bottom line ---
if stg.depth_bottom[self.fileListWidget.currentRow()].shape != (0,):
self.axis_profile.plot([0,
np.nanmax(stg.BS_raw_data[self.fileListWidget.currentRow()][
self.combobox_frequency_profile.currentIndex(),
:, slider_value])],
-stg.depth[self.fileListWidget.currentRow()][
self.combobox_frequency_profile.currentIndex(),
stg.ind_bottom[self.fileListWidget.currentRow()][
slider_value]] * np.ones(2),
linestyle='solid', color='r', linewidth=1)
position_x = (stg.depth[self.fileListWidget.currentRow()][
self.combobox_frequency_profile.currentIndex(),
stg.ind_bottom[self.fileListWidget.currentRow()][slider_value]] /
np.nanmax(stg.depth[self.fileListWidget.currentRow()][
self.combobox_frequency_profile.currentIndex(), :]))
self.axis_profile.text(.95, 1 - position_x + 0.05, "River bed",
fontsize=10, fontweight='normal', fontname="Ubuntu", fontsize=10, fontweight='normal', fontname="Ubuntu",
fontstyle="italic", c="red", alpha=0.2, fontstyle="italic", c="red", alpha=0.2,
horizontalalignment='right', verticalalignment='bottom', horizontalalignment='right', verticalalignment='bottom',
@ -3500,7 +3525,6 @@ class AcousticDataTab(QWidget):
self.fig_profile.supxlabel("Acoustic Backscatter Signal (V)") self.fig_profile.supxlabel("Acoustic Backscatter Signal (V)")
self.fig_profile.supylabel("Depth (m)") self.fig_profile.supylabel("Depth (m)")
# self.fig_profile.canvas.draw()
self.fig_profile.canvas.draw_idle() self.fig_profile.canvas.draw_idle()
# self.fig_profile.canvas.flush_events() # self.fig_profile.canvas.flush_events()
# plt.close(self.fig_profile) # plt.close(self.fig_profile)
@ -3842,16 +3866,13 @@ class AcousticDataTab(QWidget):
# #
# stg.freq_bottom_detection.append(self.combobox_frequency_bathymetry.currentIndex()) # stg.freq_bottom_detection.append(self.combobox_frequency_bathymetry.currentIndex())
if stg.depth_bottom == []: # if stg.depth_bottom == []:
stg.freq_bottom_detection = [np.array([])]*self.fileListWidget.count() # stg.freq_bottom_detection = [np.array([])]*self.fileListWidget.count()
stg.depth_bottom = [np.array([])]*self.fileListWidget.count() # stg.depth_bottom = [np.array([])]*self.fileListWidget.count()
stg.val_bottom = [np.array([])]*self.fileListWidget.count() # stg.val_bottom = [np.array([])]*self.fileListWidget.count()
stg.ind_bottom = [np.array([])]*self.fileListWidget.count() # stg.ind_bottom = [np.array([])]*self.fileListWidget.count()
# print("stg.freq_bottom_detection : ", stg.freq_bottom_detection) if stg.BS_cross_section[self.fileListWidget.currentRow()].shape != (0,):
# print("stg.depth_bottom : ", stg.depth_bottom)
# print("stg.val_bottom : ", stg.val_bottom)
# print("stg.ind_bottom : ", stg.ind_bottom)
stg.freq_bottom_detection[self.fileListWidget.currentRow()] = self.combobox_frequency_bathymetry.currentIndex() stg.freq_bottom_detection[self.fileListWidget.currentRow()] = self.combobox_frequency_bathymetry.currentIndex()
@ -3860,20 +3881,19 @@ class AcousticDataTab(QWidget):
# rmax = np.float32(self.doubleRangeSlider_intg_area.value()[1].text().replace(",", ".")) # rmax = np.float32(self.doubleRangeSlider_intg_area.value()[1].text().replace(",", "."))
rmin = -self.doubleRangeSlider_intg_area.value()[1] rmin = -self.doubleRangeSlider_intg_area.value()[1]
rmax = -self.doubleRangeSlider_intg_area.value()[0] rmax = -self.doubleRangeSlider_intg_area.value()[0]
print(f"rmin = {rmin}")
print(f"rmax = {rmax}")
# empty result arrays # empty result arrays
# r_bottom = np.zeros(stg.nb_profiles) # r_bottom = np.zeros(stg.nb_profiles)
# val_bottom = np.zeros(stg.nb_profiles) # val_bottom = np.zeros(stg.nb_profiles)
r_bottom = np.zeros(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1]) r_bottom = np.zeros(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1])
val_bottom = np.zeros(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1]) val_bottom = np.zeros(stg.time_cross_section[self.fileListWidget.currentRow()].shape[1])
r_bottom_ind = [] r_bottom_ind = []
# print(f"r_bottom shape with zeros : {r_bottom.shape}") # print(f"r_bottom shape with zeros : {r_bottom.shape}")
BS_smooth = deepcopy(stg.BS_raw_data[self.fileListWidget.currentRow()][self.combobox_frequency_bathymetry.currentIndex(), :, :]) BS_smooth = deepcopy(stg.BS_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_bathymetry.currentIndex(), :, :])
# print(f"BS_smooth shape : {BS_smooth.shape}") # print(f"BS_smooth shape : {BS_smooth.shape}")
for k in range(stg.time[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")
@ -4078,6 +4098,139 @@ class AcousticDataTab(QWidget):
self.fig_BS.canvas.draw_idle() self.fig_BS.canvas.draw_idle()
elif stg.BS_raw_data[self.fileListWidget.currentRow()].shape != (0,):
print("I'm here for bottom detection")
stg.freq_bottom_detection[
self.fileListWidget.currentRow()] = self.combobox_frequency_bathymetry.currentIndex()
# Selecting the range in which we look for the bottom reflection
rmin = -self.doubleRangeSlider_intg_area.value()[1]
rmax = -self.doubleRangeSlider_intg_area.value()[0]
# empty result arrays
r_bottom = np.zeros(stg.time[self.fileListWidget.currentRow()].shape[1])
val_bottom = np.zeros(stg.time[self.fileListWidget.currentRow()].shape[1])
r_bottom_ind = []
BS_smooth = deepcopy(stg.BS_raw_data[self.fileListWidget.currentRow()][
self.combobox_frequency_bathymetry.currentIndex(), :, :])
# print(f"BS_smooth shape : {BS_smooth.shape}")
for k in range(stg.time[self.fileListWidget.currentRow()].shape[1]):
BS_smooth[:, k] = savgol_filter(BS_smooth[:, k], 10, 2)
# ----------- Detecting the bottom -------------
for d in range(stg.time[self.fileListWidget.currentRow()].shape[1]):
# Index of the range where we look for the peak
ind_min = np.where(stg.depth[self.fileListWidget.currentRow()][
int(self.combobox_frequency_bathymetry.currentIndex()), :] >= rmin)[0][0]
ind_max = np.where(stg.depth[self.fileListWidget.currentRow()][
int(self.combobox_frequency_bathymetry.currentIndex()), :] <= rmax)[0][-1]
# Getting the peak
try:
val_bottom[d] = np.nanmax(BS_smooth[ind_min:ind_max, d])
except ValueError as e:
msgBox = QMessageBox()
msgBox.setWindowTitle("Detect bottom Error")
msgBox.setIcon(QMessageBox.Warning)
msgBox.setText(f"1/ {e} : maximum value of section bottom is not found. \n "
f"Please change parameter of algorithm")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox_return = msgBox.exec()
if msgBox_return == msgBox.Ok:
break # msgBox.close()
else:
# Getting the range cell of the peak
ind_bottom = np.where((BS_smooth[ind_min:ind_max, d]) == val_bottom[d])[0][0]
np.append(stg.ind_bottom, ind_bottom)
r_bottom[d] = stg.depth[self.fileListWidget.currentRow()][
self.combobox_frequency_bathymetry.currentIndex(), ind_bottom + ind_min]
r_bottom_ind.append(ind_bottom + ind_min)
# Updating the range where we will look for the peak (in the next cell)
rmin = r_bottom[d] - np.float32(self.spinbox_offset_next_cell.text().replace(",", "."))
rmax = r_bottom[d] + np.float32(self.spinbox_offset_next_cell.text().replace(",", "."))
BS_section_bottom = np.zeros((stg.depth[self.fileListWidget.currentRow()].shape[1],
stg.time[self.fileListWidget.currentRow()].shape[1]))
for i in range(BS_section_bottom.shape[0]):
try:
BS_section_bottom[r_bottom_ind[i]][i] = 1
except IndexError as e:
msgBox = QMessageBox()
msgBox.setWindowTitle("Detect bottom Error")
msgBox.setIcon(QMessageBox.Warning)
msgBox.setText(f"2/ {e} : maximum value of section bottom is not found. \n "
f"Please change parameter of algorithm")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox_return = msgBox.exec()
if msgBox_return == msgBox.Ok:
break # msgBox.close()
if BS_section_bottom.sum() > 2:
# --- Record r_bottom for other tabs ---
stg.depth_bottom[self.fileListWidget.currentRow()] = r_bottom
stg.val_bottom[self.fileListWidget.currentRow()] = val_bottom
stg.ind_bottom[self.fileListWidget.currentRow()] = r_bottom_ind
BS_stream_bed_copy = deepcopy(stg.BS_raw_data[self.fileListWidget.currentRow()])
for f, _ in enumerate(stg.freq[self.fileListWidget.currentRow()]):
for k, _ in enumerate(stg.depth_bottom[self.fileListWidget.currentRow()]):
# print(k, np.where(stg.r >= stg.r_bottom[k])[0])
BS_stream_bed_copy[
f, np.where(stg.depth[self.fileListWidget.currentRow()][
self.combobox_frequency_bathymetry.currentIndex(), :]
>= stg.depth_bottom[self.fileListWidget.currentRow()][k])[
0], k] = np.nan
stg.BS_stream_bed[self.fileListWidget.currentRow()] = BS_stream_bed_copy
# --- Plot transect BS with bathymetry ---
for f, _ in enumerate(stg.freq[self.fileListWidget.currentRow()]):
self.axis_BS[f].cla()
val_min = np.min(stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, :])
val_max = np.max(stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, :])
if val_min == 0:
val_min = 1e-5
if self.combobox_ABS_system_choice.currentIndex() == 1:
pcm = self.axis_BS[f].pcolormesh(
stg.time[self.fileListWidget.currentRow()][f, :],
-stg.depth[self.fileListWidget.currentRow()][f, :],
stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif self.combobox_ABS_system_choice.currentIndex() == 2:
pcm = self.axis_BS[f].pcolormesh(
stg.time[self.fileListWidget.currentRow()][f, :],
-stg.depth[self.fileListWidget.currentRow()][f, :],
np.log(stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, :]),
cmap='Blues')
self.axis_BS[f].plot(stg.time[self.fileListWidget.currentRow()][
self.combobox_frequency_bathymetry.currentIndex(), :],
-stg.depth_bottom[self.fileListWidget.currentRow()],
color='black', linewidth=1, linestyle="solid")
self.axis_BS[f].text(1, .70, stg.freq_text[self.fileListWidget.currentRow()][f],
fontsize=14, fontweight='bold', fontname="Ubuntu", c="black",
alpha=0.5,
horizontalalignment='right', verticalalignment='bottom',
transform=self.axis_BS[f].transAxes)
# --- Update plot profile ---
self.update_plot_profile()
self.fig_BS.canvas.draw_idle()
# print("stg.freq_bottom_detection : ", stg.freq_bottom_detection) # print("stg.freq_bottom_detection : ", stg.freq_bottom_detection)
# print("stg.depth_bottom : ", stg.depth_bottom) # print("stg.depth_bottom : ", stg.depth_bottom)
# print("stg.val_bottom : ", stg.val_bottom) # print("stg.val_bottom : ", stg.val_bottom)