Compare commits

..

No commits in common. "2dc6bb5f3f6e24a60e8c29932d99e8ddcbad2402" and "24f270a2a479696a00240d7b9479f9125518f82e" have entirely different histories.

7 changed files with 52 additions and 159 deletions

View File

@ -560,6 +560,7 @@ class ReadTableForOpen:
+ list(stg.radius_grain_sand)
)
@trace
def read_table_table_sediment_data(self):
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
@ -617,6 +618,7 @@ class ReadTableForOpen:
logger.debug(f"fine: {stg.Ctot_fine}, sand: {stg.sample_sand}")
@trace
def read_table_table_calibration_parameters(self):
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
@ -679,6 +681,7 @@ class ReadTableForOpen:
)
)
@trace
def read_table_table_calibration(self):
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
@ -711,6 +714,7 @@ class ReadTableForOpen:
stg.depth_real = np_f64_parse(next(it)).tolist()
stg.lin_reg = np_f64_parse(next(it)).tolist()
@trace
def read_table_table_notes(self):
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)

View File

@ -81,7 +81,6 @@ class AcousticDataTab(QWidget):
super().__init__()
self._setup_icons()
self._setup_attrs()
self.calib_kt = CalibrationConstantKt()
@ -732,12 +731,10 @@ class AcousticDataTab(QWidget):
self.icon_between = QPixmap(path_icon("between.png"))
self.icon_refresh = QIcon(path_icon("update.png"))
def _setup_attrs(self):
self.fig_profile = None
self.fig_BS = None
# -------------------- Functions for Acoustic dataTab --------------------
@trace
def full_update(self):
logger.debug(f"{__name__}: Update")
self.blockSignals(True)
@ -1396,7 +1393,6 @@ class AcousticDataTab(QWidget):
self.open_acoustic_data()
@trace
def open_acoustic_data(self):
# --- Fill lineEdit with path and file names + load acoustic data ---
# --- fill date, hour and measurements information + fill frequency combobox for bottom detection ---
@ -2383,9 +2379,6 @@ class AcousticDataTab(QWidget):
layout.removeWidget(self.toolbar_BS)
layout.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[file_id].shape[0],
ncols=1, sharex=False, sharey=False,
@ -2472,9 +2465,6 @@ class AcousticDataTab(QWidget):
return
if len(self.axis_BS.tolist()) != stg.freq[data_id].shape[0]:
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,
@ -2563,9 +2553,6 @@ class AcousticDataTab(QWidget):
self.verticalLayout_groupbox_plot_profile.removeWidget(self.canvas_plot_profile)
# --- Figure to plot profiles ---
if self.fig_profile is not None:
self.fig_profile.clear()
self.fig_profile, self.axis_profile = plt.subplots(nrows=1, ncols=1, layout="constrained")
self.canvas_plot_profile = FigureCanvas(self.fig_profile)
self.toolbar_profile = NavigationToolBar(self.canvas_plot_profile, self)
@ -2880,9 +2867,10 @@ class AcousticDataTab(QWidget):
break
else:
ind_bottom = np.where(
(BS_smooth[ind_min:ind_max, d]) == val_bottom[d]
(BS_smooth[ind_min:ind_max, d])
== val_bottom[d]
)[0][0]
# np.append(stg.ind_bottom, ind_bottom)
np.append(stg.ind_bottom, ind_bottom)
r_bottom[d] = depth_data[data_id][
freq_id, ind_bottom + ind_min

View File

@ -64,7 +64,6 @@ class AcousticInversionTab(QWidget):
self.inv_hc = AcousticInversionMethodHighConcentration()
self._setup_icons()
self._setup_attrs()
self._setup_general_layout(widget_tab)
self._setup_connections()
@ -445,14 +444,7 @@ class AcousticInversionTab(QWidget):
self.pushbutton_plot_sand_sample_choice\
.clicked.connect(self.plot_measured_vs_inverted_SSC_sand)
def _setup_attrs(self):
self.figure_SSC_fine = None
self.figure_SSC_sand = None
self.figure_vertical_profile_SSC_fine = None
self.figure_vertical_profile_SSC_sand = None
self.figure_measured_vs_inverted_fine = None
self.figure_measured_vs_inverted_sand = None
@trace
def full_update(self):
logger.debug(f"{__name__}: Update")
self.blockSignals(True)
@ -593,9 +585,6 @@ class AcousticInversionTab(QWidget):
self.verticalLayout_groupbox_plot_SSC_fine.removeWidget(self.toolbar_SSC_fine)
self.verticalLayout_groupbox_plot_SSC_fine.removeWidget(self.canvas_SSC_fine)
if self.figure_SSC_fine is not None:
self.figure_SSC_fine.clear()
self.figure_SSC_fine, self.axis_SSC_fine = plt.subplots(
nrows=1, ncols=1, layout="constrained"
)
@ -721,9 +710,6 @@ class AcousticInversionTab(QWidget):
self.verticalLayout_groupbox_plot_vertical_profile_fine\
.removeWidget(self.canvas_profile_fine)
if self.figure_vertical_profile_SSC_fine is not None:
self.figure_vertical_profile_SSC_fine.clear()
fig, ax = plt.subplots(nrows=1, ncols=1, layout="constrained")
self.figure_vertical_profile_SSC_fine = fig
self.axis_vertical_profile_SSC_fine = ax
@ -1004,9 +990,6 @@ class AcousticInversionTab(QWidget):
self.canvas_inverted_vs_measured_SSC_fine, self
)
else:
if self.figure_measured_vs_inverted_fine is not None:
self.figure_measured_vs_inverted_fine.clear()
fig, ax = plt.subplots(nrows=1, ncols=1, layout="constrained")
self.figure_measured_vs_inverted_fine = fig
@ -1147,9 +1130,6 @@ class AcousticInversionTab(QWidget):
self.canvas_SSC_sand = FigureCanvas()
self.toolbar_SSC_sand = NavigationToolBar(self.canvas_SSC_sand, self)
else:
if self.figure_SSC_sand is not None:
self.figure_SSC_sand.clear()
self.figure_SSC_sand, self.axis_SSC_sand = plt.subplots(
nrows=1, ncols=1, layout="constrained"
)
@ -1274,14 +1254,8 @@ class AcousticInversionTab(QWidget):
self.verticalLayout_groupbox_plot_vertical_profile_sand.removeWidget(self.toolbar_profile_sand)
self.verticalLayout_groupbox_plot_vertical_profile_sand.removeWidget(self.canvas_profile_sand)
if self.figure_vertical_profile_SSC_sand is not None:
self.figure_vertical_profile_SSC_sand.clear()
fig, ax = plt.subplots(
nrows=1, ncols=1, layout="constrained"
)
self.figure_vertical_profile_SSC_sand = fig
self.axis_vertical_profile_SSC_sand = ax
self.figure_vertical_profile_SSC_sand, self.axis_vertical_profile_SSC_sand = plt.subplots(
nrows=1, ncols=1, layout="constrained")
self.canvas_profile_sand = FigureCanvas(self.figure_vertical_profile_SSC_sand)
self.toolbar_profile_sand = NavigationToolBar(self.canvas_profile_sand, self)
@ -1646,13 +1620,8 @@ class AcousticInversionTab(QWidget):
self.verticalLayout_groupbox_plot_measured_vs_inverted_SSC_sand.removeWidget(
self.canvas_inverted_vs_measured_SSC_sand)
if self.figure_measured_vs_inverted_sand is not None:
self.figure_measured_vs_inverted_sand.clear()
fig, ax = plt.subplots(nrows=1, ncols=1, layout="constrained")
self.figure_measured_vs_inverted_sand = fig
self.axis_measured_vs_inverted_sand = ax
self.figure_measured_vs_inverted_sand, self.axis_measured_vs_inverted_sand = (
plt.subplots(nrows=1, ncols=1, layout="constrained"))
self.canvas_inverted_vs_measured_SSC_sand = FigureCanvas(self.figure_measured_vs_inverted_sand)
self.toolbar_inverted_vs_measured_SSC_sand = NavigationToolBar(self.canvas_inverted_vs_measured_SSC_sand, self)

View File

@ -153,6 +153,7 @@ class NoteTab(QWidget):
## ---------- Functions ----------
## -------------------------------
@trace
def full_update(self):
self.blockSignals(True)
self.textEdit.blockSignals(True)

View File

@ -64,7 +64,6 @@ class SampleDataTab(QWidget):
super().__init__()
icon_folder = QIcon(os.path.join("icons", "folder.png"))
self._setup_attrs()
### --- General layout of widgets ---
@ -258,11 +257,6 @@ class SampleDataTab(QWidget):
self.combobox_PSD_plot.currentTextChanged.connect(self.plot_PSD_fine_and_sand_sediments)
def _setup_attrs(self):
self.figure_plot_sample_position_on_transect = None
self.figure_total_concentration = None
self.figure_plot_PSD = None
# -------------------- Functions for Sample Data Tab --------------------
def retranslate_data_sample_tab(self):
@ -286,6 +280,7 @@ class SampleDataTab(QWidget):
self.groupbox_plot_PSD.setTitle(_translate("CONSTANT_STRING", cs.DISTRIBUTION_PLOT))
@trace
def full_update(self):
logger.debug(f"{__name__}: Update")
self.blockSignals(True)
@ -795,9 +790,6 @@ class SampleDataTab(QWidget):
self.verticalLayout_groupbox_plot_transect\
.removeWidget(self.canvas_plot_sample_position_on_transect)
if self.figure_plot_sample_position_on_transect is not None:
self.figure_plot_sample_position_on_transect.clear()
fig, axis = plt.subplots(nrows=1, ncols=1, layout="constrained")
self.figure_plot_sample_position_on_transect = fig
@ -1423,9 +1415,6 @@ class SampleDataTab(QWidget):
self.verticalLayout_groupbox_plot_total_concentration.removeWidget(self.canvas_plot_total_concentration)
self.verticalLayout_groupbox_plot_total_concentration.removeWidget(self.toolbar_plot_total_concentration)
if self.figure_total_concentration is not None:
self.figure_total_concentration.clear()
self.figure_total_concentration, self.axis_total_concentration \
= plt.subplots(nrows=1, ncols=1, layout="constrained")
self.canvas_plot_total_concentration = FigureCanvas(self.figure_total_concentration)
@ -1711,9 +1700,6 @@ class SampleDataTab(QWidget):
self.verticalLayout_groupbox_plot_PSD.removeWidget(self.canvas_plot_PSD)
self.verticalLayout_groupbox_plot_PSD.removeWidget(self.toolbar_plot_PSD)
if self.figure_plot_PSD is not None:
self.figure_plot_PSD.clear()
self.figure_plot_PSD, self.axis_plot_PSD \
= plt.subplots(nrows=1, ncols=2, layout="constrained")
self.canvas_plot_PSD = FigureCanvas(self.figure_plot_PSD)

View File

@ -63,7 +63,6 @@ class SedimentCalibrationTab(QWidget):
self.inv_hc = AcousticInversionMethodHighConcentration()
self._setup_icons()
self._setup_attrs()
self._setup_widgets()
def _path_icon(self, icon):
@ -85,10 +84,6 @@ class SedimentCalibrationTab(QWidget):
self.icon_approved = QIcon(self._path_icon("approved.png"))
self.icon_no_approved = QIcon(self._path_icon("no_approved.png"))
def _setup_attrs(self):
self.fig_BS = None
self.fig_Mfine = None
self.fig_FCB = None
def _setup_widgets(self):
self.verticalLayoutMain = QVBoxLayout(self._widget_tab)
@ -864,6 +859,7 @@ class SedimentCalibrationTab(QWidget):
self.fit_FCB_profile_with_linear_regression_and_compute_alphaS
)
@trace
def full_update(self):
logger.debug(f"{__name__}: Update")
self.blockSignals(True)
@ -1034,10 +1030,6 @@ class SedimentCalibrationTab(QWidget):
# --- Plot acoustic data recording ---
self.verticalLayout_groupbox_data_plot.removeWidget(self.toolbar_BS)
self.verticalLayout_groupbox_data_plot.removeWidget(self.canvas_BS)
if self.fig_BS is not None:
self.fig_BS.clear()
self.fig_BS, self.axis_BS = plt.subplots(
nrows=1, ncols=1, sharex=True, sharey=False,
layout='constrained'
@ -1401,10 +1393,6 @@ class SedimentCalibrationTab(QWidget):
# --- Plot profile of the concentration of the fine sediments ---
self.verticalLayout_groupbox_interpolate_plot.removeWidget(self.canvas_Mfine)
self.verticalLayout_groupbox_interpolate_plot.removeWidget(self.toolbar_Mfine)
if self.fig_Mfine is not None:
self.fig_Mfine.clear()
self.fig_Mfine, self.ax_Mfine = plt.subplots(1, 1, layout="constrained")
self.canvas_Mfine = FigureCanvas(self.fig_Mfine)
self.toolbar_Mfine = NavigationToolBar(self.canvas_Mfine, self)
@ -2338,9 +2326,6 @@ class SedimentCalibrationTab(QWidget):
self.verticalLayout_groupbox_FCB_plot.removeWidget(self.canvas_FCB)
self.verticalLayout_groupbox_FCB_plot.removeWidget(self.toolbar_FCB)
if self.fig_FCB is not None:
self.fig_FCB.clear()
self.fig_FCB, self.axis_FCB = plt.subplots(
nrows=1, ncols=1, layout="constrained"
)

View File

@ -75,7 +75,6 @@ class SignalProcessingTab(QWidget):
self._setup_icons()
self._setup_attrs()
### --- General layout of widgets ---
@ -512,13 +511,7 @@ 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
@trace
def full_update(self):
logger.debug(f"{__name__}: Update")
self.blockSignals(True)
@ -790,63 +783,46 @@ 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[data_id].shape == (0,):
return
if stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.verticalLayout_groupbox_plot_profile_tail.removeWidget(self.canvas_profile_tail)
self.verticalLayout_groupbox_plot_profile_tail.removeWidget(self.canvas_profile_tail)
if self.fig_profile_tail is not None:
self.fig_profile_tail.clear()
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.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.verticalLayout_groupbox_plot_profile_tail.addWidget(self.canvas_profile_tail)
self.verticalLayout_groupbox_plot_profile_tail.addWidget(self.canvas_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.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.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.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()
self.fig_profile_tail.canvas.draw_idle()
# ------------------------------------------------------
@ -1166,12 +1142,7 @@ class SignalProcessingTab(QWidget):
def plot_noise(self):
self.horizontalLayout_groupbox_plot_noise_data.removeWidget(self.canvas_noise)
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.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)
@ -1219,9 +1190,6 @@ 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'
@ -1402,9 +1370,6 @@ 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"
@ -1636,12 +1601,7 @@ class SignalProcessingTab(QWidget):
self.verticalLayout_groupbox_plot_profile.removeWidget(self.toolbar_profile)
self.verticalLayout_groupbox_plot_profile.removeWidget(self.canvas_profile)
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.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)