Few corrections have been made on calibration, in particular, for the interpolation of the fine sediments profile. The user can invert several acoustic recording with a single calibration. There remains a prolem to display the plots, in particular, when the user switches from one to another acoustic data.

dev-brahim
brahim 2024-09-19 14:54:44 +02:00
parent bba389ae9d
commit 8c51ebc192
5 changed files with 1106 additions and 752 deletions

View File

@ -207,70 +207,134 @@ class AcousticInversionMethodHighConcentration():
# ------------- Computing interpolation of fine SSC data obtained from water sampling ------------- # ------------- Computing interpolation of fine SSC data obtained from water sampling -------------
# ------------- collected at various depth in the vertical sample ------------- # ------------- collected at various depth in the vertical sample -------------
# def M_profile_SCC_fine_interpolated(self, sample_depth, M_profile, range_cells, r_bottom):
# res = np.zeros((len(range_cells),)) * np.nan
# for i in range(len(M_profile) - 1):
# # print(f"i = {i}")
# r_ini = sample_depth[i]
# # print(f"r_ini = {r_ini}")
# c_ini = M_profile[i]
# # print(f"c_ini = {c_ini}")
# r_end = sample_depth[i + 1]
# # print(f"r_end = {r_end}")
# c_end = M_profile[i + 1]
# # print(f"c_end = {c_end}")
#
# # Computing the linear equation
# a = (c_end - c_ini) / (r_end - r_ini)
# # print(f"a = {a}")
# b = c_ini - a * r_ini
# # print(f"b = {b}")
#
# # Finding the indices of r_ini and r_end in the interpolated array
# # print(f"range_cells = {range_cells}")
# loc = (range_cells >= r_ini) * (range_cells < r_end)
# # print(f"loc = {loc}")
# # print(f"loc shape = {len(loc)}")
#
# # Filling the array with interpolation values
# res[loc] = range_cells[loc] * a + b
# # print(res.shape)
# # print(f"res = {res}")
# # print(f"1. res.shape = {res.shape}")
#
# # Filling first and last values
# i = 0
# while np.isnan(res[i]):
# res[i] = M_profile[0]
# i += 1
#
# # Filling the last values
# i = -1
# while np.isnan(res[i]):
# res[i] = M_profile[-1]
# i += -1
# # print(f"res.shape = {res.shape}")
# # print(f"res = {res}")
# # print(f"r_bottom.shape = {r_bottom.shape}")
# # print(f" = {res}")
#
# if r_bottom.shape != (0,):
# res[np.where(range_cells > r_bottom)] = np.nan
#
# loc_point_lin_interp0 = range_cells[np.where((range_cells > sample_depth[0]) & (range_cells < sample_depth[-1]))]
# # print(f"range_cells : {range_cells}")
# # print(f"loc_point_lin_interp0 shape : {len(loc_point_lin_interp0)}")
# # print(f"loc_point_lin_interp0 : {loc_point_lin_interp0}")
# res0 = res[np.where((range_cells > sample_depth[0]) & (range_cells < sample_depth[-1]))]
#
# loc_point_lin_interp = loc_point_lin_interp0[np.where(loc_point_lin_interp0 > range_cells[0])]
# # print(f"loc_point_lin_interp shape : {len(loc_point_lin_interp)}")
# # print(f"loc_point_lin_interp : {loc_point_lin_interp}")
# res = res0[np.where(loc_point_lin_interp0 > range_cells[0])]
#
# # fig, ax = plt.subplots(nrows=1, ncols=1)
# # ax.plot(loc_point_lin_interp, res[:len(loc_point_lin_interp)], marker="*", mfc="blue")
# # ax.plot(sample_depth, M_profile, marker="o", mfc="k", mec="k")
# # plt.show()
#
# return (loc_point_lin_interp, res)
def M_profile_SCC_fine_interpolated(self, sample_depth, M_profile, range_cells, r_bottom): def M_profile_SCC_fine_interpolated(self, sample_depth, M_profile, range_cells, r_bottom):
res = np.zeros((len(range_cells),)) * np.nan res = np.zeros((len(range_cells),)) * np.nan
for i in range(len(M_profile) - 1): l0 = sample_depth
# print(f"i = {i}") print("l0 = ", l0)
r_ini = sample_depth[i] l1 = [l0.index(x) for x in sorted(l0)]
# print(f"r_ini = {r_ini}") print("l1 = ", l1)
c_ini = M_profile[i] l2 = [l0[k] for k in l1]
# print(f"c_ini = {c_ini}") print("l2 = ", l2)
r_end = sample_depth[i + 1] c1 = [list(M_profile)[j] for j in l1]
# print(f"r_end = {r_end}") print("c1 = ", c1)
c_end = M_profile[i + 1] for i in range(len(c1) - 1):
# print(f"c_end = {c_end}") # print("i = ", i)
r_ini = l2[i]
c_ini = c1[i]
r_end = l2[i + 1]
c_end = c1[i + 1]
print("r_ini ", r_ini, "c_ini ", c_ini, "r_end ", r_end, "c_end ", c_end)
# Computing the linear equation # Computing the linear equation
a = (c_end - c_ini) / (r_end - r_ini) a = (c_end - c_ini) / (r_end - r_ini)
# print(f"a = {a}")
b = c_ini - a * r_ini b = c_ini - a * r_ini
# print(f"b = {b}") print("range_cells ", (range_cells))
# Finding the indices of r_ini and r_end in the interpolated array # Finding the indices of r_ini and r_end in the interpolated array
# print(f"range_cells = {range_cells}")
loc = (range_cells >= r_ini) * (range_cells < r_end) loc = (range_cells >= r_ini) * (range_cells < r_end)
# print(f"loc = {loc}") print("range_cells >= r_ini ", range_cells >= r_ini)
# print(f"loc shape = {len(loc)}") print("range_cells < r_end ", range_cells < r_end)
print("loc ", loc)
# Filling the array with interpolation values # Filling the array with interpolation values
res[loc] = range_cells[loc] * a + b res[loc] = range_cells[loc] * a + b
# print(res.shape)
# print(f"res = {res}") print("a = ", a, "b = ", b)
# print(f"1. res.shape = {res.shape}")
print("res ", res)
# Filling first and last values # Filling first and last values
i = 0 i = 0
while np.isnan(res[i]): while np.isnan(res[i]):
res[i] = M_profile[0] res[i] = c1[0]
i += 1 i += 1
# Filling the last values # Filling the last values
i = -1 i = -1
while np.isnan(res[i]): while np.isnan(res[i]):
res[i] = M_profile[-1] res[i] = c1[-1]
i += -1 i += -1
# print(f"res.shape = {res.shape}")
# print(f"res = {res}")
# print(f"r_bottom.shape = {r_bottom.shape}")
# print(f" = {res}")
if r_bottom.shape != (0,): if r_bottom.size != 0:
res[np.where(range_cells > r_bottom)] = np.nan res[np.where(range_cells > r_bottom)] = np.nan
loc_point_lin_interp0 = range_cells[np.where((range_cells > sample_depth[0]) & (range_cells < sample_depth[-1]))] loc_point_lin_interp0 = range_cells[np.where((range_cells > l2[0]) & (range_cells < l2[-1]))]
# print(f"range_cells : {range_cells}") res0 = res[np.where((range_cells > l2[0]) & (range_cells < l2[-1]))]
# print(f"loc_point_lin_interp0 shape : {len(loc_point_lin_interp0)}")
# print(f"loc_point_lin_interp0 : {loc_point_lin_interp0}")
res0 = res[np.where((range_cells > sample_depth[0]) & (range_cells < sample_depth[-1]))]
loc_point_lin_interp = loc_point_lin_interp0[np.where(loc_point_lin_interp0 > range_cells[0])] loc_point_lin_interp = loc_point_lin_interp0[np.where(loc_point_lin_interp0 > l2[0])]
# print(f"loc_point_lin_interp shape : {len(loc_point_lin_interp)}") res = res0[np.where(loc_point_lin_interp0 > l2[0])]
# print(f"loc_point_lin_interp : {loc_point_lin_interp}")
res = res0[np.where(loc_point_lin_interp0 > range_cells[0])]
# fig, ax = plt.subplots(nrows=1, ncols=1) # fig, ax = plt.subplots(nrows=1, ncols=1)
# ax.plot(loc_point_lin_interp, res[:len(loc_point_lin_interp)], marker="*", mfc="blue") # ax.plot(res[:len(loc_point_lin_interp)], -loc_point_lin_interp, marker="*", mfc="blue")
# ax.plot(sample_depth, M_profile, marker="o", mfc="k", mec="k") # ax.plot(c1, [-x for x in l2], marker="o", mfc="k", mec="k", ls="None")
# ax.set_xlabel("Concentration (g/L)")
# ax.set_ylabel("Depth (m)")
# plt.show() # plt.show()
return (loc_point_lin_interp, res) return (loc_point_lin_interp, res)

View File

@ -1856,9 +1856,9 @@ class AcousticDataTab(QWidget):
self.label_date_acoustic_file.setText("Date: ") self.label_date_acoustic_file.setText("Date: ")
self.label_hour_acoustic_file.clear() self.label_hour_acoustic_file.clear()
self.label_hour_acoustic_file.setText("Hour: ") self.label_hour_acoustic_file.setText("Hour: ")
self.spinbox_temperature.clear() self.spinbox_temperature.setValue(0)
self.spinbox_speed_of_sound.clear() self.spinbox_speed_of_sound.setValue(0)
self.spinbox_sound_attenuation.clear() self.spinbox_sound_attenuation.setValue(0)
self.combobox_frequency_information.clear() self.combobox_frequency_information.clear()
self.label_profiles_value.clear() self.label_profiles_value.clear()
self.label_profiles_per_sec_value.clear() self.label_profiles_per_sec_value.clear()
@ -1867,9 +1867,9 @@ class AcousticDataTab(QWidget):
self.label_pulse_length_value.clear() self.label_pulse_length_value.clear()
self.label_pings_per_sec_value.clear() self.label_pings_per_sec_value.clear()
self.label_pings_per_profile_value.clear() self.label_pings_per_profile_value.clear()
self.spinbox_kt.clear() self.spinbox_kt.setValue(0)
self.spinbox_rx.clear() self.spinbox_rx.setValue(0)
self.spinbox_tx.clear() self.spinbox_tx.setValue(0)
# --- Clear display options --- # --- Clear display options ---
@ -1893,18 +1893,43 @@ class AcousticDataTab(QWidget):
self.tableModel = TableModel(data) self.tableModel = TableModel(data)
self.tableView.setModel(self.tableModel) self.tableView.setModel(self.tableModel)
# --- Clear figures --- # --- Clear figure : 2D plot of the acoustic recording ---
self.canvas_BS.figure.clear() self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.scroll_BS)
self.fig_BS.clf() self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.toolbar_BS)
print("axis BS : ", self.axis_BS)
self.axis_BS.tolist().clear() self.canvas_BS = FigureCanvas()
print("clear axis BS : ", self.axis_BS) self.toolbar_BS = NavigationToolBar(self.canvas_BS, self)
self.canvas_plot_profile.figure.clear() self.scroll_BS.setWidget(self.canvas_BS)
self.fig_profile.clear()
self.axis_profile.clear() self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.toolbar_BS)
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.scroll_BS)
# --- Clear figure : profile ---
self.combobox_frequency_profile.clear()
self.verticalLayout_groupbox_plot_profile.removeWidget(self.canvas_plot_profile)
self.verticalLayout_groupbox_plot_profile.removeWidget(self.toolbar_profile)
self.canvas_plot_profile = FigureCanvas()
self.toolbar_profile = NavigationToolBar(self.canvas_plot_profile, self)
self.verticalLayout_groupbox_plot_profile.addWidget(self.toolbar_profile)
self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_plot_profile)
self.slider.setValue(0) self.slider.setValue(0)
self.slider.setMaximum(10) self.slider.setMaximum(10)
# if self.line
# self.fig_BS.clf()
# print("axis BS : ", self.axis_BS)
# self.axis_BS.tolist().clear()
# print("clear axis BS : ", self.axis_BS)
# self.canvas_plot_profile.figure.clear()
# self.fig_profile.clear()
# self.axis_profile.clear()
# self.slider.setValue(0)
# self.slider.setMaximum(10)
def clear_files_from_ListWidget(self): def clear_files_from_ListWidget(self):
# if self.fileListWidget.count() > 0: # if self.fileListWidget.count() > 0:
@ -1928,9 +1953,9 @@ class AcousticDataTab(QWidget):
self.label_date_acoustic_file.setText("Date: ") self.label_date_acoustic_file.setText("Date: ")
self.label_hour_acoustic_file.clear() self.label_hour_acoustic_file.clear()
self.label_hour_acoustic_file.setText("Hour: ") self.label_hour_acoustic_file.setText("Hour: ")
self.spinbox_temperature.clear() self.spinbox_temperature.setValue(0)
self.spinbox_speed_of_sound.clear() self.spinbox_speed_of_sound.setValue(0)
self.spinbox_sound_attenuation.clear() self.spinbox_sound_attenuation.setValue(0)
self.combobox_frequency_information.clear() self.combobox_frequency_information.clear()
self.label_profiles_value.clear() self.label_profiles_value.clear()
self.label_profiles_per_sec_value.clear() self.label_profiles_per_sec_value.clear()
@ -1939,9 +1964,9 @@ class AcousticDataTab(QWidget):
self.label_pulse_length_value.clear() self.label_pulse_length_value.clear()
self.label_pings_per_sec_value.clear() self.label_pings_per_sec_value.clear()
self.label_pings_per_profile_value.clear() self.label_pings_per_profile_value.clear()
self.spinbox_kt.clear() self.spinbox_kt.setValue(0)
self.spinbox_rx.clear() self.spinbox_rx.setValue(0)
self.spinbox_tx.clear() self.spinbox_tx.setValue(0)
# --- Clear display options --- # --- Clear display options ---
@ -1980,7 +2005,32 @@ class AcousticDataTab(QWidget):
# print("1 fig profile : ", self.fig_profile) # print("1 fig profile : ", self.fig_profile)
# # self.axis_profile.clear() # # self.axis_profile.clear()
# --- Clear figure : 2D plot of the acoustic recording ---
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.scroll_BS)
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.toolbar_BS)
self.canvas_BS = FigureCanvas()
self.toolbar_BS = NavigationToolBar(self.canvas_BS, self)
self.scroll_BS.setWidget(self.canvas_BS)
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.toolbar_BS)
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.scroll_BS)
# --- Clear figure : profile ---
self.combobox_frequency_profile.clear() self.combobox_frequency_profile.clear()
self.verticalLayout_groupbox_plot_profile.removeWidget(self.canvas_plot_profile)
self.verticalLayout_groupbox_plot_profile.removeWidget(self.toolbar_profile)
self.canvas_plot_profile = FigureCanvas()
self.toolbar_profile = NavigationToolBar(self.canvas_plot_profile, self)
self.verticalLayout_groupbox_plot_profile.addWidget(self.toolbar_profile)
self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_plot_profile)
self.slider.setValue(0)
self.slider.setMaximum(10)
# self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.scroll_BS) # self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.scroll_BS)
# self.canvas_BS = FigureCanvas() # self.canvas_BS = FigureCanvas()
# self.scroll_BS.setWidget(self.canvas_BS) # self.scroll_BS.setWidget(self.canvas_BS)
@ -1996,22 +2046,21 @@ class AcousticDataTab(QWidget):
# self.canvas_plot_profile = FigureCanvas() # self.canvas_plot_profile = FigureCanvas()
# self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_plot_profile) # self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_plot_profile)
self.canvas_BS.figure.clear() # self.canvas_BS.figure.clear()
self.fig_BS.clf() # self.fig_BS.clf()
print("axis BS : ", self.axis_BS) # print("axis BS : ", self.axis_BS)
self.axis_BS.tolist().clear() # self.axis_BS.tolist().clear()
print("clear axis BS : ", self.axis_BS) # print("clear axis BS : ", self.axis_BS)
self.canvas_BS = FigureCanvas() # self.canvas_BS = FigureCanvas()
self.scroll_BS.setWidget(self.canvas_BS) # self.scroll_BS.setWidget(self.canvas_BS)
#
# self.canvas_plot_profile.figure.clear()
# self.fig_profile.clear()
# self.axis_profile.clear()
# self.canvas_plot_profile = FigureCanvas()
# self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_plot_profile)
self.canvas_plot_profile.figure.clear()
self.fig_profile.clear()
self.axis_profile.clear()
self.canvas_plot_profile = FigureCanvas()
self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_plot_profile)
self.slider.setValue(0)
self.slider.setMaximum(10)
def load_BS_acoustic_raw_data(self): def load_BS_acoustic_raw_data(self):
@ -2069,7 +2118,7 @@ class AcousticDataTab(QWidget):
stg.nb_pings_per_sec.append(acoustic_data._nb_pings_per_sec) stg.nb_pings_per_sec.append(acoustic_data._nb_pings_per_sec)
stg.nb_pings_averaged_per_profile.append(acoustic_data._nb_pings_averaged_per_profile) stg.nb_pings_averaged_per_profile.append(acoustic_data._nb_pings_averaged_per_profile)
stg.kt_read.append(acoustic_data._kt) stg.kt_read.append(acoustic_data._kt)
# stg.kt_corrected.append(acoustic_data._kt) stg.kt_corrected.append([0]*len(stg.kt_read[-1]))
stg.gain_rx.append(acoustic_data._gain_rx) stg.gain_rx.append(acoustic_data._gain_rx)
stg.gain_tx.append(acoustic_data._gain_tx) stg.gain_tx.append(acoustic_data._gain_tx)
stg.temperature.append(0) stg.temperature.append(0)
@ -2121,15 +2170,15 @@ class AcousticDataTab(QWidget):
stg.BS_stream_bed_pre_process_average.append(np.array([])) stg.BS_stream_bed_pre_process_average.append(np.array([]))
stg.BS_stream_bed_pre_process_SNR_average.append(np.array([])) stg.BS_stream_bed_pre_process_SNR_average.append(np.array([]))
stg.FCB.append([]) # stg.FCB.append([])
stg.depth_real.append([]) # stg.depth_real.append([])
stg.lin_reg.append(tuple()) # stg.lin_reg.append(tuple())
#
stg.frequencies_for_calibration.append([]) # stg.frequencies_for_calibration.append([])
stg.frequency_for_inversion.append([]) # stg.frequency_for_inversion.append([])
#
stg.fine_sample_position.append([]) # stg.fine_sample_position.append([])
stg.sand_sample_position.append([]) # stg.sand_sample_position.append([])
stg.VBI_cross_section.append(np.array([])) stg.VBI_cross_section.append(np.array([]))
stg.SSC_fine.append(np.array([])) stg.SSC_fine.append(np.array([]))
@ -2186,6 +2235,8 @@ class AcousticDataTab(QWidget):
self.combobox_frequency_information.addItems(stg.freq_text[self.fileListWidget.currentRow()]) self.combobox_frequency_information.addItems(stg.freq_text[self.fileListWidget.currentRow()])
self.combobox_frequency_information.currentIndexChanged.connect(self.combobox_frequency_information_update) self.combobox_frequency_information.currentIndexChanged.connect(self.combobox_frequency_information_update)
self.spinbox_temperature.setValue(0)
self.label_profiles_value.setText(str(stg.nb_profiles[self.fileListWidget.currentRow()] self.label_profiles_value.setText(str(stg.nb_profiles[self.fileListWidget.currentRow()]
[self.combobox_frequency_information.currentIndex()])) [self.combobox_frequency_information.currentIndex()]))
self.gridLayout_goupbox_info.addWidget(self.label_profiles_value, 7, 1, 1, 1) self.gridLayout_goupbox_info.addWidget(self.label_profiles_value, 7, 1, 1, 1)
@ -2214,7 +2265,7 @@ class AcousticDataTab(QWidget):
[self.combobox_frequency_information.currentIndex()])) [self.combobox_frequency_information.currentIndex()]))
self.gridLayout_goupbox_info.addWidget(self.label_pings_per_profile_value, 13, 1, 1, 1) self.gridLayout_goupbox_info.addWidget(self.label_pings_per_profile_value, 13, 1, 1, 1)
stg.kt_corrected = deepcopy(stg.kt_read) stg.kt_corrected[self.fileListWidget.currentRow()] = stg.kt_read[self.fileListWidget.currentRow()]
# if self.checkbox_kt.isChecked(): # if self.checkbox_kt.isChecked():
# self.spinbox_kt.setValue( # self.spinbox_kt.setValue(
# stg.kt_corrected[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()]) # stg.kt_corrected[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()])
@ -2336,43 +2387,44 @@ class AcousticDataTab(QWidget):
self.gridLayout_goupbox_info.removeWidget(self.label_profiles_value) self.gridLayout_goupbox_info.removeWidget(self.label_profiles_value)
self.label_profiles_value.setText(str(stg.nb_profiles[self.fileListWidget.currentRow()] self.label_profiles_value.setText(str(stg.nb_profiles[self.fileListWidget.currentRow()]
[self.combobox_frequency_information.currentIndex()])) [self.combobox_frequency_information.currentIndex()]))
self.gridLayout_goupbox_info.addWidget(self.label_profiles_value, 6, 1, 1, 1) self.gridLayout_goupbox_info.addWidget(self.label_profiles_value, 7, 1, 1, 1)
self.label_profiles_per_sec_value.clear() self.label_profiles_per_sec_value.clear()
self.label_profiles_per_sec_value.setText( self.label_profiles_per_sec_value.setText(
str(stg.nb_profiles_per_sec[self.fileListWidget.currentRow()] str(stg.nb_profiles_per_sec[self.fileListWidget.currentRow()]
[self.combobox_frequency_information.currentIndex()]) + " Hz") [self.combobox_frequency_information.currentIndex()]) + " Hz")
self.gridLayout_goupbox_info.addWidget(self.label_profiles_per_sec_value, 7, 1, 1, 1) self.gridLayout_goupbox_info.addWidget(self.label_profiles_per_sec_value, 8, 1, 1, 1)
self.label_cells_value.clear() self.label_cells_value.clear()
self.label_cells_value.setText(str(stg.nb_cells[self.fileListWidget.currentRow()] self.label_cells_value.setText(str(stg.nb_cells[self.fileListWidget.currentRow()]
[self.combobox_frequency_information.currentIndex()])) [self.combobox_frequency_information.currentIndex()]))
self.gridLayout_goupbox_info.addWidget(self.label_cells_value, 8, 1, 1, 1) self.gridLayout_goupbox_info.addWidget(self.label_cells_value, 9, 1, 1, 1)
self.label_cell_size_value.clear() self.label_cell_size_value.clear()
self.gridLayout_goupbox_info.removeWidget(self.label_cell_size_value) self.gridLayout_goupbox_info.removeWidget(self.label_cell_size_value)
self.label_cell_size_value.setText( self.label_cell_size_value.setText(
str(100 * round(stg.cell_size[self.fileListWidget.currentRow()] str(100 * round(stg.cell_size[self.fileListWidget.currentRow()]
[self.combobox_frequency_information.currentIndex()], 3)) + " cm") [self.combobox_frequency_information.currentIndex()], 3)) + " cm")
self.gridLayout_goupbox_info.addWidget(self.label_cell_size_value, 9, 1, 1, 1) self.gridLayout_goupbox_info.addWidget(self.label_cell_size_value, 10, 1, 1, 1)
self.label_pulse_length_value.clear() self.label_pulse_length_value.clear()
self.label_pulse_length_value.setText( self.label_pulse_length_value.setText(
str(round(stg.pulse_length[self.fileListWidget.currentRow()] str(round(stg.pulse_length[self.fileListWidget.currentRow()]
[self.combobox_frequency_information.currentIndex()], 6)) + " sec") [self.combobox_frequency_information.currentIndex()], 6)) + " sec")
self.gridLayout_goupbox_info.addWidget(self.label_pulse_length_value, 10, 1, 1, 1) self.gridLayout_goupbox_info.addWidget(self.label_pulse_length_value, 11, 1, 1, 1)
self.label_pings_per_sec_value.clear() self.label_pings_per_sec_value.clear()
self.label_pings_per_sec_value.setText(str(stg.nb_pings_per_sec[self.fileListWidget.currentRow()] self.label_pings_per_sec_value.setText(str(stg.nb_pings_per_sec[self.fileListWidget.currentRow()]
[self.combobox_frequency_information.currentIndex()]) + " Hz") [self.combobox_frequency_information.currentIndex()]) + " Hz")
self.gridLayout_goupbox_info.addWidget(self.label_pings_per_sec_value, 11, 1, 1, 1) self.gridLayout_goupbox_info.addWidget(self.label_pings_per_sec_value, 12, 1, 1, 1)
self.label_pings_per_profile_value.clear() self.label_pings_per_profile_value.clear()
self.label_pings_per_profile_value.setText( self.label_pings_per_profile_value.setText(
str(stg.nb_pings_averaged_per_profile[self.fileListWidget.currentRow()] str(stg.nb_pings_averaged_per_profile[self.fileListWidget.currentRow()]
[self.combobox_frequency_information.currentIndex()])) [self.combobox_frequency_information.currentIndex()]))
self.gridLayout_goupbox_info.addWidget(self.label_pings_per_profile_value, 12, 1, 1, 1) self.gridLayout_goupbox_info.addWidget(self.label_pings_per_profile_value, 13, 1, 1, 1)
print("stg.kt_corrected ", stg.kt_corrected)
self.spinbox_kt.clear() self.spinbox_kt.clear()
if self.checkbox_kt.isChecked(): if self.checkbox_kt.isChecked():
# print("combobox information update : checkbox checked") # print("combobox information update : checkbox checked")
@ -2422,20 +2474,23 @@ class AcousticDataTab(QWidget):
def kt_value(self): def kt_value(self):
# print(f"0 stg.kt_read : {stg.kt_read}") # print(f"0 stg.kt_read : {stg.kt_read}")
# print(f"0 stg.kt_corrected {stg.kt_corrected}") # print(f"0 stg.kt_corrected {stg.kt_corrected}")
if self.fileListWidget.count() > 0:
if self.checkbox_kt.isChecked(): if self.checkbox_kt.isChecked():
stg.kt_corrected[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()] = ( stg.kt_corrected[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()] \
self.spinbox_kt.value()) = self.spinbox_kt.value()
# print(f"1 stg.kt_read : {stg.kt_read}") # print(f"1 stg.kt_read : {stg.kt_read}")
# print(f"1 stg.kt_corrected {stg.kt_corrected}") # print(f"1 stg.kt_corrected {stg.kt_corrected}")
def gain_rx_value(self): def gain_rx_value(self):
stg.gain_rx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()] =\ if self.fileListWidget.count() > 0:
self.spinbox_rx.value() stg.gain_rx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()] = (
self.spinbox_rx.value())
# print(f"stg.rx : {stg.gain_rx}") # print(f"stg.rx : {stg.gain_rx}")
def gain_tx_value(self): def gain_tx_value(self):
stg.gain_tx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()] =\ if self.fileListWidget.count() > 0:
self.spinbox_tx.value() stg.gain_tx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()] = (
self.spinbox_tx.value())
# print(f"stg.tx : {stg.gain_tx}") # print(f"stg.tx : {stg.gain_tx}")
def fill_table(self): def fill_table(self):

File diff suppressed because it is too large Load Diff

View File

@ -474,6 +474,7 @@ class SedimentCalibrationTab(QWidget):
def function_pushbutton_update_acoustic_file(self): def function_pushbutton_update_acoustic_file(self):
self.update_acoustic_data() self.update_acoustic_data()
self.compute_depth_2D()
def function_pushbutton_plot_sample(self): def function_pushbutton_plot_sample(self):
self.sample_choice_for_calibration() self.sample_choice_for_calibration()
@ -507,19 +508,19 @@ class SedimentCalibrationTab(QWidget):
def plot_acoustic_recording(self): def plot_acoustic_recording(self):
# --- Record frequencies for calibration --- # --- Record frequencies for calibration ---
stg.frequencies_for_calibration[self.combobox_acoustic_data_choice.currentIndex()].clear() stg.frequencies_for_calibration.clear()
(stg.frequencies_for_calibration[self.combobox_acoustic_data_choice.currentIndex()]. stg.frequencies_for_calibration.append((stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
append((stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex()], self.combobox_freq1.currentIndex()],
self.combobox_freq1.currentIndex()))) self.combobox_freq1.currentIndex()))
(stg.frequencies_for_calibration[self.combobox_acoustic_data_choice.currentIndex()]. stg.frequencies_for_calibration.append((stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
append((stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex()], self.combobox_freq2.currentIndex()],
self.combobox_freq2.currentIndex())))
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()].clear()
stg.frequency_for_inversion[self.combobox_acoustic_data_choice.currentIndex()].append((
stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex()],
self.combobox_freq2.currentIndex())) self.combobox_freq2.currentIndex()))
stg.frequency_for_inversion = tuple()
stg.frequency_for_inversion = (stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex()],
self.combobox_freq2.currentIndex())
# --- Plot acoustic data recording --- # --- Plot acoustic data recording ---
self.verticalLayout_groupbox_data_plot.removeWidget(self.toolbar_BS) self.verticalLayout_groupbox_data_plot.removeWidget(self.toolbar_BS)
self.verticalLayout_groupbox_data_plot.removeWidget(self.canvas_BS) self.verticalLayout_groupbox_data_plot.removeWidget(self.canvas_BS)
@ -1154,6 +1155,78 @@ class SedimentCalibrationTab(QWidget):
self.spinbox_zeta_freq2.clear() self.spinbox_zeta_freq2.clear()
self.spinbox_zeta_freq2.setValue(float(data.iloc[4][1])) self.spinbox_zeta_freq2.setValue(float(data.iloc[4][1]))
def compute_depth_2D(self):
print("self.combobox_acoustic_data_choice.count() ", self.combobox_acoustic_data_choice.count())
if self.combobox_acoustic_data_choice.count() > 0:
for k in range(self.combobox_acoustic_data_choice.count()):
if stg.depth_cross_section[k].shape != (0,):
if stg.time_cross_section[k].shape != (0,):
stg.depth_2D[k] = (
np.zeros((stg.freq[k].shape[0],
stg.depth_cross_section[k].shape[1],
stg.time_cross_section[k].shape[1])))
for f, _ in enumerate(stg.freq[k]):
stg.depth_2D[k][f, :, :] = (
np.repeat(np.transpose(stg.depth_cross_section[k]
[self.combobox_freq1.currentIndex()])[:, np.newaxis],
stg.time_cross_section[k].shape[1],
axis=1))
elif stg.time[k].shape != (0,):
stg.depth_2D[k] = (
np.zeros((stg.freq[k].shape[0],
stg.depth_cross_section[k].shape[1],
stg.time[k].shape[1])))
for f, _ in enumerate(stg.freq[k]):
stg.depth_2D[k][f, :, :] = (
np.repeat(
np.transpose(stg.depth_cross_section[k]
[self.combobox_freq1.currentIndex()])[:, np.newaxis],
stg.time[k].shape[1],
axis=1))
elif stg.depth[k].shape != (0,):
if stg.time_cross_section[k].shape != (0,):
stg.depth_2D[k] = (
np.zeros((stg.freq[k].shape[0],
stg.depth[k].shape[1],
stg.time_cross_section[k].shape[1])))
for f, _ in enumerate(stg.freq[k]):
stg.depth_2D[k][f, :, :] = (
np.repeat(
np.transpose(stg.depth[k]
[self.combobox_freq1.currentIndex()])[:, np.newaxis],
stg.time_cross_section[k].shape[1],
axis=1))
elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.depth_2D[k] = (
np.zeros((stg.freq[k].shape[0],
stg.depth[k].shape[1],
stg.time[k].shape[1])))
for f, _ in enumerate(stg.freq[k]):
stg.depth_2D[k][f, :, :] = (
np.repeat(
np.transpose(stg.depth[k]
[self.combobox_freq1.currentIndex()])[:, np.newaxis],
stg.time[k].shape[1],
axis=1))
print("stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()].shape ",
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()].shape)
def function_pushbutton_compute_calibration(self): def function_pushbutton_compute_calibration(self):
# --- Compute frequency --- # --- Compute frequency ---
@ -1211,6 +1284,7 @@ class SedimentCalibrationTab(QWidget):
freq2=stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex()], freq2=stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex()],
sv_freq1=sv_freq1, sv_freq2=sv_freq2) sv_freq1=sv_freq1, sv_freq2=sv_freq2)
stg.X_exponent.clear()
stg.X_exponent.append(X_exponent) stg.X_exponent.append(X_exponent)
print(f"Exponent X = {X_exponent:.2f}\n") print(f"Exponent X = {X_exponent:.2f}\n")
@ -1224,20 +1298,20 @@ class SedimentCalibrationTab(QWidget):
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = ( # stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = (
np.zeros((stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], # np.zeros((stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0],
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], # stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1]))) # stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1])))
#
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): # for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]):
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] = ( # stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] = (
np.repeat(np.transpose(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()] # np.repeat(np.transpose(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()]
[self.combobox_freq1.currentIndex()])[:, np.newaxis], # [self.combobox_freq1.currentIndex()])[:, np.newaxis],
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], # stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)) # axis=1))
#
print("kt cor ", stg.kt_corrected) # print("kt cor ", stg.kt_corrected)
print("kt read", stg.kt_read) # print("kt read", stg.kt_read)
if (stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()] != if (stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()] !=
stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]): stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]):
@ -1270,18 +1344,18 @@ class SedimentCalibrationTab(QWidget):
elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = ( # stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = (
np.zeros((stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], # np.zeros((stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0],
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], # stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1]))) # stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1])))
#
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): # for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]):
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] = ( # stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] = (
np.repeat( # np.repeat(
np.transpose(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()] # np.transpose(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()]
[self.combobox_freq1.currentIndex()])[:, np.newaxis], # [self.combobox_freq1.currentIndex()])[:, np.newaxis],
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1], # stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)) # axis=1))
print("kt cor ", stg.kt_corrected) print("kt cor ", stg.kt_corrected)
print("kt read", stg.kt_read) print("kt read", stg.kt_read)
@ -1319,18 +1393,18 @@ class SedimentCalibrationTab(QWidget):
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = ( # stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = (
np.zeros((stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], # np.zeros((stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0],
stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1], # stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1]))) # stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1])))
#
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): # for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]):
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] = ( # stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] = (
np.repeat( # np.repeat(
np.transpose(stg.depth[self.combobox_acoustic_data_choice.currentIndex()] # np.transpose(stg.depth[self.combobox_acoustic_data_choice.currentIndex()]
[self.combobox_freq1.currentIndex()])[:, np.newaxis], # [self.combobox_freq1.currentIndex()])[:, np.newaxis],
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], # stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)) # axis=1))
print("kt cor ", stg.kt_corrected) print("kt cor ", stg.kt_corrected)
print("kt read", stg.kt_read) print("kt read", stg.kt_read)
@ -1366,18 +1440,18 @@ class SedimentCalibrationTab(QWidget):
elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = ( # stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = (
np.zeros((stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], # np.zeros((stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0],
stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1], # stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1]))) # stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1])))
#
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): # for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]):
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] = ( # stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] = (
np.repeat( # np.repeat(
np.transpose(stg.depth[self.combobox_acoustic_data_choice.currentIndex()] # np.transpose(stg.depth[self.combobox_acoustic_data_choice.currentIndex()]
[self.combobox_freq1.currentIndex()])[:, np.newaxis], # [self.combobox_freq1.currentIndex()])[:, np.newaxis],
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1], # stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)) # axis=1))
print("kt cor ", stg.kt_corrected) print("kt cor ", stg.kt_corrected)
print("kt read", stg.kt_read) print("kt read", stg.kt_read)
@ -1750,8 +1824,9 @@ class SedimentCalibrationTab(QWidget):
aquascat_cell_size = [] aquascat_cell_size = []
tau = [] tau = []
real_cell_size = [] real_cell_size = []
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()] = ( # stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()] = (
np.zeros(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape)) # np.zeros(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape))
stg.depth_real = np.zeros(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape)
for f in range(stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0]): for f in range(stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0]):
print("f = ", f) print("f = ", f)
@ -1769,9 +1844,11 @@ class SedimentCalibrationTab(QWidget):
real_cell_size.append(stg.water_velocity[self.combobox_acoustic_data_choice.currentIndex()] * tau[f] / 2) # voir fig 2.9 real_cell_size.append(stg.water_velocity[self.combobox_acoustic_data_choice.currentIndex()] * tau[f] / 2) # voir fig 2.9
# Converting to real cell profile # Converting to real cell profile
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()][f, :] = \ # stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()][f, :] = \
(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :] / # (stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :] /
aquascat_cell_size[f] * real_cell_size[f]) # (/ aquascat_cell_size) pour ramener BS.r entre 0 et 1 # aquascat_cell_size[f] * real_cell_size[f]) # (/ aquascat_cell_size) pour ramener BS.r entre 0 et 1
stg.depth_real[f, :] = (stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :]
/ aquascat_cell_size[f] * real_cell_size[f])
print("stg.depth_real ", stg.depth_real) print("stg.depth_real ", stg.depth_real)
# (* real_cell_size) pour remettre les échelles spatiales sur la taille réelle des cellules # (* real_cell_size) pour remettre les échelles spatiales sur la taille réelle des cellules
@ -1780,8 +1857,9 @@ class SedimentCalibrationTab(QWidget):
aquascat_cell_size = [] aquascat_cell_size = []
tau = [] tau = []
real_cell_size = [] real_cell_size = []
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()] = ( # stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()] = (
np.zeros(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape)) # np.zeros(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape))
stg.depth_real = (np.zeros(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape))
for f in range(stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0]): for f in range(stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0]):
@ -1797,28 +1875,36 @@ class SedimentCalibrationTab(QWidget):
real_cell_size.append(stg.water_velocity[self.combobox_acoustic_data_choice.currentIndex()] * tau[f] / 2) # voir fig 2.9 real_cell_size.append(stg.water_velocity[self.combobox_acoustic_data_choice.currentIndex()] * tau[f] / 2) # voir fig 2.9
# Converting to real cell profile # Converting to real cell profile
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()][f, :] = \ # stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()][f, :] = \
(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][f, :] / # (stg.depth[self.combobox_acoustic_data_choice.currentIndex()][f, :] /
aquascat_cell_size[f] * real_cell_size[f]) # (/ aquascat_cell_size) pour ramener BS.r entre 0 et 1 # aquascat_cell_size[f] * real_cell_size[f]) # (/ aquascat_cell_size) pour ramener BS.r entre 0 et 1
# (* real_cell_size) pour remettre les échelles spatiales sur la taille réelle des cellules # # (* real_cell_size) pour remettre les échelles spatiales sur la taille réelle des cellules
stg.depth_real[f, :] = (stg.depth[self.combobox_acoustic_data_choice.currentIndex()][f, :] /
aquascat_cell_size[f] * real_cell_size[f])
print("R_real 2D ", stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()].shape) print("R_real 2D ", stg.depth_real.shape)
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()] = ( # stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()] = (
np.repeat(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()][:, :, np.newaxis], # np.repeat(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()][:, :, np.newaxis],
# stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], axis=2))
stg.depth_real = \
(np.repeat(stg.depth_real[:, :, np.newaxis],
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], axis=2)) stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], axis=2))
print("R_real 3D ", stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()].shape) print("R_real 3D ", stg.depth_real.shape)
else: else:
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()] = ( # stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()] = (
np.repeat(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()][:, :, np.newaxis], # np.repeat(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()][:, :, np.newaxis],
# stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1], axis=2))
stg.depth_real = (
np.repeat(stg.depth_real[:, :, np.newaxis],
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1], axis=2)) stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1], axis=2))
print("R_real 3D ", stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()].shape) print("R_real 3D ", stg.depth_real.shape)
def compute_FCB(self): def compute_FCB(self):
# if stg.BS_stream_bed.size == 0: # if stg.BS_stream_bed.size == 0:
@ -1848,106 +1934,106 @@ class SedimentCalibrationTab(QWidget):
if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.FCB[self.combobox_acoustic_data_choice.currentIndex()] = \ stg.FCB = \
(np.log(stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()]) + (np.log(stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()]) +
np.log(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) + np.log(stg.depth_real) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][ 2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()] * self.combobox_frequency_FCB.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) stg.depth_real)
elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.FCB[self.combobox_acoustic_data_choice.currentIndex()] = \ stg.FCB = \
(np.log(stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()]) + (np.log(stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()]) +
np.log(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) + np.log(stg.depth_real) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][ 2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()] * self.combobox_frequency_FCB.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) stg.depth_real)
elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
print("zzzzzzzzzzzzzzzzzzzzz") print("zzzzzzzzzzzzzzzzzzzzz")
print(np.log(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()]).shape) print(np.log(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()]).shape)
print(np.log(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]).shape) print(np.log(stg.depth_real).shape)
print(stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()]) print(stg.water_attenuation)
print(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()].shape) print(stg.depth_real.shape)
print("zzzzzzzzzzzzzzzzzzzzz") print("zzzzzzzzzzzzzzzzzzzzz")
stg.FCB[self.combobox_acoustic_data_choice.currentIndex()] = \ stg.FCB = \
(np.log(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()]) + (np.log(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()]) +
np.log(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) + np.log(stg.depth_real) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][ 2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()] * self.combobox_frequency_FCB.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) stg.depth_real)
elif stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): elif stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.FCB[self.combobox_acoustic_data_choice.currentIndex()] = \ stg.FCB = \
(np.log(stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()]) + (np.log(stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()]) +
np.log(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) + np.log(stg.depth_real) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][ 2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()] * self.combobox_frequency_FCB.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) stg.depth_real)
elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.FCB[self.combobox_acoustic_data_choice.currentIndex()] = \ stg.FCB = \
(np.log(stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()]) + (np.log(stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()]) +
np.log(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) + np.log(stg.depth_real) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][ 2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()] * self.combobox_frequency_FCB.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) stg.depth_real)
elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
print("ttttttttttttttttttttttttt") print("ttttttttttttttttttttttttt")
print(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape) print(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape)
print(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()].shape) print(stg.depth_real.shape)
print(stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()]) print(stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()])
print(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()].shape) print(stg.depth_real.shape)
print("ttttttttttttttttttttttttt") print("ttttttttttttttttttttttttt")
stg.FCB[self.combobox_acoustic_data_choice.currentIndex()] = \ stg.FCB = \
(np.log(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()]) + (np.log(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()]) +
np.log(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) + np.log(stg.depth_real) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][ 2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()] * self.combobox_frequency_FCB.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) stg.depth_real)
elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.FCB[self.combobox_acoustic_data_choice.currentIndex()] = \ stg.FCB = \
(np.log(stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()]) + (np.log(stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()]) +
np.log(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) + np.log(stg.depth_real) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][ 2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()] * self.combobox_frequency_FCB.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) stg.depth_real)
elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.FCB[self.combobox_acoustic_data_choice.currentIndex()] = \ stg.FCB = \
(np.log(stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()]) + (np.log(stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()]) +
np.log(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) + np.log(stg.depth_real) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][ 2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()] * self.combobox_frequency_FCB.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) stg.depth_real)
elif BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): elif BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.FCB[self.combobox_acoustic_data_choice.currentIndex()] = \ stg.FCB = \
(np.log(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()]) + (np.log(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()]) +
np.log(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) + np.log(stg.depth_real) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][ 2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()] * self.combobox_frequency_FCB.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) stg.depth_real)
print("FCB ", stg.FCB[self.combobox_acoustic_data_choice.currentIndex()].shape) print("FCB ", stg.FCB.shape)
self.plot_FCB() self.plot_FCB()
def plot_FCB(self): def plot_FCB(self):
if stg.FCB[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): if stg.FCB.shape != (0,):
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
@ -1976,16 +2062,14 @@ class SedimentCalibrationTab(QWidget):
self.axis_FCB.plot( self.axis_FCB.plot(
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()], self.combobox_frequency_FCB.currentIndex()],
stg.FCB[self.combobox_acoustic_data_choice.currentIndex()][ stg.FCB[self.combobox_frequency_FCB.currentIndex(), :, self.slider_FCB.value() - 1],
self.combobox_frequency_FCB.currentIndex(), :, self.slider_FCB.value() - 1],
linestyle="solid", linewidth=1, color="k") linestyle="solid", linewidth=1, color="k")
else: else:
self.axis_FCB.plot( self.axis_FCB.plot(
stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()], self.combobox_frequency_FCB.currentIndex()],
stg.FCB[self.combobox_acoustic_data_choice.currentIndex()][ stg.FCB[self.combobox_frequency_FCB.currentIndex(), :, self.slider_FCB.value() - 1],
self.combobox_frequency_FCB.currentIndex(), :, self.slider_FCB.value() - 1],
linestyle="solid", linewidth=1, color="k") linestyle="solid", linewidth=1, color="k")
self.axis_FCB.text(.95, .05, self.axis_FCB.text(.95, .05,
@ -2009,7 +2093,7 @@ class SedimentCalibrationTab(QWidget):
def update_plot_FCB(self): def update_plot_FCB(self):
if stg.FCB[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): if stg.FCB.shape != (0,):
self.axis_FCB.cla() self.axis_FCB.cla()
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
@ -2017,8 +2101,7 @@ class SedimentCalibrationTab(QWidget):
self.axis_FCB.plot( self.axis_FCB.plot(
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()], self.combobox_frequency_FCB.currentIndex()],
stg.FCB[self.combobox_acoustic_data_choice.currentIndex()][ stg.FCB[self.combobox_frequency_FCB.currentIndex(), :, self.slider_FCB.value() - 1],
self.combobox_frequency_FCB.currentIndex(), :, self.slider_FCB.value() - 1],
linestyle="solid", linewidth=1, color="k") linestyle="solid", linewidth=1, color="k")
else: else:
@ -2026,8 +2109,7 @@ class SedimentCalibrationTab(QWidget):
self.axis_FCB.plot( self.axis_FCB.plot(
stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()], self.combobox_frequency_FCB.currentIndex()],
stg.FCB[self.combobox_acoustic_data_choice.currentIndex()][ stg.FCB[self.combobox_frequency_FCB.currentIndex(), :, self.slider_FCB.value() - 1],
self.combobox_frequency_FCB.currentIndex(), :, self.slider_FCB.value() - 1],
linestyle="solid", linewidth=1, color="k") linestyle="solid", linewidth=1, color="k")
self.axis_FCB.text(.95, .05, self.axis_FCB.text(.95, .05,
@ -2093,11 +2175,10 @@ class SedimentCalibrationTab(QWidget):
self.update_plot_FCB() self.update_plot_FCB()
if stg.FCB[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): if stg.FCB.shape != (0,):
# --- Identify FCB profile where value are not NaN --- # --- Identify FCB profile where value are not NaN ---
y0 = stg.FCB[self.combobox_acoustic_data_choice.currentIndex()][ y0 = stg.FCB[self.combobox_frequency_FCB.currentIndex(), :, self.slider_FCB.value() - 1]
self.combobox_frequency_FCB.currentIndex(), :, self.slider_FCB.value() - 1]
y = y0[np.where(np.isnan(y0) == False)] y = y0[np.where(np.isnan(y0) == False)]
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
@ -2118,17 +2199,17 @@ class SedimentCalibrationTab(QWidget):
lin_reg_compute = linregress(x[value1:value2], y[value1:value2]) lin_reg_compute = linregress(x[value1:value2], y[value1:value2])
print("lin_reg_compute ", lin_reg_compute) print("lin_reg_compute ", lin_reg_compute)
stg.lin_reg[self.combobox_acoustic_data_choice.currentIndex()] = (lin_reg_compute.slope, lin_reg_compute.intercept) stg.lin_reg = (lin_reg_compute.slope, lin_reg_compute.intercept)
print("stg.lin_reg ", stg.lin_reg) print("stg.lin_reg ", stg.lin_reg)
# --- Plot result of linear regression --- # --- Plot result of linear regression ---
self.axis_FCB.plot( self.axis_FCB.plot(
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex(), value1:value2], self.combobox_frequency_FCB.currentIndex(), value1:value2],
stg.lin_reg[self.combobox_acoustic_data_choice.currentIndex()][0] * stg.lin_reg[0] *
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex(), value1:value2] + self.combobox_frequency_FCB.currentIndex(), value1:value2] +
stg.lin_reg[self.combobox_acoustic_data_choice.currentIndex()][1], stg.lin_reg[1],
linestyle="dashed", linewidth=1, color="b") linestyle="dashed", linewidth=1, color="b")
else: else:
@ -2149,24 +2230,24 @@ class SedimentCalibrationTab(QWidget):
lin_reg_compute = linregress(x[value1:value2], y[value1:value2]) lin_reg_compute = linregress(x[value1:value2], y[value1:value2])
print("lin_reg_compute ", lin_reg_compute) print("lin_reg_compute ", lin_reg_compute)
stg.lin_reg[self.combobox_acoustic_data_choice.currentIndex()] = ( stg.lin_reg = (
lin_reg_compute.slope, lin_reg_compute.intercept) lin_reg_compute.slope, lin_reg_compute.intercept)
# --- Plot result of linear regression --- # --- Plot result of linear regression ---
self.axis_FCB.plot( self.axis_FCB.plot(
stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex(), value1:value2], self.combobox_frequency_FCB.currentIndex(), value1:value2],
stg.lin_reg[self.combobox_acoustic_data_choice.currentIndex()][0] * stg.lin_reg[0] *
stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex(), value1:value2] + self.combobox_frequency_FCB.currentIndex(), value1:value2] +
stg.lin_reg[self.combobox_acoustic_data_choice.currentIndex()][1], stg.lin_reg[1],
linestyle="dashed", linewidth=1, color="b") linestyle="dashed", linewidth=1, color="b")
self.fig_FCB.canvas.draw_idle() self.fig_FCB.canvas.draw_idle()
# --- Display the value of alphaS compute with FCB --- # --- Display the value of alphaS compute with FCB ---
self.label_alphaS_FCB.clear() self.label_alphaS_FCB.clear()
self.label_alphaS_FCB.setText(f"\u03B1s = {-0.5*stg.lin_reg[self.combobox_acoustic_data_choice.currentIndex()][0]:.4f} dB/m") self.label_alphaS_FCB.setText(f"\u03B1s = {-0.5*stg.lin_reg[0]:.4f} dB/m")
# if stg.FCB.size == 0: # if stg.FCB.size == 0:
# msgBox = QMessageBox() # msgBox = QMessageBox()

View File

@ -188,7 +188,7 @@ zeta = []
J_cross_section = [] J_cross_section = []
frequency_for_inversion = [] frequency_for_inversion = tuple()
SSC_fine = [] SSC_fine = []
SSC_sand = [] SSC_sand = []