Compare commits

...

6 Commits

6 changed files with 227 additions and 560 deletions

View File

@ -71,12 +71,12 @@ class AboutWindow(QDialog):
self.label_acoused = QLabel()
self.label_acoused.setText("Acoused 2.0")
self.label_acoused.setFont(QFont("Ubuntu", 14))
self.label_acoused.setFont(QFont("DejaVu Sans", 14))
self.gridLayout.addWidget(self.label_acoused, 0, 1, 1, 1, Qt.AlignCenter)
self.label_date = QLabel()
self.label_date.setText("2025.01.01")
self.label_date.setFont(QFont("Ubuntu", 12))
self.label_date.setFont(QFont("DejaVu Sans", 12))
self.gridLayout.addWidget(self.label_date, 1, 1, 1, 1, Qt.AlignCenter)
self.label_logo_INRAE = QLabel()
@ -302,5 +302,3 @@ class Authors(QDialog):
# w = AboutWindow()
# w.show()
# sys.exit(app.exec_())

View File

@ -444,15 +444,13 @@ class AcousticInversionTab(QWidget):
self.pushbutton_plot_sand_sample_choice\
.clicked.connect(self.plot_measured_vs_inverted_SSC_sand)
@trace
def full_update(self):
logger.debug(f"{__name__}: Update")
self.blockSignals(True)
self.update_acoustic_data_choice()
# TODO: Update all widgets
self.function_run_inversion()
self.blockSignals(False)
@ -534,32 +532,22 @@ class AcousticInversionTab(QWidget):
)
def compute_SSC_fine(self):
stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
data_id = self.combobox_acoustic_data_choice.currentIndex()
stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()] = self.inv_hc.SSC_fine(
stg.SSC_fine[data_id] = np.array([])
stg.SSC_fine[data_id] = self.inv_hc.SSC_fine(
zeta=stg.zeta[1],
r2D=stg.depth_2D[
self.combobox_acoustic_data_choice.currentIndex()
][
stg.frequency_for_inversion[1]
],
VBI=stg.VBI_cross_section[
self.combobox_acoustic_data_choice.currentIndex()
],
r2D=stg.depth_2D[data_id][stg.frequency_for_inversion[1]],
VBI=stg.VBI_cross_section[data_id],
freq=stg.frequencies_for_calibration[1][0],
X=stg.X_exponent[0],
j_cross_section=stg.J_cross_section[
self.combobox_acoustic_data_choice.currentIndex()
][1],
j_cross_section=stg.J_cross_section[data_id][1],
alpha_w=np.full(
shape=stg.depth_2D[
self.combobox_acoustic_data_choice.currentIndex()
][
shape=stg.depth_2D[data_id][
stg.frequency_for_inversion[1]
].shape,
fill_value=stg.water_attenuation[
self.combobox_acoustic_data_choice.currentIndex()
][
fill_value=stg.water_attenuation[data_id][
stg.frequency_for_inversion[1]
]
)
@ -927,8 +915,6 @@ class AcousticInversionTab(QWidget):
)
)
# --- Plot fine SSC : measured vs inverted ---
def fill_combobox_fine_sample(self):
data_id = self.combobox_acoustic_data_choice.currentIndex()
@ -1107,123 +1093,105 @@ class AcousticInversionTab(QWidget):
self.pcm_SSC_fine_meas_vs_inv.set_data(
[[stg.time_fine.remove(s) for s in stg.fine_sample_profile[1]][i] for i in self.fine_sample_to_plot] ,
[[stg.depth_fine.remove(s) for s in stg.fine_sample_profile[1]][j] for j in self.fine_sample_to_plot],
ls=" ", marker="o", ms=5, mec="k", mfc="k")
ls=" ", marker="o", ms=5, mec="k", mfc="k"
)
self.pcm_SSC_fine_meas_vs_inv_sample_calibration.set_data(
[[stg.time_fine[s] for s in stg.fine_sample_profile[1]][i] for i in self.fine_sample_to_plot] ,
[[stg.depth_fine[s] for s in stg.fine_sample_profile[1]][j] for j in self.fine_sample_to_plot],
ls=" ", marker="*", ms=5, mec="r", mfc="r")
ls=" ", marker="*", ms=5, mec="r", mfc="r"
)
for i in self.fine_sample_to_plot:
for t in stg.fine_sample_profile[0]:
if i == t:
self.pcm_SSC_fine_meas_vs_inv_sample_calibration_text.set_text(stg.sample_fine[i][0])
self.pcm_SSC_fine_meas_vs_inv_sample_calibration_text.set_position(stg.time_fine[i], stg.depth_fine[i])
self.pcm_SSC_fine_meas_vs_inv_sample_calibration_text\
.set_text(stg.sample_fine[i][0])
self.pcm_SSC_fine_meas_vs_inv_sample_calibration_text\
.set_position(stg.time_fine[i], stg.depth_fine[i])
else:
self.pcm_SSC_fine_meas_vs_inv_text.set_text(stg.sample_fine[i][0])
self.pcm_SSC_fine_meas_vs_inv_text.set_position(stg.time_fine[i], stg.depth_fine[i])
self.pcm_SSC_fine_meas_vs_inv_text\
.set_text(stg.sample_fine[i][0])
self.pcm_SSC_fine_meas_vs_inv_text\
.set_position(stg.time_fine[i], stg.depth_fine[i])
self.figure_SSC_fine.canvas.draw_idle()
def plot_SSC_sand(self):
data_id = self.combobox_acoustic_data_choice.currentIndex()
if self.combobox_acoustic_data_choice.count() > 0:
if stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()].shape == (0,):
if self.combobox_acoustic_data_choice.count() <= 0:
return
self.verticalLayout_groupbox_plot_SSC_sand.removeWidget(self.toolbar_SSC_sand)
self.verticalLayout_groupbox_plot_SSC_sand.removeWidget(self.canvas_SSC_sand)
if stg.SSC_sand[data_id].shape == (0,):
self.canvas_SSC_sand = FigureCanvas()
self.toolbar_SSC_sand = NavigationToolBar(self.canvas_SSC_sand, self)
self.verticalLayout_groupbox_plot_SSC_sand.addWidget(self.toolbar_SSC_sand)
self.verticalLayout_groupbox_plot_SSC_sand.addWidget(self.canvas_SSC_sand)
else:
self.verticalLayout_groupbox_plot_SSC_sand.removeWidget(self.toolbar_SSC_sand)
self.verticalLayout_groupbox_plot_SSC_sand.removeWidget(self.canvas_SSC_sand)
self.figure_SSC_sand, self.axis_SSC_sand = plt.subplots(nrows=1, ncols=1, layout="constrained")
self.figure_SSC_sand, self.axis_SSC_sand = plt.subplots(
nrows=1, ncols=1, layout="constrained"
)
self.canvas_SSC_sand = FigureCanvas(self.figure_SSC_sand)
self.toolbar_SSC_sand = NavigationToolBar(self.canvas_SSC_sand, self)
self.verticalLayout_groupbox_plot_SSC_sand.addWidget(self.toolbar_SSC_sand)
self.verticalLayout_groupbox_plot_SSC_sand.addWidget(self.canvas_SSC_sand)
val_min = np.nanmin(stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()])
val_max = np.nanmax(stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()])
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
pcm_SSC_sand = self.axis_SSC_sand.pcolormesh(
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]],
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]],
stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()],
cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=10), shading='gouraud')
if stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.axis_SSC_sand.plot(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]],
-stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()],
color='black', linewidth=1, linestyle="solid")
self.pcm_SSC_sand_vertical_line, = self.axis_SSC_sand.plot(
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1],
self.slider_sand.value() - 1] *
np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[
1]].shape),
-stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]],
linestyle="solid", color='r', linewidth=2)
self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot(stg.time_sand, stg.depth_sand,
ls=" ", marker="o", ms=5, mec="k", mfc="k")
if stg.SSC_sand[data_id].shape != (0,):
val_min = np.nanmin(stg.SSC_sand[data_id])
val_max = np.nanmax(stg.SSC_sand[data_id])
if stg.time_cross_section[data_id].shape != (0,):
time_data = stg.time_cross_section
depth_data = stg.depth_cross_section
else:
time_data = stg.time
depth_data = stg.depth
pcm_SSC_sand = self.axis_SSC_sand.pcolormesh(
stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]],
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]],
stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()],
cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=10), shading='gouraud')
time_data[data_id][stg.frequency_for_inversion[1]],
-depth_data[data_id][stg.frequency_for_inversion[1]],
stg.SSC_sand[data_id],
cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=10),
shading='gouraud'
)
if stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.axis_SSC_sand.plot(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]],
-stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()],
color='black', linewidth=1, linestyle="solid")
if stg.depth_bottom[data_id].shape != (0,):
self.axis_SSC_sand.plot(
time_data[data_id][stg.frequency_for_inversion[1]],
-stg.depth_bottom[data_id],
color='black', linewidth=1, linestyle="solid"
)
self.pcm_SSC_sand_vertical_line, = self.axis_SSC_sand.plot(
stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1],
self.slider_sand.value() - 1] *
np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[
1]].shape),
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]],
linestyle="solid", color='r', linewidth=2)
time_data[data_id][stg.frequency_for_inversion[1],
self.slider_sand.value() - 1]
* np.ones(
depth_data[data_id][stg.frequency_for_inversion[1]].shape
),
-depth_data[data_id][stg.frequency_for_inversion[1]],
linestyle="solid", color='r', linewidth=2
)
self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot(stg.time_sand, stg.depth_sand,
ls=" ", marker="o", ms=5, mec="k", mfc="k")
self.plot_SSC_sand_fig, = self.axis_SSC_sand.plot(
stg.time_sand, stg.depth_sand,
ls=" ", marker="o", ms=5, mec="k", mfc="k"
)
# --- Plot samples of fine sediments ---
time_sand_temp = deepcopy(stg.time_sand)
depth_sand_temp = deepcopy(stg.depth_sand)
for s in stg.sand_sample_target:
for s in stg.sand_sample_target:
time_sand_temp.remove(stg.time_sand[s[1]])
depth_sand_temp.remove(stg.depth_sand[s[1]])
self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot(
time_sand_temp, depth_sand_temp, ls=" ", marker="o", ms=5, mec="k", mfc="k")
time_sand_temp, depth_sand_temp,
ls=" ", marker="o", ms=5, mec="k", mfc="k"
)
time_sand_temp = deepcopy(stg.time_sand)
depth_sand_temp = deepcopy(stg.depth_sand)
@ -1232,24 +1200,32 @@ class AcousticInversionTab(QWidget):
sample_sand_temp.remove(s)
time_sand_temp.remove(stg.time_sand[s[1]])
depth_sand_temp.remove(stg.depth_sand[s[1]])
for i in range(len(sample_sand_temp)):
self.pcm_SSC_sand_meas_vs_inv_text = self.axis_SSC_sand.text(
self.axis_SSC_sand.text(
time_sand_temp[i],
depth_sand_temp[i], sample_sand_temp[i][0])
depth_sand_temp[i],
sample_sand_temp[i][0]
)
time_sand_temp, depth_sand_temp = stg.time_sand, stg.depth_sand
self.pcm_SSC_sand_meas_vs_inv_sample_calibration, = self.axis_SSC_sand.plot(
self.axis_SSC_sand.plot(
[time_sand_temp[s[1]] for s in stg.sand_sample_target],
[depth_sand_temp[s[1]] for s in stg.sand_sample_target],
ls=" ", marker="*", ms=12, mec="r", mfc="r")
ls=" ", marker="*", ms=12, mec="r", mfc="r"
)
time_sand_temp, depth_sand_temp = stg.time_sand, stg.depth_sand
for i, j in stg.sand_sample_target:
self.pcm_SSC_sand_meas_vs_inv_sample_calibration_text = self.axis_SSC_sand.text(
time_sand_temp[j] + 5, depth_sand_temp[j] + 0.05, i, color='r', fontweight='bold')
self.axis_SSC_sand.text(
time_sand_temp[j] + 5, depth_sand_temp[j] + 0.05, i,
color='r', fontweight='bold'
)
cbar_SSC_sand = self.figure_SSC_sand.colorbar(pcm_SSC_sand, ax=self.axis_SSC_sand, shrink=1,
location='right')
cbar_SSC_sand = self.figure_SSC_sand.colorbar(
pcm_SSC_sand, ax=self.axis_SSC_sand, shrink=1,
location='right'
)
cbar_SSC_sand.set_label(label='Sand SSC (g/L', rotation=270, labelpad=15)
self.figure_SSC_sand.supxlabel("Time (sec)", fontsize=10)
@ -1758,7 +1734,6 @@ class AcousticInversionTab(QWidget):
else:
depth_data = stg.depth
t = np.repeat(
time_data[k][stg.frequency_for_inversion[1]],
depth_data[k].shape[1]

View File

@ -66,7 +66,7 @@ class PlotNoiseWindow(QDialog):
eval("self.ax" + str(i) + "[" + str(freq_ind) + "]" + ".text(1, .70, stg.freq_text[" + str(i) +
"][" + str(freq_ind) + "]," +
"fontsize=10, fontweight='bold', fontname='Ubuntu', c='black', alpha=0.5," +
"fontsize=10, fontweight='bold', fontname='DejaVu Sans', c='black', alpha=0.5," +
"horizontalalignment='right', verticalalignment='bottom'," +
"transform=self.ax" + str(i) + "[" + str(freq_ind) + "].transAxes)")
@ -91,4 +91,3 @@ class PlotNoiseWindow(QDialog):
exec("self.verticalLayout_tab" + str(i) + ".addWidget(self.toolbar" + str(i) + ")")
exec("self.verticalLayout_tab" + str(i) + ".addWidget(self.scroll" + str(i) + ")")

View File

@ -648,7 +648,7 @@ class SedimentCalibrationTab(QWidget):
self.label_FCB_explanation_alphas_positive.setText(
"&alpha;<sub>s FCB</sub> &gt; 0 : comparison with calibration"
)
self.label_FCB_explanation_alphas_positive.setFont(QFont('Ubuntu', 12))
self.label_FCB_explanation_alphas_positive.setFont(QFont('DejaVu Sans', 12))
self.gridLayout_groupbox_FCB_text_alphas.addWidget(
self.label_FCB_explanation_alphas_positive,
0, 1, 1, 1, Qt.AlignLeft
@ -669,7 +669,7 @@ class SedimentCalibrationTab(QWidget):
self.label_FCB_explanation_alphas_negative.setText(
"&alpha;<sub>s FCB</sub> &lt; 0 : do not compare with calibration"
)
self.label_FCB_explanation_alphas_negative.setFont(QFont('Ubuntu', 12))
self.label_FCB_explanation_alphas_negative.setFont(QFont('DejaVu Sans', 12))
self.gridLayout_groupbox_FCB_text_alphas.addWidget(
self.label_FCB_explanation_alphas_negative,
1, 1, 1, 1, Qt.AlignLeft
@ -736,7 +736,7 @@ class SedimentCalibrationTab(QWidget):
self.label_alphaS_FCB.setText(
"&alpha;<sub>s</sub> = " + "0.0" + "dB/m"
)
self.label_alphaS_FCB.setFont(QFont("Ubuntu", 14, QFont.Normal))
self.label_alphaS_FCB.setFont(QFont("DejaVu Sans", 14, QFont.Normal))
self.gridLayout_groupbox_FCB_compute.addWidget(
self.label_alphaS_FCB, 2, 4, 1, 2
)
@ -922,7 +922,7 @@ class SedimentCalibrationTab(QWidget):
self.lineEdit_sv_freq1.setText(f"{stg.sv[0]:.5f}")
self.lineEdit_sv_freq2.setText(f"{stg.sv[1]:.5f}")
self.lineEdit_X.setText(f"{stg.X_exponent[0]:.5f}")
self.lineEdit_X.setText(f"{stg.X_exponent[0]:.2f}")
self.lineEdit_alphas_freq1.setText(f"{stg.alpha_s[0]:.5f}")
self.lineEdit_alphas_freq2.setText(f"{stg.alpha_s[1]:.5f}")
@ -1039,441 +1039,129 @@ class SedimentCalibrationTab(QWidget):
self.verticalLayout_groupbox_data_plot.addWidget(self.toolbar_BS)
self.verticalLayout_groupbox_data_plot.addWidget(self.canvas_BS)
if stg.BS_stream_bed_pre_process_average[
data_id
].shape != (0,):
val_min = np.nanmin(
stg.BS_stream_bed_pre_process_average[data_id][freq2, :, :]
)
val_max = np.nanmax(
stg.BS_stream_bed_pre_process_average[data_id][freq2, :, :]
)
if val_min == 0:
val_min = 1e-5
if stg.time_cross_section[data_id].shape != (0,):
if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][freq2, :],
-stg.depth_cross_section[data_id][freq2, :],
stg.BS_stream_bed_pre_process_average[data_id][
freq2, :, :],
cmap='viridis',
norm=LogNorm(vmin=val_min, vmax=val_max)
)
else:
self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][
freq2, :],
-stg.depth[data_id][
freq2, :],
stg.BS_stream_bed_pre_process_average[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh(
stg.time[data_id][
freq2, :],
-stg.depth_cross_section[data_id][
freq2, :],
stg.BS_stream_bed_pre_process_average[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
self.axis_BS.pcolormesh(
stg.time[data_id][
freq2, :],
-stg.depth[data_id][
freq2, :],
stg.BS_stream_bed_pre_process_average[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
BS_data = None
time_data = None
depth_data = None
if stg.BS_stream_bed_pre_process_average[data_id].shape != (0,):
BS_data = stg.BS_stream_bed_pre_process_average
elif stg.BS_stream_bed_pre_process_SNR[data_id].shape != (0,):
val_min = np.nanmin(
stg.BS_stream_bed_pre_process_SNR[data_id][
freq2, :, :])
val_max = np.nanmax(
stg.BS_stream_bed_pre_process_SNR[data_id][
freq2, :, :])
if val_min == 0:
val_min = 1e-5
if stg.time_cross_section[data_id].shape != (0,):
if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][
freq2, :],
-stg.depth_cross_section[data_id][
freq2, :],
stg.BS_stream_bed_pre_process_SNR[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][
freq2, :],
-stg.depth[data_id][
freq2, :],
stg.BS_stream_bed_pre_process_SNR[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh(
stg.time[data_id][
freq2, :],
-stg.depth_cross_section[data_id][
freq2, :],
stg.BS_stream_bed_pre_process_SNR[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
self.axis_BS.pcolormesh(
stg.time[data_id][
freq2, :],
-stg.depth[data_id][
freq2, :],
stg.BS_stream_bed_pre_process_SNR[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
BS_data = stg.BS_stream_bed_pre_process_SNR
elif stg.BS_stream_bed[data_id].shape != (0,):
val_min = np.nanmin(
stg.BS_stream_bed[data_id][freq2,
:, :])
val_max = np.nanmax(
stg.BS_stream_bed[data_id][freq2,
:, :])
if val_min == 0:
val_min = 1e-5
if stg.time_cross_section[data_id].shape != (0,):
if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][
freq2, :],
-stg.depth_cross_section[data_id][
freq2, :],
stg.BS_stream_bed[data_id][freq2,
:, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][
freq2, :],
-stg.depth[data_id][
freq2, :],
stg.BS_stream_bed[data_id][freq2,
:, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh(
stg.time[data_id][
freq2, :],
-stg.depth_cross_section[data_id][
freq2, :],
stg.BS_stream_bed[data_id][freq2,
:, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
self.axis_BS.pcolormesh(
stg.time[data_id][
freq2, :],
-stg.depth[data_id][
freq2, :],
stg.BS_stream_bed[data_id][freq2,
:, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
BS_data = stg.BS_stream_bed
elif stg.BS_cross_section_pre_process_average[data_id].shape != (0,):
val_min = np.nanmin(
stg.BS_cross_section_pre_process_average[data_id][
freq2, :, :])
val_max = np.nanmax(
stg.BS_cross_section_pre_process_average[data_id][
freq2, :, :])
if val_min == 0:
val_min = 1e-5
if stg.time_cross_section[data_id].shape != (0,):
if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][
freq2, :],
-stg.depth_cross_section[data_id][
freq2, :],
stg.BS_cross_section_pre_process_average[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][
freq2, :],
-stg.depth[data_id][
freq2, :],
stg.BS_cross_section_pre_process_average[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh(
stg.time[data_id][
freq2, :],
-stg.depth_cross_section[data_id][
freq2, :],
stg.BS_cross_section_pre_process_average[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
self.axis_BS.pcolormesh(
stg.time[data_id][
freq2, :],
-stg.depth[data_id][
freq2, :],
stg.BS_cross_section_pre_process_average[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
BS_data = stg.BS_cross_section_pre_process_average
elif stg.BS_cross_section_pre_process_SNR[data_id].shape != (0,):
val_min = np.nanmin(
stg.BS_cross_section_pre_process_SNR[data_id][
freq2, :, :])
val_max = np.nanmax(
stg.BS_cross_section_pre_process_SNR[data_id][
freq2, :, :])
if val_min == 0:
val_min = 1e-5
if stg.time_cross_section[data_id].shape != (0,):
if stg.depth_cross_section[data_id].shape != (0):
self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][
freq2, :],
-stg.depth_cross_section[data_id][
freq2, :],
stg.BS_cross_section_pre_process_SNR[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][
freq2, :],
-stg.depth[data_id][
freq2, :],
stg.BS_cross_section_pre_process_SNR[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
if stg.depth_cross_section[data_id].shape != (0):
self.axis_BS.pcolormesh(
stg.time[data_id][
freq2, :],
-stg.depth_cross_section[data_id][
freq2, :],
stg.BS_cross_section_pre_process_SNR[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
self.axis_BS.pcolormesh(
stg.time[data_id][
freq2, :],
-stg.depth[data_id][
freq2, :],
stg.BS_cross_section_pre_process_SNR[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif stg.BS_cross_section[data_id].shape != (0,):
val_min = np.nanmin(
stg.BS_cross_section[data_id][
freq2, :, :])
val_max = np.nanmax(
stg.BS_cross_section[data_id][
freq2, :, :])
if val_min == 0:
val_min = 1e-5
if stg.time_cross_section[data_id].shape != (0,):
if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][
freq2, :],
-stg.depth_cross_section[data_id][
freq2, :],
stg.BS_cross_section[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][
freq2, :],
-stg.depth[data_id][
freq2, :],
stg.BS_cross_section[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh(
stg.time[data_id][
freq2, :],
-stg.depth_cross_section[data_id][
freq2, :],
stg.BS_cross_section[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else:
self.axis_BS.pcolormesh(
stg.time[data_id][
freq2, :],
-stg.depth[data_id][
freq2, :],
stg.BS_cross_section[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
BS_data = stg.BS_cross_section_pre_process_SNR
elif stg.BS_raw_data_pre_process_average[data_id].shape != (0,):
val_min = np.nanmin(stg.BS_raw_data_pre_process_average[data_id][
freq2, :, :])
val_max = np.nanmax(stg.BS_raw_data_pre_process_average[data_id][
freq2, :, :])
if val_min == 0:
val_min = 1e-5
self.axis_BS.pcolormesh(
stg.time[data_id][freq2, :],
-stg.depth[data_id][freq2, :],
stg.BS_raw_data_pre_process_average[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
BS_data = stg.BS_raw_data_pre_process_average
elif stg.BS_raw_data_pre_process_SNR[data_id].shape != (0,):
val_min = np.nanmin(stg.BS_raw_data_pre_process_SNR[data_id][
freq2, :, :])
val_max = np.nanmax(stg.BS_raw_data_pre_process_SNR[data_id][
freq2, :, :])
if val_min == 0:
val_min = 1e-5
self.axis_BS.pcolormesh(
stg.time[data_id][freq2, :],
-stg.depth[data_id][freq2, :],
stg.BS_raw_data_pre_process_SNR[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
BS_data = stg.BS_raw_data_pre_process_SNR
elif stg.BS_raw_data[data_id].shape != (0,):
BS_data = stg.BS_raw_data
if stg.time_cross_section[data_id].shape != (0,):
time_data = stg.time_cross_section
else:
time_data = stg.time
if stg.depth_cross_section[data_id].shape != (0,):
depth_data = stg.depth_cross_section
else:
depth_date = stg.depth
val_min = np.nanmin(
BS_data[data_id][freq2, :, :]
)
val_max = np.nanmax(
BS_data[data_id][freq2, :, :]
)
val_min = np.nanmin(stg.BS_raw_data[data_id][
freq2, :, :])
val_max = np.nanmax(stg.BS_raw_data[data_id][
freq2, :, :])
if val_min == 0:
val_min = 1e-5
self.axis_BS.pcolormesh(
stg.time[data_id][freq2, :],
-stg.depth[data_id][freq2, :],
stg.BS_raw_data[data_id][
freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
time_data[data_id][freq2, :],
-depth_data[data_id][freq2, :],
BS_data[data_id][freq2, :, :],
norm=LogNorm(vmin=val_min, vmax=val_max),
cmap='viridis'
)
# --- Plot samples ---
self.plot_acoustic_recording_samples()
def plot_acoustic_recording_samples(self):
data_id = self.combobox_acoustic_data_choice.currentIndex()
freq1 = self.combobox_freq1.currentIndex()
freq2 = self.combobox_freq2.currentIndex()
if (stg.fine_sample_profile) or (stg.sand_sample_target):
self.axis_BS.scatter([stg.time_fine[f[1]] for f in stg.fine_sample_profile],
self.axis_BS.scatter(
[stg.time_fine[f[1]] for f in stg.fine_sample_profile],
[stg.depth_fine[f[1]] for f in stg.fine_sample_profile],
marker='o', s=20, facecolor="k", edgecolor="None")
self.axis_BS.scatter([stg.time_sand[s[1]] for s in stg.sand_sample_target],
marker='o', s=20, facecolor="k", edgecolor="None"
)
self.axis_BS.scatter(
[stg.time_sand[s[1]] for s in stg.sand_sample_target],
[stg.depth_sand[s[1]] for s in stg.sand_sample_target],
marker='o', s=50, facecolor="None", edgecolor="k")
marker='o', s=50, facecolor="None", edgecolor="k"
)
for i in stg.fine_sample_profile:
self.axis_BS.text(stg.time_fine[i[1]] + 5, stg.depth_fine[i[1]] - .2, i[0],
fontstyle="normal", fontweight="light", fontsize=8)
self.axis_BS.text(
stg.time_fine[i[1]] + 5, stg.depth_fine[i[1]] - .2, i[0],
fontstyle="normal", fontweight="light", fontsize=8
)
for j in stg.sand_sample_target:
self.axis_BS.text(stg.time_sand[j[1]] - 12, stg.depth_sand[j[1]] - .2, j[0],
fontstyle="normal", fontweight="light", fontsize=8)
self.axis_BS.text(
stg.time_sand[j[1]] - 12, stg.depth_sand[j[1]] - .2, j[0],
fontstyle="normal", fontweight="light", fontsize=8
)
elif (stg.sample_fine) or (stg.sample_sand):
self.axis_BS.scatter(stg.time_fine, stg.depth_fine, marker='o', s=20, facecolor="k", edgecolor="None")
self.axis_BS.scatter(stg.time_sand, stg.depth_sand, marker='o', s=50, facecolor="None", edgecolor="k")
self.axis_BS.scatter(
stg.time_fine, stg.depth_fine,
marker='o', s=20, facecolor="k", edgecolor="None"
)
self.axis_BS.scatter(
stg.time_sand, stg.depth_sand,
marker='o', s=50, facecolor="None", edgecolor="k"
)
for i in stg.sample_fine:
self.axis_BS.text(stg.time_fine[i[1]] + 5, stg.depth_fine[i[1]] - .2, i[0],
fontstyle="normal", fontweight="light", fontsize=8)
self.axis_BS.text(
stg.time_fine[i[1]] + 5, stg.depth_fine[i[1]] - .2, i[0],
fontstyle="normal", fontweight="light", fontsize=8
)
for j in stg.sample_sand:
self.axis_BS.text(stg.time_sand[j[1]] - 12, stg.depth_sand[j[1]] - .2, j[0],
fontstyle="normal", fontweight="light", fontsize=8)
self.axis_BS.text(
stg.time_sand[j[1]] - 12, stg.depth_sand[j[1]] - .2, j[0],
fontstyle="normal", fontweight="light", fontsize=8
)
# --- Plot vertical red line for position of FCB profile ---
if stg.sand_sample_target_indice:
if stg.depth_cross_section[data_id].shape != (0,):
depth_data = stg.depth_cross_section
else:
depth_data = stg.depth
if stg.time_cross_section[data_id].shape != (0,):
self.red_line_plot_return, = (
self.axis_BS.plot(
stg.time_cross_section[data_id][
freq2, stg.sand_sample_target_indice[0][1]] *
np.ones(stg.depth_cross_section[data_id].shape[1]),
-stg.depth_cross_section[data_id][
freq2, :],
color='red', linestyle="solid", linewidth=2))
time_data = stg.time_cross_section
else:
time_data = stg.time
self.red_line_plot_return, = (
self.axis_BS.plot(
stg.time[data_id][
freq2, stg.sand_sample_target_indice[0][1]] *
np.ones(stg.depth_cross_section[data_id].shape[1]),
-stg.depth_cross_section[data_id][
freq2, :],
color='red', linestyle="solid", linewidth=2))
else:
if stg.time_cross_section[data_id].shape != (0,):
self.red_line_plot_return, = (
self.axis_BS.plot(
stg.time_cross_section[data_id][
freq2, stg.sand_sample_target_indice[0][1]] *
np.ones(stg.depth[data_id].shape[1]),
-stg.depth[data_id][freq2, :],
color='red', linestyle="solid", linewidth=2))
else:
self.red_line_plot_return, = (
self.axis_BS.plot(
stg.time[data_id][
freq2, stg.sand_sample_target_indice[0][1]] *
np.ones(stg.depth[data_id].shape[1]),
-stg.depth[data_id][freq2, :],
color='red', linestyle="solid", linewidth=2))
time_data[data_id][
freq2, stg.sand_sample_target_indice[0][1]
] * np.ones(depth_data[data_id].shape[1]),
-depth_data[data_id][freq2, :],
color='red', linestyle="solid", linewidth=2
)
)
self.axis_BS.set_xlabel("Time (sec)")
self.axis_BS.set_ylabel("Depth (m)")
@ -2622,7 +2310,7 @@ class SedimentCalibrationTab(QWidget):
self.axis_FCB.text(.95, .05,
stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()],
fontsize=10, fontweight='bold', fontname="Ubuntu",
fontsize=10, fontweight='bold', fontname="DejaVu Sans",
fontstyle="normal", c="black", alpha=0.2,
horizontalalignment='right', verticalalignment='bottom',
transform=self.axis_FCB.transAxes)
@ -2658,7 +2346,7 @@ class SedimentCalibrationTab(QWidget):
self.axis_FCB.text(.95, .05,
stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()],
fontsize=10, fontweight='bold', fontname="Ubuntu",
fontsize=10, fontweight='bold', fontname="DejaVu Sans",
fontstyle="normal", c="black", alpha=0.2,
horizontalalignment='right', verticalalignment='bottom',
transform=self.axis_FCB.transAxes)

View File

@ -1,3 +1,4 @@
import os
import sys
import logging
import traceback
@ -33,8 +34,12 @@ logging.basicConfig(
)
logger = logging.getLogger("acoused")
logger.setLevel(logging.DEBUG)
#logger.setLevel(logging.INFO)
if os.getenv("ACOUSED_DEBUG") == "true":
logger.setLevel(logging.DEBUG)
logger.debug("Set acoused at debug mode!")
else:
logger.setLevel(logging.INFO)
class MainApplication(QMainWindow):

View File

@ -1,3 +1,5 @@
@ECHO OFF
set ACOUSED_DEBUG=true
acoused.exe > error.txt 2>&1