Signal processing: Clear plots at redraw.
parent
ef8efd4f78
commit
583da806e4
|
|
@ -75,6 +75,7 @@ class SignalProcessingTab(QWidget):
|
|||
|
||||
|
||||
self._setup_icons()
|
||||
self._setup_attrs()
|
||||
|
||||
### --- General layout of widgets ---
|
||||
|
||||
|
|
@ -511,6 +512,13 @@ class SignalProcessingTab(QWidget):
|
|||
self.icon_clear = QIcon(path_icon("clear.png"))
|
||||
self.icon_apply = QIcon(path_icon("circle_green_arrow_right.png"))
|
||||
|
||||
def _setup_attrs(self):
|
||||
self.fig_profile_tail = None
|
||||
self.fig_noise = None
|
||||
self.fig_SNR = None
|
||||
self.fig_BS = None
|
||||
self.figure_profile = None
|
||||
|
||||
def full_update(self):
|
||||
logger.debug(f"{__name__}: Update")
|
||||
self.blockSignals(True)
|
||||
|
|
@ -782,46 +790,63 @@ class SignalProcessingTab(QWidget):
|
|||
msgBox.exec()
|
||||
|
||||
else:
|
||||
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||
freq_noise_id = self.combobox_freq_noise_from_profile_tail.currentIndex()
|
||||
|
||||
if stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
if stg.BS_mean[data_id].shape == (0,):
|
||||
return
|
||||
|
||||
self.verticalLayout_groupbox_plot_profile_tail.removeWidget(self.canvas_profile_tail)
|
||||
self.verticalLayout_groupbox_plot_profile_tail.removeWidget(self.canvas_profile_tail)
|
||||
|
||||
self.fig_profile_tail, self.axis_profile_tail = plt.subplots(nrows=1, ncols=1, layout='constrained')
|
||||
self.canvas_profile_tail = FigureCanvas(self.fig_profile_tail)
|
||||
if self.fig_profile_tail is not None:
|
||||
self.fig_profile_tail.clear()
|
||||
|
||||
self.verticalLayout_groupbox_plot_profile_tail.addWidget(self.canvas_profile_tail)
|
||||
self.fig_profile_tail, self.axis_profile_tail = \
|
||||
plt.subplots(nrows=1, ncols=1, layout='constrained')
|
||||
self.canvas_profile_tail = FigureCanvas(self.fig_profile_tail)
|
||||
|
||||
self.axis_profile_tail.plot(
|
||||
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq_noise_from_profile_tail.currentIndex()],
|
||||
stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq_noise_from_profile_tail.currentIndex()],
|
||||
color="blue", linewidth=1)
|
||||
self.axis_profile_tail.plot(
|
||||
-stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
self.combobox_freq_noise_from_profile_tail.currentIndex()],
|
||||
float(self.lineEdit_profile_tail_value.text().replace(",", ".")) *
|
||||
np.ones(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
self.combobox_freq_noise_from_profile_tail.currentIndex()].shape[0]),
|
||||
linestyle='dashed', linewidth=2, color='red')
|
||||
self.verticalLayout_groupbox_plot_profile_tail.addWidget(self.canvas_profile_tail)
|
||||
|
||||
self.axis_profile_tail.set_yscale('log')
|
||||
self.axis_profile_tail.tick_params(axis='both', labelsize=8)
|
||||
self.axis_profile_tail.text(.98, .03, "Depth (m)",
|
||||
fontsize=8, fontweight='bold', fontname="DejaVu Sans", c="black", alpha=0.9,
|
||||
horizontalalignment='right', verticalalignment='bottom', rotation='horizontal',
|
||||
transform=self.axis_profile_tail.transAxes)
|
||||
self.axis_profile_tail.text(.1, .45, "BS signal (v)",
|
||||
fontsize=8, fontweight='bold', fontname="DejaVu Sans", c="black", alpha=0.9,
|
||||
horizontalalignment='right', verticalalignment='bottom', rotation='vertical',
|
||||
transform=self.axis_profile_tail.transAxes)
|
||||
self.axis_profile_tail.text(.98, .85,
|
||||
stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
self.combobox_freq_noise_from_profile_tail.currentIndex()],
|
||||
fontsize=10, fontweight='bold', fontname="DejaVu Sans", c="black", alpha=0.5,
|
||||
horizontalalignment='right', verticalalignment='bottom',
|
||||
transform=self.axis_profile_tail.transAxes)
|
||||
self.axis_profile_tail.plot(
|
||||
-stg.depth[data_id][freq_noise_id],
|
||||
stg.BS_mean[data_id][freq_noise_id],
|
||||
color="blue", linewidth=1
|
||||
)
|
||||
self.axis_profile_tail.plot(
|
||||
-stg.depth[data_id][freq_noise_id],
|
||||
float(self.lineEdit_profile_tail_value.text().replace(",", "."))
|
||||
* np.ones(stg.depth[data_id][freq_noise_id].shape[0]),
|
||||
linestyle='dashed', linewidth=2, color='red'
|
||||
)
|
||||
|
||||
self.fig_profile_tail.canvas.draw_idle()
|
||||
self.axis_profile_tail.set_yscale('log')
|
||||
self.axis_profile_tail.tick_params(axis='both', labelsize=8)
|
||||
self.axis_profile_tail.text(
|
||||
.98, .03, "Depth (m)",
|
||||
fontsize=8, fontweight='bold',
|
||||
fontname="DejaVu Sans", c="black", alpha=0.9,
|
||||
horizontalalignment='right',
|
||||
verticalalignment='bottom', rotation='horizontal',
|
||||
transform=self.axis_profile_tail.transAxes
|
||||
)
|
||||
self.axis_profile_tail.text(
|
||||
.1, .45, "BS signal (v)",
|
||||
fontsize=8, fontweight='bold',
|
||||
fontname="DejaVu Sans", c="black", alpha=0.9,
|
||||
horizontalalignment='right',
|
||||
verticalalignment='bottom', rotation='vertical',
|
||||
transform=self.axis_profile_tail.transAxes
|
||||
)
|
||||
self.axis_profile_tail.text(
|
||||
.98, .85,
|
||||
stg.freq_text[data_id][freq_noise_id],
|
||||
fontsize=10, fontweight='bold',
|
||||
fontname="DejaVu Sans", c="black", alpha=0.5,
|
||||
horizontalalignment='right', verticalalignment='bottom',
|
||||
transform=self.axis_profile_tail.transAxes
|
||||
)
|
||||
|
||||
self.fig_profile_tail.canvas.draw_idle()
|
||||
|
||||
# ------------------------------------------------------
|
||||
|
||||
|
|
@ -1141,7 +1166,12 @@ class SignalProcessingTab(QWidget):
|
|||
def plot_noise(self):
|
||||
self.horizontalLayout_groupbox_plot_noise_data.removeWidget(self.canvas_noise)
|
||||
|
||||
self.fig_noise, self.axis_noise = plt.subplots(nrows=1, ncols=1, layout="constrained")
|
||||
if self.fig_noise is not None:
|
||||
self.fig_noise.clear()
|
||||
|
||||
self.fig_noise, self.axis_noise = plt.subplots(
|
||||
nrows=1, ncols=1, layout="constrained"
|
||||
)
|
||||
self.canvas_noise = FigureCanvas(self.fig_noise)
|
||||
|
||||
self.horizontalLayout_groupbox_plot_noise_data.addWidget(self.canvas_noise)
|
||||
|
|
@ -1189,6 +1219,9 @@ class SignalProcessingTab(QWidget):
|
|||
self.verticalLayout_groupbox_plot_SNR.removeWidget(self.toolbar_SNR)
|
||||
self.verticalLayout_groupbox_plot_SNR.removeWidget(self.scroll_SNR)
|
||||
|
||||
if self.fig_SNR is not None:
|
||||
self.fig_SNR.clear()
|
||||
|
||||
self.fig_SNR, self.axis_SNR = plt.subplots(
|
||||
nrows=stg.freq[data_id].shape[0], ncols=1,
|
||||
sharex=True, sharey=False, layout='constrained'
|
||||
|
|
@ -1369,6 +1402,9 @@ class SignalProcessingTab(QWidget):
|
|||
self.verticalLayout_groupbox_plot_pre_processed_data_2D_field\
|
||||
.removeWidget(self.scroll_BS)
|
||||
|
||||
if self.fig_BS is not None:
|
||||
self.fig_BS.clear()
|
||||
|
||||
self.fig_BS, self.axis_BS = plt.subplots(
|
||||
nrows=stg.freq[data_id].shape[0], ncols=1,
|
||||
sharex=True, sharey=False, layout="constrained"
|
||||
|
|
@ -1600,7 +1636,12 @@ class SignalProcessingTab(QWidget):
|
|||
self.verticalLayout_groupbox_plot_profile.removeWidget(self.toolbar_profile)
|
||||
self.verticalLayout_groupbox_plot_profile.removeWidget(self.canvas_profile)
|
||||
|
||||
self.figure_profile, self.axis_profile = plt.subplots(nrows=1, ncols=1, layout="constrained")
|
||||
if self.figure_profile is not None:
|
||||
self.figure_profile.clear()
|
||||
|
||||
self.figure_profile, self.axis_profile = plt.subplots(
|
||||
nrows=1, ncols=1, layout="constrained"
|
||||
)
|
||||
self.canvas_profile = FigureCanvas(self.figure_profile)
|
||||
self.toolbar_profile = NavigationToolBar(self.canvas_profile, self)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue