Compare commits

..

No commits in common. "4b6ee4af09473a6050a2ba7aac7a5446e1487e8b" and "0241f33109fcde34c65957dd7bbc009b84ecb1a0" have entirely different histories.

6 changed files with 561 additions and 228 deletions

View File

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

View File

@ -444,13 +444,15 @@ class AcousticInversionTab(QWidget):
self.pushbutton_plot_sand_sample_choice\ self.pushbutton_plot_sand_sample_choice\
.clicked.connect(self.plot_measured_vs_inverted_SSC_sand) .clicked.connect(self.plot_measured_vs_inverted_SSC_sand)
@trace @trace
def full_update(self): def full_update(self):
logger.debug(f"{__name__}: Update") logger.debug(f"{__name__}: Update")
self.blockSignals(True) self.blockSignals(True)
self.update_acoustic_data_choice() self.update_acoustic_data_choice()
self.function_run_inversion()
# TODO: Update all widgets
self.blockSignals(False) self.blockSignals(False)
@ -532,22 +534,32 @@ class AcousticInversionTab(QWidget):
) )
def compute_SSC_fine(self): def compute_SSC_fine(self):
data_id = self.combobox_acoustic_data_choice.currentIndex() stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SSC_fine[data_id] = np.array([]) stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()] = self.inv_hc.SSC_fine(
stg.SSC_fine[data_id] = self.inv_hc.SSC_fine(
zeta=stg.zeta[1], zeta=stg.zeta[1],
r2D=stg.depth_2D[data_id][stg.frequency_for_inversion[1]], r2D=stg.depth_2D[
VBI=stg.VBI_cross_section[data_id], self.combobox_acoustic_data_choice.currentIndex()
][
stg.frequency_for_inversion[1]
],
VBI=stg.VBI_cross_section[
self.combobox_acoustic_data_choice.currentIndex()
],
freq=stg.frequencies_for_calibration[1][0], freq=stg.frequencies_for_calibration[1][0],
X=stg.X_exponent[0], X=stg.X_exponent[0],
j_cross_section=stg.J_cross_section[data_id][1], j_cross_section=stg.J_cross_section[
self.combobox_acoustic_data_choice.currentIndex()
][1],
alpha_w=np.full( alpha_w=np.full(
shape=stg.depth_2D[data_id][ shape=stg.depth_2D[
self.combobox_acoustic_data_choice.currentIndex()
][
stg.frequency_for_inversion[1] stg.frequency_for_inversion[1]
].shape, ].shape,
fill_value=stg.water_attenuation[data_id][ fill_value=stg.water_attenuation[
self.combobox_acoustic_data_choice.currentIndex()
][
stg.frequency_for_inversion[1] stg.frequency_for_inversion[1]
] ]
) )
@ -915,6 +927,8 @@ class AcousticInversionTab(QWidget):
) )
) )
# --- Plot fine SSC : measured vs inverted ---
def fill_combobox_fine_sample(self): def fill_combobox_fine_sample(self):
data_id = self.combobox_acoustic_data_choice.currentIndex() data_id = self.combobox_acoustic_data_choice.currentIndex()
@ -1093,105 +1107,123 @@ class AcousticInversionTab(QWidget):
self.pcm_SSC_fine_meas_vs_inv.set_data( 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.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], [[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( 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.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], [[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 i in self.fine_sample_to_plot:
for t in stg.fine_sample_profile[0]: for t in stg.fine_sample_profile[0]:
if i == t: if i == t:
self.pcm_SSC_fine_meas_vs_inv_sample_calibration_text\ self.pcm_SSC_fine_meas_vs_inv_sample_calibration_text.set_text(stg.sample_fine[i][0])
.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_position(stg.time_fine[i], stg.depth_fine[i])
else: else:
self.pcm_SSC_fine_meas_vs_inv_text\ self.pcm_SSC_fine_meas_vs_inv_text.set_text(stg.sample_fine[i][0])
.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_position(stg.time_fine[i], stg.depth_fine[i])
self.figure_SSC_fine.canvas.draw_idle() self.figure_SSC_fine.canvas.draw_idle()
def plot_SSC_sand(self): def plot_SSC_sand(self):
data_id = self.combobox_acoustic_data_choice.currentIndex()
if self.combobox_acoustic_data_choice.count() <= 0: if self.combobox_acoustic_data_choice.count() > 0:
return
if stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()].shape == (0,):
self.verticalLayout_groupbox_plot_SSC_sand.removeWidget(self.toolbar_SSC_sand) self.verticalLayout_groupbox_plot_SSC_sand.removeWidget(self.toolbar_SSC_sand)
self.verticalLayout_groupbox_plot_SSC_sand.removeWidget(self.canvas_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.canvas_SSC_sand = FigureCanvas()
self.toolbar_SSC_sand = NavigationToolBar(self.canvas_SSC_sand, self) 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: else:
self.figure_SSC_sand, self.axis_SSC_sand = plt.subplots(
nrows=1, ncols=1, layout="constrained" 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.canvas_SSC_sand = FigureCanvas(self.figure_SSC_sand) self.canvas_SSC_sand = FigureCanvas(self.figure_SSC_sand)
self.toolbar_SSC_sand = NavigationToolBar(self.canvas_SSC_sand, self) 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.toolbar_SSC_sand)
self.verticalLayout_groupbox_plot_SSC_sand.addWidget(self.canvas_SSC_sand) self.verticalLayout_groupbox_plot_SSC_sand.addWidget(self.canvas_SSC_sand)
if stg.SSC_sand[data_id].shape != (0,): val_min = np.nanmin(stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()])
val_min = np.nanmin(stg.SSC_sand[data_id]) val_max = np.nanmax(stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()])
val_max = np.nanmax(stg.SSC_sand[data_id])
if stg.time_cross_section[data_id].shape != (0,): if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].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( pcm_SSC_sand = self.axis_SSC_sand.pcolormesh(
time_data[data_id][stg.frequency_for_inversion[1]], stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
-depth_data[data_id][stg.frequency_for_inversion[1]], stg.frequency_for_inversion[1]],
stg.SSC_sand[data_id], -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=10), stg.frequency_for_inversion[1]],
shading='gouraud' stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()],
) cmap='rainbow', norm=LogNorm(vmin=1e0, vmax=10), shading='gouraud')
if stg.depth_bottom[data_id].shape != (0,): if stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.axis_SSC_sand.plot( self.axis_SSC_sand.plot(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
time_data[data_id][stg.frequency_for_inversion[1]], stg.frequency_for_inversion[1]],
-stg.depth_bottom[data_id], -stg.depth_bottom[self.combobox_acoustic_data_choice.currentIndex()],
color='black', linewidth=1, linestyle="solid" color='black', linewidth=1, linestyle="solid")
)
self.pcm_SSC_sand_vertical_line, = self.axis_SSC_sand.plot( self.pcm_SSC_sand_vertical_line, = self.axis_SSC_sand.plot(
time_data[data_id][stg.frequency_for_inversion[1], stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.slider_sand.value() - 1] stg.frequency_for_inversion[1],
* np.ones( self.slider_sand.value() - 1] *
depth_data[data_id][stg.frequency_for_inversion[1]].shape np.ones(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
), stg.frequency_for_inversion[
-depth_data[data_id][stg.frequency_for_inversion[1]], 1]].shape),
linestyle="solid", color='r', linewidth=2 -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
) stg.frequency_for_inversion[1]],
linestyle="solid", color='r', linewidth=2)
self.plot_SSC_sand_fig, = self.axis_SSC_sand.plot( self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot(stg.time_sand, stg.depth_sand,
stg.time_sand, stg.depth_sand, ls=" ", marker="o", ms=5, mec="k", mfc="k")
ls=" ", marker="o", ms=5, mec="k", mfc="k"
) else:
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')
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")
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)
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")
# --- Plot samples of fine sediments --- # --- Plot samples of fine sediments ---
time_sand_temp = deepcopy(stg.time_sand) time_sand_temp = deepcopy(stg.time_sand)
depth_sand_temp = deepcopy(stg.depth_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]]) time_sand_temp.remove(stg.time_sand[s[1]])
depth_sand_temp.remove(stg.depth_sand[s[1]]) depth_sand_temp.remove(stg.depth_sand[s[1]])
self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot( self.pcm_SSC_sand_meas_vs_inv, = self.axis_SSC_sand.plot(
time_sand_temp, depth_sand_temp, time_sand_temp, depth_sand_temp, ls=" ", marker="o", ms=5, mec="k", mfc="k")
ls=" ", marker="o", ms=5, mec="k", mfc="k"
)
time_sand_temp = deepcopy(stg.time_sand) time_sand_temp = deepcopy(stg.time_sand)
depth_sand_temp = deepcopy(stg.depth_sand) depth_sand_temp = deepcopy(stg.depth_sand)
@ -1200,32 +1232,24 @@ class AcousticInversionTab(QWidget):
sample_sand_temp.remove(s) sample_sand_temp.remove(s)
time_sand_temp.remove(stg.time_sand[s[1]]) time_sand_temp.remove(stg.time_sand[s[1]])
depth_sand_temp.remove(stg.depth_sand[s[1]]) depth_sand_temp.remove(stg.depth_sand[s[1]])
for i in range(len(sample_sand_temp)): for i in range(len(sample_sand_temp)):
self.axis_SSC_sand.text( self.pcm_SSC_sand_meas_vs_inv_text = self.axis_SSC_sand.text(
time_sand_temp[i], time_sand_temp[i],
depth_sand_temp[i], depth_sand_temp[i], sample_sand_temp[i][0])
sample_sand_temp[i][0]
)
time_sand_temp, depth_sand_temp = stg.time_sand, stg.depth_sand time_sand_temp, depth_sand_temp = stg.time_sand, stg.depth_sand
self.axis_SSC_sand.plot( self.pcm_SSC_sand_meas_vs_inv_sample_calibration, = self.axis_SSC_sand.plot(
[time_sand_temp[s[1]] for s in stg.sand_sample_target], [time_sand_temp[s[1]] for s in stg.sand_sample_target],
[depth_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 time_sand_temp, depth_sand_temp = stg.time_sand, stg.depth_sand
for i, j in stg.sand_sample_target: for i, j in stg.sand_sample_target:
self.axis_SSC_sand.text( 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, time_sand_temp[j] + 5, depth_sand_temp[j] + 0.05, i, color='r', fontweight='bold')
color='r', fontweight='bold'
)
cbar_SSC_sand = self.figure_SSC_sand.colorbar( cbar_SSC_sand = self.figure_SSC_sand.colorbar(pcm_SSC_sand, ax=self.axis_SSC_sand, shrink=1,
pcm_SSC_sand, ax=self.axis_SSC_sand, shrink=1, location='right')
location='right'
)
cbar_SSC_sand.set_label(label='Sand SSC (g/L', rotation=270, labelpad=15) cbar_SSC_sand.set_label(label='Sand SSC (g/L', rotation=270, labelpad=15)
self.figure_SSC_sand.supxlabel("Time (sec)", fontsize=10) self.figure_SSC_sand.supxlabel("Time (sec)", fontsize=10)
@ -1734,6 +1758,7 @@ class AcousticInversionTab(QWidget):
else: else:
depth_data = stg.depth depth_data = stg.depth
t = np.repeat( t = np.repeat(
time_data[k][stg.frequency_for_inversion[1]], time_data[k][stg.frequency_for_inversion[1]],
depth_data[k].shape[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) + eval("self.ax" + str(i) + "[" + str(freq_ind) + "]" + ".text(1, .70, stg.freq_text[" + str(i) +
"][" + str(freq_ind) + "]," + "][" + str(freq_ind) + "]," +
"fontsize=10, fontweight='bold', fontname='DejaVu Sans', c='black', alpha=0.5," + "fontsize=10, fontweight='bold', fontname='Ubuntu', c='black', alpha=0.5," +
"horizontalalignment='right', verticalalignment='bottom'," + "horizontalalignment='right', verticalalignment='bottom'," +
"transform=self.ax" + str(i) + "[" + str(freq_ind) + "].transAxes)") "transform=self.ax" + str(i) + "[" + str(freq_ind) + "].transAxes)")
@ -91,3 +91,4 @@ class PlotNoiseWindow(QDialog):
exec("self.verticalLayout_tab" + str(i) + ".addWidget(self.toolbar" + str(i) + ")") exec("self.verticalLayout_tab" + str(i) + ".addWidget(self.toolbar" + str(i) + ")")
exec("self.verticalLayout_tab" + str(i) + ".addWidget(self.scroll" + 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( self.label_FCB_explanation_alphas_positive.setText(
"&alpha;<sub>s FCB</sub> &gt; 0 : comparison with calibration" "&alpha;<sub>s FCB</sub> &gt; 0 : comparison with calibration"
) )
self.label_FCB_explanation_alphas_positive.setFont(QFont('DejaVu Sans', 12)) self.label_FCB_explanation_alphas_positive.setFont(QFont('Ubuntu', 12))
self.gridLayout_groupbox_FCB_text_alphas.addWidget( self.gridLayout_groupbox_FCB_text_alphas.addWidget(
self.label_FCB_explanation_alphas_positive, self.label_FCB_explanation_alphas_positive,
0, 1, 1, 1, Qt.AlignLeft 0, 1, 1, 1, Qt.AlignLeft
@ -669,7 +669,7 @@ class SedimentCalibrationTab(QWidget):
self.label_FCB_explanation_alphas_negative.setText( self.label_FCB_explanation_alphas_negative.setText(
"&alpha;<sub>s FCB</sub> &lt; 0 : do not compare with calibration" "&alpha;<sub>s FCB</sub> &lt; 0 : do not compare with calibration"
) )
self.label_FCB_explanation_alphas_negative.setFont(QFont('DejaVu Sans', 12)) self.label_FCB_explanation_alphas_negative.setFont(QFont('Ubuntu', 12))
self.gridLayout_groupbox_FCB_text_alphas.addWidget( self.gridLayout_groupbox_FCB_text_alphas.addWidget(
self.label_FCB_explanation_alphas_negative, self.label_FCB_explanation_alphas_negative,
1, 1, 1, 1, Qt.AlignLeft 1, 1, 1, 1, Qt.AlignLeft
@ -736,7 +736,7 @@ class SedimentCalibrationTab(QWidget):
self.label_alphaS_FCB.setText( self.label_alphaS_FCB.setText(
"&alpha;<sub>s</sub> = " + "0.0" + "dB/m" "&alpha;<sub>s</sub> = " + "0.0" + "dB/m"
) )
self.label_alphaS_FCB.setFont(QFont("DejaVu Sans", 14, QFont.Normal)) self.label_alphaS_FCB.setFont(QFont("Ubuntu", 14, QFont.Normal))
self.gridLayout_groupbox_FCB_compute.addWidget( self.gridLayout_groupbox_FCB_compute.addWidget(
self.label_alphaS_FCB, 2, 4, 1, 2 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_freq1.setText(f"{stg.sv[0]:.5f}")
self.lineEdit_sv_freq2.setText(f"{stg.sv[1]:.5f}") self.lineEdit_sv_freq2.setText(f"{stg.sv[1]:.5f}")
self.lineEdit_X.setText(f"{stg.X_exponent[0]:.2f}") self.lineEdit_X.setText(f"{stg.X_exponent[0]:.5f}")
self.lineEdit_alphas_freq1.setText(f"{stg.alpha_s[0]:.5f}") self.lineEdit_alphas_freq1.setText(f"{stg.alpha_s[0]:.5f}")
self.lineEdit_alphas_freq2.setText(f"{stg.alpha_s[1]:.5f}") self.lineEdit_alphas_freq2.setText(f"{stg.alpha_s[1]:.5f}")
@ -1039,129 +1039,441 @@ class SedimentCalibrationTab(QWidget):
self.verticalLayout_groupbox_data_plot.addWidget(self.toolbar_BS) self.verticalLayout_groupbox_data_plot.addWidget(self.toolbar_BS)
self.verticalLayout_groupbox_data_plot.addWidget(self.canvas_BS) self.verticalLayout_groupbox_data_plot.addWidget(self.canvas_BS)
BS_data = None if stg.BS_stream_bed_pre_process_average[
time_data = None data_id
depth_data = None ].shape != (0,):
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,):
BS_data = stg.BS_stream_bed_pre_process_SNR
elif stg.BS_stream_bed[data_id].shape != (0,):
BS_data = stg.BS_stream_bed
elif stg.BS_cross_section_pre_process_average[data_id].shape != (0,):
BS_data = stg.BS_cross_section_pre_process_average
elif stg.BS_cross_section_pre_process_SNR[data_id].shape != (0,):
BS_data = stg.BS_cross_section_pre_process_SNR
elif stg.BS_raw_data_pre_process_average[data_id].shape != (0,):
BS_data = stg.BS_raw_data_pre_process_average
elif stg.BS_raw_data_pre_process_SNR[data_id].shape != (0,):
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( val_min = np.nanmin(
BS_data[data_id][freq2, :, :] stg.BS_stream_bed_pre_process_average[data_id][freq2, :, :]
) )
val_max = np.nanmax( val_max = np.nanmax(
BS_data[data_id][freq2, :, :] 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))
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))
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))
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))
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))
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: if val_min == 0:
val_min = 1e-5 val_min = 1e-5
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
time_data[data_id][freq2, :], stg.time[data_id][freq2, :],
-depth_data[data_id][freq2, :], -stg.depth[data_id][freq2, :],
BS_data[data_id][freq2, :, :], stg.BS_raw_data_pre_process_average[data_id][
norm=LogNorm(vmin=val_min, vmax=val_max), freq2, :, :],
cmap='viridis' cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
)
self.plot_acoustic_recording_samples()
def plot_acoustic_recording_samples(self):
data_id = self.combobox_acoustic_data_choice.currentIndex() elif stg.BS_raw_data_pre_process_SNR[data_id].shape != (0,):
freq1 = self.combobox_freq1.currentIndex()
freq2 = self.combobox_freq2.currentIndex() 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))
elif stg.BS_raw_data[data_id].shape != (0,):
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))
# --- Plot samples ---
if (stg.fine_sample_profile) or (stg.sand_sample_target): 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], [stg.depth_fine[f[1]] for f in stg.fine_sample_profile],
marker='o', s=20, facecolor="k", edgecolor="None" marker='o', s=20, facecolor="k", edgecolor="None")
) self.axis_BS.scatter([stg.time_sand[s[1]] for s in stg.sand_sample_target],
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], [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: for i in stg.fine_sample_profile:
self.axis_BS.text( self.axis_BS.text(stg.time_fine[i[1]] + 5, stg.depth_fine[i[1]] - .2, i[0],
stg.time_fine[i[1]] + 5, stg.depth_fine[i[1]] - .2, i[0], fontstyle="normal", fontweight="light", fontsize=8)
fontstyle="normal", fontweight="light", fontsize=8
)
for j in stg.sand_sample_target: for j in stg.sand_sample_target:
self.axis_BS.text( self.axis_BS.text(stg.time_sand[j[1]] - 12, stg.depth_sand[j[1]] - .2, j[0],
stg.time_sand[j[1]] - 12, stg.depth_sand[j[1]] - .2, j[0], fontstyle="normal", fontweight="light", fontsize=8)
fontstyle="normal", fontweight="light", fontsize=8
)
elif (stg.sample_fine) or (stg.sample_sand): elif (stg.sample_fine) or (stg.sample_sand):
self.axis_BS.scatter(
stg.time_fine, stg.depth_fine, self.axis_BS.scatter(stg.time_fine, stg.depth_fine, marker='o', s=20, facecolor="k", edgecolor="None")
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_sand, stg.depth_sand,
marker='o', s=50, facecolor="None", edgecolor="k"
)
for i in stg.sample_fine: for i in stg.sample_fine:
self.axis_BS.text( self.axis_BS.text(stg.time_fine[i[1]] + 5, stg.depth_fine[i[1]] - .2, i[0],
stg.time_fine[i[1]] + 5, stg.depth_fine[i[1]] - .2, i[0], fontstyle="normal", fontweight="light", fontsize=8)
fontstyle="normal", fontweight="light", fontsize=8
)
for j in stg.sample_sand: for j in stg.sample_sand:
self.axis_BS.text( self.axis_BS.text(stg.time_sand[j[1]] - 12, stg.depth_sand[j[1]] - .2, j[0],
stg.time_sand[j[1]] - 12, stg.depth_sand[j[1]] - .2, j[0], fontstyle="normal", fontweight="light", fontsize=8)
fontstyle="normal", fontweight="light", fontsize=8
)
# --- Plot vertical red line for position of FCB profile --- # --- Plot vertical red line for position of FCB profile ---
if stg.sand_sample_target_indice: if stg.sand_sample_target_indice:
if stg.depth_cross_section[data_id].shape != (0,): 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,): if stg.time_cross_section[data_id].shape != (0,):
time_data = stg.time_cross_section
else:
time_data = stg.time
self.red_line_plot_return, = ( self.red_line_plot_return, = (
self.axis_BS.plot( self.axis_BS.plot(
time_data[data_id][ stg.time_cross_section[data_id][
freq2, stg.sand_sample_target_indice[0][1] freq2, stg.sand_sample_target_indice[0][1]] *
] * np.ones(depth_data[data_id].shape[1]), np.ones(stg.depth_cross_section[data_id].shape[1]),
-depth_data[data_id][freq2, :], -stg.depth_cross_section[data_id][
color='red', linestyle="solid", linewidth=2 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_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))
self.axis_BS.set_xlabel("Time (sec)") self.axis_BS.set_xlabel("Time (sec)")
self.axis_BS.set_ylabel("Depth (m)") self.axis_BS.set_ylabel("Depth (m)")
@ -2310,7 +2622,7 @@ class SedimentCalibrationTab(QWidget):
self.axis_FCB.text(.95, .05, self.axis_FCB.text(.95, .05,
stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][ stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()], self.combobox_frequency_FCB.currentIndex()],
fontsize=10, fontweight='bold', fontname="DejaVu Sans", fontsize=10, fontweight='bold', fontname="Ubuntu",
fontstyle="normal", c="black", alpha=0.2, fontstyle="normal", c="black", alpha=0.2,
horizontalalignment='right', verticalalignment='bottom', horizontalalignment='right', verticalalignment='bottom',
transform=self.axis_FCB.transAxes) transform=self.axis_FCB.transAxes)
@ -2346,7 +2658,7 @@ class SedimentCalibrationTab(QWidget):
self.axis_FCB.text(.95, .05, self.axis_FCB.text(.95, .05,
stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][ stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()], self.combobox_frequency_FCB.currentIndex()],
fontsize=10, fontweight='bold', fontname="DejaVu Sans", fontsize=10, fontweight='bold', fontname="Ubuntu",
fontstyle="normal", c="black", alpha=0.2, fontstyle="normal", c="black", alpha=0.2,
horizontalalignment='right', verticalalignment='bottom', horizontalalignment='right', verticalalignment='bottom',
transform=self.axis_FCB.transAxes) transform=self.axis_FCB.transAxes)

View File

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

View File

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