Sediment calibration: Refacto 'compute_depth_2D' and add to 'full_update'.

dev
Pierre-Antoine 2025-04-22 15:54:23 +02:00
parent 4bbda05e96
commit cb46917101
1 changed files with 30 additions and 56 deletions

View File

@ -874,6 +874,7 @@ class SedimentCalibrationTab(QWidget):
self._update_calibration()
self.function_pushbutton_plot_sample()
self.compute_depth_2D()
self.compute_kt2D_kt3D()
self.compute_J_cross_section()
@ -1802,67 +1803,40 @@ class SedimentCalibrationTab(QWidget):
self.compute_J_cross_section()
def compute_depth_2D(self):
if self.combobox_acoustic_data_choice.count() > 0:
for k in range(self.combobox_acoustic_data_choice.count()):
while len(stg.depth_2D) <= k:
stg.depth_2D.append(np.array([]))
freq = self.combobox_freq1.currentIndex()
if stg.depth_cross_section[k].shape != (0,):
if stg.time_cross_section[k].shape != (0,):
stg.depth_2D[k] = (
np.zeros((stg.freq[k].shape[0],
stg.depth_cross_section[k].shape[1],
stg.time_cross_section[k].shape[1])))
for k in range(self.combobox_acoustic_data_choice.count()):
while len(stg.depth_2D) <= k:
stg.depth_2D.append(np.array([]))
for f, _ in enumerate(stg.freq[k]):
stg.depth_2D[k][f, :, :] = (
np.repeat(np.transpose(stg.depth_cross_section[k]
[self.combobox_freq1.currentIndex()])[:, np.newaxis],
stg.time_cross_section[k].shape[1],
axis=1))
if stg.depth_cross_section[k].shape != (0,):
depth_data = stg.depth_cross_section
elif stg.depth[k].shape != (0,):
depth_data = stg.depth
elif stg.time[k].shape != (0,):
stg.depth_2D[k] = (
np.zeros((stg.freq[k].shape[0],
stg.depth_cross_section[k].shape[1],
stg.time[k].shape[1])))
if stg.time_cross_section[k].shape != (0,):
time_data = stg.time_cross_section
elif stg.time[k].shape != (0,):
time_data = stg.time
for f, _ in enumerate(stg.freq[k]):
stg.depth_2D[k][f, :, :] = (
np.repeat(
np.transpose(stg.depth_cross_section[k]
[self.combobox_freq1.currentIndex()])[:, np.newaxis],
stg.time[k].shape[1],
axis=1))
stg.depth_2D[k] = (
np.zeros((
stg.freq[k].shape[0],
depth_data[k].shape[1],
time_data[k].shape[1]
))
)
elif stg.depth[k].shape != (0,):
if stg.time_cross_section[k].shape != (0,):
stg.depth_2D[k] = (
np.zeros((stg.freq[k].shape[0],
stg.depth[k].shape[1],
stg.time_cross_section[k].shape[1])))
for f, _ in enumerate(stg.freq[k]):
stg.depth_2D[k][f, :, :] = (
np.repeat(
np.transpose(stg.depth[k]
[self.combobox_freq1.currentIndex()])[:, np.newaxis],
stg.time_cross_section[k].shape[1],
axis=1))
elif stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.depth_2D[k] = (
np.zeros((stg.freq[k].shape[0],
stg.depth[k].shape[1],
stg.time[k].shape[1])))
for f, _ in enumerate(stg.freq[k]):
stg.depth_2D[k][f, :, :] = (
np.repeat(
np.transpose(stg.depth[k]
[self.combobox_freq1.currentIndex()])[:, np.newaxis],
stg.time[k].shape[1],
axis=1))
for f, _ in enumerate(stg.freq[k]):
stg.depth_2D[k][f, :, :] = (
np.repeat(
np.transpose(
depth_data[k][freq]
)[:, np.newaxis],
time_data[k].shape[1],
axis=1
)
)
def function_pushbutton_compute_calibration(self):