Fix interpolate button action without correct data.

dev-brahim
Pierre-Antoine 2025-03-10 14:43:08 +01:00
parent 8f7e679598
commit 5eb78b812d
1 changed files with 49 additions and 11 deletions

View File

@ -1509,13 +1509,35 @@ class SedimentCalibrationTab(QWidget):
self.ax_Mfine.plot(stg.M_profile_fine, -stg.range_lin_interp, self.ax_Mfine.plot(stg.M_profile_fine, -stg.range_lin_interp,
marker="*", mfc="b", mec="b", ms=8, ls="None") 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): def interpolate_Mfine_profile(self):
data_choice = self.combobox_acoustic_data_choice.currentIndex() # Variable 'stg.sand_sample_target_indice' is set only at
# 'plot sample' button click
if len(stg.sand_sample_target_indice) == 0:
self.interpolate_data_validity_message_box()
return
data_choice = self.combobox_acoustic_data_choice\
.currentIndex()
if stg.depth_cross_section[data_choice].shape != (0,): if stg.depth_cross_section[data_choice].shape != (0,):
range_cells = stg.depth_cross_section[data_choice][ depth_data = stg.depth_cross_section
self.combobox_freq2.currentIndex(), :
]
if stg.time_cross_section[data_choice].shape != (0,): if stg.time_cross_section[data_choice].shape != (0,):
time_data = stg.time_cross_section time_data = stg.time_cross_section
@ -1523,17 +1545,31 @@ class SedimentCalibrationTab(QWidget):
time_data = stg.time time_data = stg.time
else: else:
range_cells=stg.depth[data_choice][ depth_data = stg.depth
self.combobox_freq2.currentIndex(), :
]
if stg.time_cross_section[data_choice].shape != (0,): if stg.time_cross_section[data_choice].shape != (0,):
time_data = stg.time_cross_sectino time_data = stg.time_cross_sectino
else: else:
time_data = stg.time time_data = stg.time
sample_depth = [-stg.depth_fine[k[1]] for k in stg.fine_sample_profile] self.interpolate_Mfine_profile_compute(
M_profile = [stg.Ctot_fine[k[1]] for k in stg.fine_sample_profile] data_choice, depth_data, time_data
)
def interpolate_Mfine_profile_compute(self, data_choice, depth_data, time_data):
range_cells=depth_data[data_choice][
self.combobox_freq2.currentIndex(), :
]
sample_depth = [
-stg.depth_fine[k[1]]
for k in stg.fine_sample_profile
]
M_profile = [
stg.Ctot_fine[k[1]]
for k in stg.fine_sample_profile
]
r_bottom = stg.depth_bottom[data_choice][ r_bottom = stg.depth_bottom[data_choice][
np.where( np.where(
@ -1546,7 +1582,7 @@ class SedimentCalibrationTab(QWidget):
np.abs( np.abs(
time_data[data_choice][ time_data[data_choice][
self.combobox_freq2.currentIndex(), : self.combobox_freq2.currentIndex(), :
] ]
- stg.time_fine[stg.fine_sample_profile[-1][1]]) - stg.time_fine[stg.fine_sample_profile[-1][1]])
) )
)[0][0] )[0][0]
@ -1571,7 +1607,9 @@ class SedimentCalibrationTab(QWidget):
stg.range_lin_interp = stg.range_lin_interp stg.range_lin_interp = stg.range_lin_interp
stg.M_profile_fine = stg.M_profile_fine stg.M_profile_fine = stg.M_profile_fine
stg.M_profile_fine = stg.M_profile_fine[:stg.range_lin_interp.shape[0]] stg.M_profile_fine = stg.M_profile_fine[
:stg.range_lin_interp.shape[0]
]
self.plot_profile_of_concentration_fine() self.plot_profile_of_concentration_fine()