mirror of
https://forgemia.inra.fr/theophile.terraz/acoused.git
synced 2026-10-30 03:10:40 +01:00
Acoustic inversion method for high concentration is implemented. It is tested with Aquascat data acquired during Adrien PhD (Confluence Rhône-Isère, 2018.01.07)
This commit is contained in:
1 parent
3dd6a4e310
commit
cb54fdd7ac
10 files changed
+1476
-212
No files matched your search
+762
-143
File diff suppressed because it is too large.
Load diff
+5
-5
@@ -200,12 +200,12 @@ class NoteTab(QWidget):
|
||||
f" Fine sediments data file: {stg.fine_sediment_path}/{stg.fine_sediment_filename} \n"
|
||||
f" Sand sediments data file: {stg.sand_sediment_path}/{stg.sand_sediment_filename} \n"
|
||||
"\n\n"
|
||||
"------------------------------------------------------------------------- \n\n\n"
|
||||
"------------------------------------------------------------------------- \n\n\n")
|
||||
|
||||
"Acoustic Inversion parameters: \n"
|
||||
f" frequencies to compute VBI: {stg.freq_text[int(stg.frequencies_to_compute_VBI[0, 0])]}, "
|
||||
f"{stg.freq_text[int(stg.frequencies_to_compute_VBI[1, 0])]} \n"
|
||||
f" frequency to compute SSC: {stg.freq_text[int(stg.frequency_to_compute_SSC[0])]}")
|
||||
# "Acoustic Inversion parameters: \n"
|
||||
# f" frequencies to compute VBI: {stg.freq_text[int(stg.frequencies_to_compute_VBI[0, 0])]}, "
|
||||
# f"{stg.freq_text[int(stg.frequencies_to_compute_VBI[1, 0])]} \n"
|
||||
# f" frequency to compute SSC: {stg.freq_text[int(stg.frequency_to_compute_SSC[0])]}")
|
||||
|
||||
|
||||
# if __name__ == "__main__":
|
||||
|
||||
+23
-7
@@ -773,7 +773,7 @@ class SampleDataTab(QWidget):
|
||||
|
||||
def plot_sample_position_on_transect(self):
|
||||
|
||||
if stg.BS_data.size == 0:
|
||||
if stg.BS_cross_section.size == 0:
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setWindowTitle("Plot transect Error")
|
||||
msgBox.setIcon(QMessageBox.Warning)
|
||||
@@ -968,7 +968,8 @@ class SampleDataTab(QWidget):
|
||||
else:
|
||||
indices = []
|
||||
for i in position_list:
|
||||
indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
# indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
indices.append(np.where(np.abs(stg.t - stg.sample_time[i]) == np.nanmin(np.abs(stg.t - stg.sample_time[i])))[0][0])
|
||||
self.axis_total_concentration.scatter(stg.Ctot_fine[position_list],
|
||||
-stg.sample_depth[position_list] / stg.r_bottom[indices],
|
||||
# np.max(stg.sample_depth[position_list]),
|
||||
@@ -1002,7 +1003,10 @@ class SampleDataTab(QWidget):
|
||||
else:
|
||||
indices = []
|
||||
for i in position_list:
|
||||
indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
# indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
indices.append(np.where(
|
||||
np.abs(stg.t - stg.sample_time[i]) == np.nanmin(np.abs(stg.t - stg.sample_time[i])))[0][
|
||||
0])
|
||||
self.axis_total_concentration.scatter(stg.Ctot_fine_per_cent[position_list],
|
||||
-stg.sample_depth[position_list] / stg.r_bottom[indices],
|
||||
# np.max(stg.sample_depth[position_list]),
|
||||
@@ -1050,7 +1054,10 @@ class SampleDataTab(QWidget):
|
||||
else:
|
||||
indices = []
|
||||
for i in position_list:
|
||||
indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
# indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
indices.append(np.where(
|
||||
np.abs(stg.t - stg.sample_time[i]) == np.nanmin(np.abs(stg.t - stg.sample_time[i])))[0][
|
||||
0])
|
||||
self.axis_total_concentration.scatter(stg.Ctot_sand[position_list],
|
||||
-stg.sample_depth[position_list] / stg.r_bottom[indices],
|
||||
# np.max(stg.sample_depth[position_list]),
|
||||
@@ -1084,7 +1091,10 @@ class SampleDataTab(QWidget):
|
||||
else:
|
||||
indices = []
|
||||
for i in position_list:
|
||||
indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
# indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
indices.append(np.where(
|
||||
np.abs(stg.t - stg.sample_time[i]) == np.nanmin(np.abs(stg.t - stg.sample_time[i])))[0][
|
||||
0])
|
||||
self.axis_total_concentration.scatter(stg.Ctot_sand_per_cent[position_list],
|
||||
-stg.sample_depth[position_list] / stg.r_bottom[indices],
|
||||
# np.max(stg.sample_depth[position_list]),
|
||||
@@ -1138,7 +1148,10 @@ class SampleDataTab(QWidget):
|
||||
else:
|
||||
indices = []
|
||||
for i in position_list:
|
||||
indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
# indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
indices.append(np.where(
|
||||
np.abs(stg.t - stg.sample_time[i]) == np.nanmin(np.abs(stg.t - stg.sample_time[i])))[0][
|
||||
0])
|
||||
self.axis_total_concentration.scatter(stg.Ctot_fine[position_list],
|
||||
-stg.sample_depth[position_list] / stg.r_bottom[indices], #np.max(stg.sample_depth[position_list]),
|
||||
s=100, facecolor=color_list, edgecolor="None", alpha=0.5)
|
||||
@@ -1180,7 +1193,10 @@ class SampleDataTab(QWidget):
|
||||
else:
|
||||
indices = []
|
||||
for i in position_list:
|
||||
indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
# indices.append(np.where(stg.t == stg.sample_time[i])[0][0])
|
||||
indices.append(np.where(
|
||||
np.abs(stg.t - stg.sample_time[i]) == np.nanmin(np.abs(stg.t - stg.sample_time[i])))[0][
|
||||
0])
|
||||
self.axis_total_concentration.scatter(stg.Ctot_fine_per_cent[position_list],
|
||||
-stg.sample_depth[position_list] / stg.r_bottom[indices], #np.max(stg.sample_depth[position_list]),
|
||||
s=100, facecolor=color_list, edgecolor="None", alpha=0.5)
|
||||
|
||||
@@ -633,9 +633,9 @@ class SignalProcessingTab(QWidget):
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
else:
|
||||
if stg.r_bottom.size == 0:
|
||||
stg.BS_stream_bed = deepcopy(stg.BS_cross_section)
|
||||
elif stg.r_bottom.size != 0:
|
||||
# if stg.r_bottom.size == 0:
|
||||
# stg.BS_stream_bed = deepcopy(stg.BS_cross_section)
|
||||
if stg.r_bottom.size != 0:
|
||||
stg.BS_stream_bed = deepcopy(stg.BS_cross_section)
|
||||
for f, _ in enumerate(stg.freq):
|
||||
for k, _ in enumerate(stg.r_bottom):
|
||||
@@ -757,50 +757,52 @@ class SignalProcessingTab(QWidget):
|
||||
else:
|
||||
|
||||
filter_convolve = np.ones(self.spinbox_average_horizontal.value())
|
||||
# print(filter_convolve)
|
||||
print(filter_convolve)
|
||||
|
||||
if stg.BS_stream_bed_SNR_filter.size != 0:
|
||||
|
||||
# stg.BS_stream_bed_averaged = np.zeros((stg.r.shape[0], stg.freq.shape[0], stg.t.shape[0]))
|
||||
# stg.BS_stream_bed_averaged = np.zeros((stg.freq.shape[0], stg.r.shape[1], stg.t.shape[1]))
|
||||
stg.BS_stream_bed_averaged = deepcopy(stg.BS_stream_bed_SNR_filter)
|
||||
# print(f"stg.BS_cross_section_averaged : {stg.BS_cross_section_averaged.shape}")
|
||||
print(f"1/ stg.BS_stream_bed_averaged : {stg.BS_stream_bed_averaged}")
|
||||
for f, _ in enumerate(stg.freq):
|
||||
for i in range(stg.r.shape[1]):
|
||||
stg.BS_stream_bed_averaged[f, i, :] \
|
||||
= convolve1d(stg.BS_stream_bed_SNR_filter[f, i, :], weights=filter_convolve)# / filter_convolve.shape[0]
|
||||
= convolve1d(stg.BS_stream_bed_SNR_filter[f, i, :], weights=filter_convolve) / len(filter_convolve)
|
||||
# stg.BS_stream_bed_averaged[i, f, :] \
|
||||
# = convolve1d(stg.BS_cross_section[i, f, :], weights=filter_convolve) / filter_convolve.shape[0]
|
||||
|
||||
elif stg.BS_cross_section_SNR_filter.size != 0:
|
||||
|
||||
stg.BS_cross_section_averaged = deepcopy(stg.BS_cross_section_SNR_filter)
|
||||
print(f"stg.BS_cross_section_averaged : {stg.BS_cross_section_averaged.shape}")
|
||||
print(f"2/ stg.BS_cross_section_averaged : {stg.BS_cross_section_averaged}")
|
||||
for f, _ in enumerate(stg.freq):
|
||||
for i in range(stg.r.shape[1]):
|
||||
stg.BS_stream_bed_averaged[f, i, :] \
|
||||
= convolve1d(stg.BS_cross_section_SNR_filter[f, i, :],
|
||||
weights=filter_convolve) # / filter_convolve.shape[0]
|
||||
weights=filter_convolve) / len(filter_convolve)
|
||||
|
||||
elif stg.BS_stream_bed.size != 0:
|
||||
|
||||
stg.BS_stream_bed_averaged = deepcopy(stg.BS_stream_bed)
|
||||
print(f"stg.BS_cross_section_averaged : {stg.BS_cross_section_averaged.shape}")
|
||||
print(f"3/ stg.BS_stream_bed_averaged : {stg.BS_stream_bed_averaged.shape}")
|
||||
print(stg.BS_stream_bed_averaged[0, 10, :50])
|
||||
for f, _ in enumerate(stg.freq):
|
||||
for i in range(stg.r.shape[1]):
|
||||
stg.BS_stream_bed_averaged[f, i, :] \
|
||||
= convolve1d(stg.BS_stream_bed[f, i, :],
|
||||
weights=filter_convolve) # / filter_convolve.shape[0]
|
||||
weights=filter_convolve) / len(filter_convolve)
|
||||
print(stg.BS_stream_bed_averaged[0, 10, :50])
|
||||
|
||||
elif stg.BS_cross_section.size != 0:
|
||||
|
||||
stg.BS_cross_section_averaged = deepcopy(stg.BS_cross_section)
|
||||
print(f"stg.BS_cross_section_averaged : {stg.BS_cross_section_averaged.shape}")
|
||||
print(f"4/ stg.BS_cross_section_averaged : {stg.BS_cross_section_averaged.shape}")
|
||||
for f, _ in enumerate(stg.freq):
|
||||
for i in range(stg.r.shape[1]):
|
||||
stg.BS_stream_bed_averaged[f, i, :] \
|
||||
stg.BS_cross_section_averaged[f, i, :] \
|
||||
= convolve1d(stg.BS_cross_section[f, i, :],
|
||||
weights=filter_convolve) # / filter_convolve.shape[0]
|
||||
weights=filter_convolve) / len(filter_convolve)
|
||||
|
||||
if stg.ABS_name == "Aquascat 1000R":
|
||||
self.label_cells_horizontal.clear()
|
||||
@@ -983,32 +985,42 @@ class SignalProcessingTab(QWidget):
|
||||
self.verticalLayout_groupbox_display_profile_position.addWidget(self.canvas_plot_profile_position_on_transect)
|
||||
|
||||
# --- Plot transect with profile position ---
|
||||
val_min = np.nanmin(stg.BS_stream_bed[stg.freq_bottom_detection, :, :])
|
||||
val_max = np.nanmax(stg.BS_stream_bed[stg.freq_bottom_detection, :, :])
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
|
||||
if stg.ABS_name == "Aquascat 1000R":
|
||||
if stg.BS_stream_bed.size != 0:
|
||||
|
||||
val_min = np.nanmin(stg.BS_stream_bed[stg.freq_bottom_detection, :, :])
|
||||
val_max = np.nanmax(stg.BS_stream_bed[stg.freq_bottom_detection, :, :])
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
|
||||
self.axis_plot_profile_position_on_transect.pcolormesh(
|
||||
stg.t[stg.freq_bottom_detection, :], -stg.r[stg.freq_bottom_detection, :],
|
||||
stg.BS_stream_bed[stg.freq_bottom_detection, :, :],
|
||||
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
||||
else:
|
||||
|
||||
val_min = np.nanmin(stg.BS_cross_section[stg.freq_bottom_detection, :, :])
|
||||
val_max = np.nanmax(stg.BS_cross_section[stg.freq_bottom_detection, :, :])
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
|
||||
self.axis_plot_profile_position_on_transect.pcolormesh(
|
||||
stg.t[stg.freq_bottom_detection, :], -stg.r[stg.freq_bottom_detection, :],
|
||||
stg.BS_cross_section[stg.freq_bottom_detection, :, :],
|
||||
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
||||
|
||||
elif stg.ABS_name == "UB-SediFlow":
|
||||
|
||||
if stg.BS_stream_bed.size != 0:
|
||||
self.axis_plot_profile_position_on_transect.pcolormesh(
|
||||
stg.t[stg.freq_bottom_detection, :], -stg.r[stg.freq_bottom_detection, :],
|
||||
np.log(stg.BS_cross_section[stg.freq_bottom_detection, :, :]),
|
||||
np.log(stg.BS_stream_bed[stg.freq_bottom_detection, :, :]),
|
||||
cmap='Blues')
|
||||
else:
|
||||
self.axis_plot_profile_position_on_transect.pcolormesh(
|
||||
stg.t[stg.freq_bottom_detection, :], -stg.r[stg.freq_bottom_detection, :],
|
||||
np.log(stg.BS_stream_bed[stg.freq_bottom_detection, :, :]),
|
||||
np.log(stg.BS_cross_section[stg.freq_bottom_detection, :, :]),
|
||||
cmap='Blues')
|
||||
|
||||
if stg.r_bottom.size != 0:
|
||||
@@ -1116,8 +1128,8 @@ class SignalProcessingTab(QWidget):
|
||||
|
||||
self.axis_plot_profile_position_on_transect.cla()
|
||||
|
||||
val_min = np.nanmin(stg.BS_stream_bed[self.combobox_frequency.currentIndex(), :, :])
|
||||
val_max = np.nanmax(stg.BS_stream_bed[self.combobox_frequency.currentIndex(), :, :])
|
||||
val_min = np.nanmin(stg.BS_cross_section[self.combobox_frequency.currentIndex(), :, :])
|
||||
val_max = np.nanmax(stg.BS_cross_section[self.combobox_frequency.currentIndex(), :, :])
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
|
||||
|
||||
Reference in new issue
Block a user