Sediment calibration: Skip somme crash and refactoring.
parent
5eb78b812d
commit
86b9f85ec6
|
|
@ -851,37 +851,50 @@ class SedimentCalibrationTab(QWidget):
|
|||
# ==============================================================================================================
|
||||
|
||||
def function_pushbutton_update_acoustic_file(self):
|
||||
if len(stg.data_preprocessed) == 0:
|
||||
return
|
||||
|
||||
if (len(stg.sample_fine) == 0 or len(stg.sample_sand) == 0):
|
||||
return
|
||||
|
||||
self.update_acoustic_data()
|
||||
# self.compute_depth_2D()
|
||||
|
||||
def function_pushbutton_plot_sample(self):
|
||||
self.sample_choice_for_calibration()
|
||||
self.plot_acoustic_recording()
|
||||
self.summary_samples_choices()
|
||||
self.plot_profile_of_concentration_fine()
|
||||
self.compute_FCB()
|
||||
|
||||
def update_acoustic_data(self):
|
||||
self.combobox_acoustic_data_choice.clear()
|
||||
self.combobox_acoustic_data_choice.addItems(stg.data_preprocessed)
|
||||
self.combobox_acoustic_data_choice.currentIndexChanged.connect(self.plot_acoustic_recording)
|
||||
self.combobox_acoustic_data_choice\
|
||||
.currentIndexChanged.connect(self.plot_acoustic_recording)
|
||||
|
||||
self.combobox_freq1.clear()
|
||||
self.combobox_freq1.addItems(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()])
|
||||
self.combobox_freq1.currentIndexChanged.connect(self.update_label_freq1_for_calibration)
|
||||
self.combobox_freq1.currentIndexChanged.connect(self.update_label_kt_value_for_calibration)
|
||||
self.combobox_freq1.addItems(
|
||||
stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]
|
||||
)
|
||||
self.combobox_freq1.currentIndexChanged\
|
||||
.connect(self.update_label_freq1_for_calibration)
|
||||
self.combobox_freq1.currentIndexChanged\
|
||||
.connect(self.update_label_kt_value_for_calibration)
|
||||
|
||||
self.combobox_freq2.clear()
|
||||
self.combobox_freq2.addItems(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()])
|
||||
self.combobox_freq2.currentIndexChanged.connect(self.update_label_freq2_for_calibration)
|
||||
self.combobox_freq2.currentIndexChanged.connect(self.update_label_kt_value_for_calibration)
|
||||
self.combobox_freq2.currentIndexChanged.connect(self.plot_acoustic_recording)
|
||||
self.combobox_freq2.addItems(
|
||||
stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]
|
||||
)
|
||||
self.combobox_freq2.currentIndexChanged\
|
||||
.connect(self.update_label_freq2_for_calibration)
|
||||
self.combobox_freq2.currentIndexChanged\
|
||||
.connect(self.update_label_kt_value_for_calibration)
|
||||
self.combobox_freq2.currentIndexChanged\
|
||||
.connect(self.plot_acoustic_recording)
|
||||
|
||||
self.combobox_fine_sample_choice.clear()
|
||||
self.combobox_fine_sample_choice.addItems([f[0] for f in stg.sample_fine])
|
||||
self.combobox_fine_sample_choice.addItems(
|
||||
[f[0] for f in stg.sample_fine]
|
||||
)
|
||||
|
||||
self.combobox_sand_sample_choice.clear()
|
||||
self.combobox_sand_sample_choice.addItems([s[0] for s in stg.sample_sand])
|
||||
self.combobox_sand_sample_choice.addItems(
|
||||
[s[0] for s in stg.sample_sand]
|
||||
)
|
||||
|
||||
self.plot_acoustic_recording()
|
||||
|
||||
|
|
@ -892,39 +905,72 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.update_label_freq2_for_calibration()
|
||||
self.update_label_kt_value_for_calibration()
|
||||
|
||||
def plot_acoustic_recording(self):
|
||||
def function_pushbutton_plot_sample(self):
|
||||
if (self.combobox_acoustic_data_choice.currentIndex() == -1):
|
||||
return
|
||||
|
||||
self.sample_choice_for_calibration()
|
||||
self.plot_acoustic_recording()
|
||||
self.summary_samples_choices()
|
||||
self.plot_profile_of_concentration_fine()
|
||||
self.compute_FCB()
|
||||
|
||||
def plot_acoustic_recording(self):
|
||||
# --- Record frequencies for calibration ---
|
||||
stg.frequencies_for_calibration.clear()
|
||||
stg.frequencies_for_calibration.append((stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
self.combobox_freq1.currentIndex()],
|
||||
self.combobox_freq1.currentIndex()))
|
||||
stg.frequencies_for_calibration.append((stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
self.combobox_freq2.currentIndex()],
|
||||
self.combobox_freq2.currentIndex()))
|
||||
stg.frequencies_for_calibration.append(
|
||||
(
|
||||
stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
self.combobox_freq1.currentIndex()
|
||||
],
|
||||
self.combobox_freq1.currentIndex()
|
||||
)
|
||||
)
|
||||
stg.frequencies_for_calibration.append(
|
||||
(
|
||||
stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
self.combobox_freq2.currentIndex()
|
||||
],
|
||||
self.combobox_freq2.currentIndex()
|
||||
)
|
||||
)
|
||||
|
||||
stg.frequency_for_inversion = tuple()
|
||||
stg.frequency_for_inversion = (stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
self.combobox_freq2.currentIndex()],
|
||||
self.combobox_freq2.currentIndex())
|
||||
stg.frequency_for_inversion = (
|
||||
stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
self.combobox_freq2.currentIndex()
|
||||
],
|
||||
self.combobox_freq2.currentIndex()
|
||||
)
|
||||
|
||||
# --- Plot acoustic data recording ---
|
||||
self.verticalLayout_groupbox_data_plot.removeWidget(self.toolbar_BS)
|
||||
self.verticalLayout_groupbox_data_plot.removeWidget(self.canvas_BS)
|
||||
self.fig_BS, self.axis_BS = plt.subplots(nrows=1, ncols=1, sharex=True, sharey=False, layout='constrained')
|
||||
self.fig_BS, self.axis_BS = plt.subplots(
|
||||
nrows=1, ncols=1, sharex=True, sharey=False, layout='constrained'
|
||||
)
|
||||
self.canvas_BS = FigureCanvas(self.fig_BS)
|
||||
self.toolbar_BS = NavigationToolBar(self.canvas_BS, self)
|
||||
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[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
if stg.BS_stream_bed_pre_process_average[
|
||||
self.combobox_acoustic_data_choice.currentIndex()
|
||||
].shape != (0,):
|
||||
val_min = np.nanmin(
|
||||
stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
self.combobox_freq2.currentIndex(), :, :])
|
||||
stg.BS_stream_bed_pre_process_average[
|
||||
self.combobox_acoustic_data_choice.currentIndex()
|
||||
][
|
||||
self.combobox_freq2.currentIndex(), :, :
|
||||
]
|
||||
)
|
||||
val_max = np.nanmax(
|
||||
stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
self.combobox_freq2.currentIndex(), :, :])
|
||||
stg.BS_stream_bed_pre_process_average[
|
||||
self.combobox_acoustic_data_choice.currentIndex()
|
||||
][
|
||||
self.combobox_freq2.currentIndex(), :, :
|
||||
]
|
||||
)
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
|
||||
|
|
@ -1509,23 +1555,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.ax_Mfine.plot(stg.M_profile_fine, -stg.range_lin_interp,
|
||||
marker="*", mfc="b", mec="b", ms=8, ls="None")
|
||||
|
||||
def interpolate_data_validity_message_box(self):
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setWindowTitle("Interpolate (step 2)")
|
||||
msgBox.setIconPixmap(
|
||||
QPixmap(
|
||||
self._path_icon("no_approved.png")
|
||||
)
|
||||
.scaledToHeight(32, Qt.SmoothTransformation)
|
||||
)
|
||||
msgBox.setText(
|
||||
"Please select and valid the sample data with"
|
||||
+ "click on 'sample plot' button"
|
||||
)
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
|
||||
|
||||
def interpolate_Mfine_profile(self):
|
||||
# Variable 'stg.sand_sample_target_indice' is set only at
|
||||
# 'plot sample' button click
|
||||
|
|
@ -1613,6 +1642,22 @@ class SedimentCalibrationTab(QWidget):
|
|||
|
||||
self.plot_profile_of_concentration_fine()
|
||||
|
||||
def interpolate_data_validity_message_box(self):
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setWindowTitle("Interpolate (step 2)")
|
||||
msgBox.setIconPixmap(
|
||||
QPixmap(
|
||||
self._path_icon("no_approved.png")
|
||||
)
|
||||
.scaledToHeight(32, Qt.SmoothTransformation)
|
||||
)
|
||||
msgBox.setText(
|
||||
"Please select and valid the sample data with"
|
||||
+ "click on 'sample plot' button"
|
||||
)
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# --------------- Functions for sediment calibration ---------------
|
||||
# ------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue