Sediment calibration tab is updated with preprocessing tab. Calibration can be made with pre-processed data.

dev-brahim
brahim 2024-09-02 13:12:09 +02:00
parent 011cfd536e
commit 6e6991f0e5
1 changed files with 530 additions and 82 deletions

View File

@ -21,7 +21,7 @@ from scipy.stats import linregress
from View.checkable_combobox import CheckableComboBox from View.checkable_combobox import CheckableComboBox
from Model.acoustic_inversion_method_high_concentration import AcousticInversionMethodHighConcentration from Model.acoustic_inversion_method_high_concentration import AcousticInversionMethodHighConcentration
from settings import depth_cross_section from settings import depth_cross_section, BS_raw_data_pre_process_average, BS_raw_data_pre_process_SNR, BS_raw_data
class SedimentCalibrationTab(QWidget): class SedimentCalibrationTab(QWidget):
@ -391,7 +391,48 @@ class SedimentCalibrationTab(QWidget):
self.canvas_BS = FigureCanvas(self.fig_BS) self.canvas_BS = FigureCanvas(self.fig_BS)
self.verticalLayout_groupbox_acoustic_data.addWidget(self.canvas_BS) self.verticalLayout_groupbox_acoustic_data.addWidget(self.canvas_BS)
if stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
val_min = np.nanmin(
stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :])
val_max = np.nanmax(
stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :])
if val_min == 0:
val_min = 1e-5
self.axis_BS.pcolormesh(
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :],
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :],
stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
val_min = np.nanmin(
stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :])
val_max = np.nanmax(
stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :])
if val_min == 0:
val_min = 1e-5
self.axis_BS.pcolormesh(
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :],
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :],
stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
print("totototototototoott") print("totototototototoott")
val_min = np.nanmin( val_min = np.nanmin(
stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(),
@ -411,6 +452,46 @@ class SedimentCalibrationTab(QWidget):
:, :], :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
val_min = np.nanmin(
stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :])
val_max = np.nanmax(
stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :])
if val_min == 0:
val_min = 1e-5
self.axis_BS.pcolormesh(
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :],
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :],
stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
val_min = np.nanmin(
stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :])
val_max = np.nanmax(
stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :])
if val_min == 0:
val_min = 1e-5
self.axis_BS.pcolormesh(
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :],
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :],
stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
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,):
val_min = np.nanmin( val_min = np.nanmin(
@ -431,22 +512,52 @@ class SedimentCalibrationTab(QWidget):
self.combobox_freq2.currentIndex(), :, :], self.combobox_freq2.currentIndex(), :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): elif BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
val_min = np.nanmin( val_min = np.nanmin(stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :, self.combobox_freq2.currentIndex(), :, :])
:]) val_max = np.nanmax(stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
val_max = np.nanmax( self.combobox_freq2.currentIndex(), :, :])
stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :,
:])
if val_min == 0: if val_min == 0:
val_min = 1e-5 val_min = 1e-5
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :], stg.time[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :],
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :], -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :],
stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :, stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
:], self.combobox_freq2.currentIndex(), :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
val_min = np.nanmin(stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :])
val_max = np.nanmax(stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :])
if val_min == 0:
val_min = 1e-5
self.axis_BS.pcolormesh(
stg.time[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :],
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :],
stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
val_min = np.nanmin(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :])
val_max = np.nanmax(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :])
if val_min == 0:
val_min = 1e-5
self.axis_BS.pcolormesh(
stg.time[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :],
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :],
stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
# --- Plot samples --- # --- Plot samples ---
@ -855,11 +966,17 @@ class SedimentCalibrationTab(QWidget):
self.spinbox_X.clear() self.spinbox_X.clear()
self.spinbox_X.setValue(X_exponent) self.spinbox_X.setValue(X_exponent)
# --- Compute J --- # --- Compute kt2D, kt3D and depth_2D ---
if stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
if stg.depth_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.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape)) 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.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()]
@ -872,23 +989,242 @@ class SedimentCalibrationTab(QWidget):
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()]):
kt2D = np.repeat(np.array([stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
kt2D = np.repeat(
np.array([stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
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)
kt3D = np.repeat(kt2D[:, np.newaxis, :], kt3D = np.repeat(
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], axis=1) kt2D[:, np.newaxis, :],
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)
else: else:
kt2D = np.repeat(np.array([stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
kt2D = np.repeat(
np.array([stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
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(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape) print(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape)
print("kt2D shape ", kt2D.shape) print("kt2D shape ", kt2D.shape)
print("kt2D ", kt2D) print("kt2D ", kt2D)
kt3D = np.repeat(kt2D[:, np.newaxis, :], kt3D = np.repeat(
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], axis=1) kt2D[:, np.newaxis, :],
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)
print("kt3D shape ", kt3D.shape) print("kt3D shape ", kt3D.shape)
print("kt3D ", kt3D) print("kt3D ", kt3D)
elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = (
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.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1])))
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]):
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] = (
np.repeat(
np.transpose(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()]
[self.combobox_freq1.currentIndex()])[:, np.newaxis],
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1))
print("kt cor ", stg.kt_corrected)
print("kt read", stg.kt_read)
if (stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()] !=
stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]):
kt2D = np.repeat(
np.array([stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)
kt3D = np.repeat(
kt2D[:, np.newaxis, :],
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)
else:
kt2D = np.repeat(
np.array([stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)
print(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape)
print("kt2D shape ", kt2D.shape)
print("kt2D ", kt2D)
kt3D = np.repeat(
kt2D[:, np.newaxis, :],
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)
print("kt3D shape ", kt3D.shape)
print("kt3D ", kt3D)
elif stg.depth[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()] = (
np.zeros((stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0],
stg.depth[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()]):
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] = (
np.repeat(
np.transpose(stg.depth[self.combobox_acoustic_data_choice.currentIndex()]
[self.combobox_freq1.currentIndex()])[:, np.newaxis],
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1))
print("kt cor ", stg.kt_corrected)
print("kt read", stg.kt_read)
if (stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()] !=
stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]):
kt2D = np.repeat(
np.array([stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)
kt3D = np.repeat(
kt2D[:, np.newaxis, :],
stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)
else:
kt2D = np.repeat(
np.array([stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)
print(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape)
print("kt2D shape ", kt2D.shape)
print("kt2D ", kt2D)
kt3D = np.repeat(
kt2D[:, np.newaxis, :],
stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)
print("kt3D shape ", kt3D.shape)
print("kt3D ", kt3D)
elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = (
np.zeros((stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0],
stg.depth[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()]):
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] = (
np.repeat(
np.transpose(stg.depth[self.combobox_acoustic_data_choice.currentIndex()]
[self.combobox_freq1.currentIndex()])[:, np.newaxis],
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1))
print("kt cor ", stg.kt_corrected)
print("kt read", stg.kt_read)
if (stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()] !=
stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]):
kt2D = np.repeat(
np.array([stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)
kt3D = np.repeat(
kt2D[:, np.newaxis, :],
stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)
else:
kt2D = np.repeat(
np.array([stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)
print(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape)
print("kt2D shape ", kt2D.shape)
print("kt2D ", kt2D)
kt3D = np.repeat(
kt2D[:, np.newaxis, :],
stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)
print("kt3D shape ", kt3D.shape)
print("kt3D ", kt3D)
# --- Compute J ---
if stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
J_cross_section_freq1 = self.inv_hc.j_cross_section(
BS=stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq1.currentIndex(), :, :],
r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(),
:, :],
kt=kt3D[self.combobox_freq1.currentIndex(), :, :])
J_cross_section_freq2 = self.inv_hc.j_cross_section(
BS=stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :],
r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(),
:, :],
kt=kt3D[self.combobox_freq2.currentIndex(), :, :])
elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
J_cross_section_freq1 = self.inv_hc.j_cross_section(
BS=stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq1.currentIndex(), :, :],
r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(),
:, :],
kt=kt3D[self.combobox_freq1.currentIndex(), :, :])
J_cross_section_freq2 = self.inv_hc.j_cross_section(
BS=stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :],
r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(),
:, :],
kt=kt3D[self.combobox_freq2.currentIndex(), :, :])
elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
# stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = (
# np.zeros(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape))
# for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]):
# stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][f, :, :] = (
# np.repeat(np.transpose(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()]
# [self.combobox_freq1.currentIndex()])[:, np.newaxis],
# stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
# axis=1))
#
# print("kt cor ", stg.kt_corrected)
# print("kt read", stg.kt_read)
#
# if (stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()] !=
# stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]):
# kt2D = np.repeat(np.array([stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
# stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
# axis=1)
# kt3D = np.repeat(kt2D[:, np.newaxis, :],
# stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], axis=1)
# else:
# kt2D = np.repeat(np.array([stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]]).transpose(),
# stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
# axis=1)
# print(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape)
# print("kt2D shape ", kt2D.shape)
# print("kt2D ", kt2D)
# kt3D = np.repeat(kt2D[:, np.newaxis, :],
# stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], axis=1)
# print("kt3D shape ", kt3D.shape)
# print("kt3D ", kt3D)
J_cross_section_freq1 = self.inv_hc.j_cross_section( J_cross_section_freq1 = self.inv_hc.j_cross_section(
BS=stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(), :, :], BS=stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(), :, :],
r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(), :, :], r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(), :, :],
@ -900,28 +1236,60 @@ class SedimentCalibrationTab(QWidget):
r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :, :], r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(), :, :],
kt=kt3D[self.combobox_freq2.currentIndex(), :, :]) kt=kt3D[self.combobox_freq2.currentIndex(), :, :])
elif stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
J_cross_section_freq1 = self.inv_hc.j_cross_section(
BS=stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq1.currentIndex(), :, :],
r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(),
:, :],
kt=kt3D[self.combobox_freq1.currentIndex(), :, :])
J_cross_section_freq2 = self.inv_hc.j_cross_section(
BS=stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :],
r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(),
:, :],
kt=kt3D[self.combobox_freq2.currentIndex(), :, :])
elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
J_cross_section_freq1 = self.inv_hc.j_cross_section(
BS=stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq1.currentIndex(), :, :],
r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex(),
:, :],
kt=kt3D[self.combobox_freq1.currentIndex(), :, :])
J_cross_section_freq2 = self.inv_hc.j_cross_section(
BS=stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :],
r2D=stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(),
:, :],
kt=kt3D[self.combobox_freq2.currentIndex(), :, :])
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,):
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = np.zeros(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape) # stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()] = np.zeros(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape)
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, :, :] = np.repeat( # 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.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)
#
if stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]: # if stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]:
kt2D = np.repeat(np.array(stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]), # kt2D = np.repeat(np.array(stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]),
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], # stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1) # axis=1)
kt3D = np.repeat(kt2D[:, :, np.newaxis], # kt3D = np.repeat(kt2D[:, :, np.newaxis],
stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2) # stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2)
else: # else:
kt2D = np.repeat(np.array(stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]), # kt2D = np.repeat(np.array(stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]),
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], # stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1) # axis=1)
kt3D = np.repeat(kt2D[:, :, np.newaxis], # kt3D = np.repeat(kt2D[:, :, np.newaxis],
stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2) # stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2)
J_cross_section_freq1 = self.inv_hc.j_cross_section( J_cross_section_freq1 = self.inv_hc.j_cross_section(
BS=stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ BS=stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
@ -935,28 +1303,56 @@ class SedimentCalibrationTab(QWidget):
r2D=stg.depth_2D[self.combobox_freq2.currentIndex(), :, :][self.combobox_freq2.currentIndex(), :, :], r2D=stg.depth_2D[self.combobox_freq2.currentIndex(), :, :][self.combobox_freq2.currentIndex(), :, :],
kt=kt3D[self.combobox_freq2.currentIndex(), :, :]) kt=kt3D[self.combobox_freq2.currentIndex(), :, :])
else: elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.depth_2D = np.zeros(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape) J_cross_section_freq1 = self.inv_hc.j_cross_section(
for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]): BS=stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
stg.depth_2D[f, :, :] = np.repeat( self.combobox_freq1.currentIndex(), :, :],
np.transpose(stg.depth[self.combobox_acoustic_data_choice.currentIndex()] r2D=stg.depth_2D[self.combobox_freq1.currentIndex(), :, :],
[self.combobox_freq1.currentIndex()])[:, np.newaxis], kt=kt3D[self.combobox_freq1.currentIndex(), :, :])
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
axis=1)
if stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]: J_cross_section_freq2 = self.inv_hc.j_cross_section(
kt2D = np.repeat(np.array(stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]), BS=stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1], self.combobox_freq2.currentIndex(), :, :],
axis=1) r2D=stg.depth_2D[self.combobox_freq2.currentIndex(), :, :],
kt3D = np.repeat(kt2D[:, :, np.newaxis], kt=kt3D[self.combobox_freq2.currentIndex(), :, :])
stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2)
else: elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
kt2D = np.repeat(np.array(stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]),
stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1], J_cross_section_freq1 = self.inv_hc.j_cross_section(
axis=1) BS=stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
kt3D = np.repeat(kt2D[:, :, np.newaxis], self.combobox_freq1.currentIndex(), :, :],
stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2) r2D=stg.depth_2D[self.combobox_freq1.currentIndex(), :, :],
kt=kt3D[self.combobox_freq1.currentIndex(), :, :])
J_cross_section_freq2 = self.inv_hc.j_cross_section(
BS=stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), :, :],
r2D=stg.depth_2D[self.combobox_freq2.currentIndex(), :, :],
kt=kt3D[self.combobox_freq2.currentIndex(), :, :])
elif stg.BS_raw_data:
# stg.depth_2D = np.zeros(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape)
# for f, _ in enumerate(stg.freq[self.combobox_acoustic_data_choice.currentIndex()]):
# stg.depth_2D[f, :, :] = np.repeat(
# np.transpose(stg.depth[self.combobox_acoustic_data_choice.currentIndex()]
# [self.combobox_freq1.currentIndex()])[:, np.newaxis],
# stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
# axis=1)
#
# if stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]:
# kt2D = np.repeat(np.array(stg.kt_corrected[self.combobox_acoustic_data_choice.currentIndex()]),
# stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
# axis=1)
# kt3D = np.repeat(kt2D[:, :, np.newaxis],
# stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2)
# else:
# kt2D = np.repeat(np.array(stg.kt_read[self.combobox_acoustic_data_choice.currentIndex()]),
# stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape[1],
# axis=1)
# kt3D = np.repeat(kt2D[:, :, np.newaxis],
# stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0], axis=2)
J_cross_section_freq1 = self.inv_hc.j_cross_section( J_cross_section_freq1 = self.inv_hc.j_cross_section(
BS=stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][ BS=stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][
@ -1161,7 +1557,25 @@ class SedimentCalibrationTab(QWidget):
self.range_cells_function() self.range_cells_function()
if stg.BS_stream_bed[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()] = \
(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()]) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()])
elif stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.FCB[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()]) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()])
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)
@ -1176,6 +1590,22 @@ class SedimentCalibrationTab(QWidget):
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_frequency_FCB.currentIndex()] * 2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_frequency_FCB.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()])
elif stg.BS_cross_section_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.FCB[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()]) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()])
elif stg.BS_cross_section_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.FCB[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()]) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()])
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,):
stg.FCB[self.combobox_acoustic_data_choice.currentIndex()] = \ stg.FCB[self.combobox_acoustic_data_choice.currentIndex()] = \
@ -1183,7 +1613,24 @@ class SedimentCalibrationTab(QWidget):
np.log(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) + np.log(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()] * 2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()]) stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()])
else:
elif stg.BS_raw_data_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.FCB[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()]) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()])
elif stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.FCB[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()]) +
2 * stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()] *
stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()])
elif BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.FCB[self.combobox_acoustic_data_choice.currentIndex()] = \ stg.FCB[self.combobox_acoustic_data_choice.currentIndex()] = \
(np.log(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()]) + (np.log(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()]) +
@ -1502,3 +1949,4 @@ class SedimentCalibrationTab(QWidget):
def update_lineEdit_by_moving_slider_FCB(self): def update_lineEdit_by_moving_slider_FCB(self):
self.lineEdit_slider_FCB.setText(str(self.slider_FCB.value())) self.lineEdit_slider_FCB.setText(str(self.slider_FCB.value()))