Acoustic inversion: Fix fine and sand sample choice duplication.

dev
Pierre-Antoine 2025-04-28 16:50:53 +02:00
parent 3e90455b4b
commit 815610ab20
1 changed files with 28 additions and 109 deletions

View File

@ -936,6 +936,7 @@ class AcousticInversionTab(QWidget):
def fill_combobox_fine_sample(self): def fill_combobox_fine_sample(self):
data_id = self.combobox_acoustic_data_choice.currentIndex() data_id = self.combobox_acoustic_data_choice.currentIndex()
self.combobox_fine_sample_choice.clear()
self.combobox_fine_sample_choice.addItems( self.combobox_fine_sample_choice.addItems(
[f for f, _ in stg.sample_fine] [f for f, _ in stg.sample_fine]
) )
@ -1507,121 +1508,39 @@ class AcousticInversionTab(QWidget):
# --- Plot sand SSC : measured vs inverted --- # --- Plot sand SSC : measured vs inverted ---
def fill_combobox_sand_sample(self): def fill_combobox_sand_sample(self):
data_id = self.combobox_acoustic_data_choice.currentIndex()
self.combobox_sand_sample_choice.addItems([f for f, _ in stg.sample_sand]) self.combobox_sand_sample_choice.clear()
self.combobox_sand_sample_choice.addItems(
[f for f, _ in stg.sample_sand]
)
# --- Get position (index, value) of sample in acoustic measurement space --- # --- Get position (index, value) of sample in acoustic measurement space ---
if ((stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,)) and if stg.time_cross_section[data_id].shape != (0,):
(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))): time_data = stg.time_cross_section
else:
time_data = stg.time
for j in range(len(stg.time_sand)): if stg.depth_cross_section[data_id].shape != (0,):
depth_data = stg.depth_cross_section
else:
depth_data = stg.depth
(stg.sand_sample_position. freq = stg.frequency_for_inversion[1]
append( for j in range(len(stg.time_sand)):
( time_diff = np.abs(time_data[data_id][freq] - stg.time_sand[j])
np.where( depth_diff = np.abs(depth_data[data_id][freq] - (-stg.depth_sand[j]))
np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] - stg.time_sand[j]) stg.sand_sample_position.append(
== (
np.nanmin(np.abs(stg.time_cross_section[ np.where(
self.combobox_acoustic_data_choice.currentIndex()][ time_diff == np.nanmin(time_diff)
stg.frequency_for_inversion[1]] - stg.time_sand[j])) )[0][0],
)[0][0], np.where(
np.where( depth_diff == np.nanmin(depth_diff)
np.abs(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ )[0][0]
stg.frequency_for_inversion[1]] - (-stg.depth_sand[j]))
==
np.nanmin(np.abs(stg.depth_cross_section[
self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] - (-stg.depth_sand[j])))
)[0][0]
)
)
)
elif ((stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,)) and
(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))):
for j in range(len(stg.time_sand)):
(stg.sand_sample_position.
append(
(
np.where(
np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] - stg.time_sand[j])
==
np.nanmin(np.abs(stg.time_cross_section[
self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] - stg.time_sand[j]))
)[0][0],
np.where(
np.abs(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] - (-stg.depth_sand[j]))
==
np.nanmin(np.abs(stg.depth[
self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] - (-stg.depth_sand[j])))
)[0][0]
)
)
)
elif ((stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,)) and
(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))):
for j in range(len(stg.time_sand)):
(stg.sand_sample_position.
append(
(
np.where(
np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] - stg.time_sand[j])
==
np.nanmin(np.abs(stg.time[
self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] - stg.time_sand[j]))
)[0][0],
np.where(
np.abs(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] - (-stg.depth_sand[j]))
==
np.nanmin(np.abs(stg.depth_cross_section[
self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] - (-stg.depth_sand[j])))
)[0][0]
)
)
)
elif ((stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,)) and
(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))):
for j in range(len(stg.time_sand)):
(stg.sand_sample_position.
append(
(
np.where(
np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] - stg.time_sand[j])
==
np.nanmin(np.abs(stg.time[
self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] - stg.time_sand[j]))
)[0][0],
np.where(
np.abs(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] - (-stg.depth_sand[j]))
==
np.nanmin(np.abs(stg.depth[
self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] - (-stg.depth_sand[j])))
)[0][0]
)
)
) )
)
def plot_measured_vs_inverted_SSC_sand(self): def plot_measured_vs_inverted_SSC_sand(self):