From 728926428a1105628b6014ffce77fc6ae902989a Mon Sep 17 00:00:00 2001 From: brahim Date: Fri, 1 Nov 2024 21:06:40 +0100 Subject: [PATCH] Fine and Sand samples use for calibration are plotted with different colors. These samples are plotted on the vertical profile when the slider value is the same than the calibration profile position. --- View/acoustic_inversion_tab.py | 116 ++++++++++++++++++++++++++++++--- settings.py | 2 +- 2 files changed, 108 insertions(+), 10 deletions(-) diff --git a/View/acoustic_inversion_tab.py b/View/acoustic_inversion_tab.py index a774d2a..c1d6d15 100644 --- a/View/acoustic_inversion_tab.py +++ b/View/acoustic_inversion_tab.py @@ -761,13 +761,16 @@ class AcousticInversionTab(QWidget): if stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + self.axis_vertical_profile_SSC_fine.cla() + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - self.plot_fine.set_data( + self.axis_vertical_profile_SSC_fine.plot( stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()][:, self.slider_fine.value() - 1], -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]]) + stg.frequency_for_inversion[1]], + linestyle="solid", linewidth=1, color="k") self.pcm_SSC_fine_vertical_line.set_data( stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ @@ -786,12 +789,13 @@ class AcousticInversionTab(QWidget): stg.frequency_for_inversion[1]])]) else: - - self.plot_fine.set_data( + + self.axis_vertical_profile_SSC_fine.plot( stg.SSC_fine[self.combobox_acoustic_data_choice.currentIndex()][:, self.slider_fine.value() - 1], -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]]) + stg.frequency_for_inversion[1]], + linestyle="solid", linewidth=1, color="k") self.pcm_SSC_fine_vertical_line.set_data( stg.time[self.combobox_acoustic_data_choice.currentIndex()][ @@ -808,6 +812,49 @@ class AcousticInversionTab(QWidget): -np.nanmin(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ stg.frequency_for_inversion[1]])]) + if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + + for f in stg.fine_sample_profile: + + time_fine_calibration = ( + np.where(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]] - stg.time_fine[f[1]]) == + np.nanmin(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]] - stg.time_fine[f[1]])))[0][0] + ) + + if (stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1], int(self.slider_fine.value())] == + stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1], int(time_fine_calibration)]): + + self.axis_vertical_profile_SSC_fine.scatter( + stg.Ctot_fine[f[1]], stg.depth_fine[f[1]], + marker='*', s=48, c='r', edgecolors='r') + self.axis_vertical_profile_SSC_fine.text(stg.Ctot_fine[f[1]], stg.depth_fine[f[1]], f[0]) + + else: + + for f in stg.fine_sample_profile: + + time_fine_calibration = ( + np.where(np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]] - stg.time_fine[f[1]]) == + np.nanmin(np.abs( + stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]] - stg.time_fine[f[1]])))[0][0] + ) + + if (stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1], int(self.slider_fine.value())] == + stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1], int(time_fine_calibration)]): + + self.axis_vertical_profile_SSC_fine.scatter( + stg.Ctot_fine[f[1]], stg.depth_fine[f[1]], + marker='*', s=48, c='r', edgecolors='r') + self.axis_vertical_profile_SSC_fine.text(stg.Ctot_fine[f[1]], stg.depth_fine[f[1]], f[0]) + self.axis_vertical_profile_SSC_fine.set_xlabel("Inverted Fine SSC (g/L)") self.axis_vertical_profile_SSC_fine.set_ylabel("Depth (m)") self.figure_vertical_profile_SSC_fine.canvas.draw_idle() @@ -1417,13 +1464,16 @@ class AcousticInversionTab(QWidget): if stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + self.axis_vertical_profile_SSC_sand.cla() + if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): - self.plot_sand.set_data( + self.axis_vertical_profile_SSC_sand.plot( stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][:, self.slider_sand.value() - 1], -stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]]) + stg.frequency_for_inversion[1]], + linestyle="solid", linewidth=1, color="k") self.pcm_SSC_sand_vertical_line.set_data( stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ @@ -1443,11 +1493,12 @@ class AcousticInversionTab(QWidget): else: - self.plot_sand.set_data( + self.axis_vertical_profile_SSC_sand.plot( stg.SSC_sand[self.combobox_acoustic_data_choice.currentIndex()][:, self.slider_sand.value() - 1], -stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ - stg.frequency_for_inversion[1]]) + stg.frequency_for_inversion[1]], + linestyle="solid", linewidth=1, color="k") self.pcm_SSC_sand_vertical_line.set_data( stg.time[self.combobox_acoustic_data_choice.currentIndex()][ @@ -1464,6 +1515,53 @@ class AcousticInversionTab(QWidget): -np.nanmin(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][ stg.frequency_for_inversion[1]])]) + if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): + + time_sand_calibration = ( + np.where(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]] - stg.time_sand[ + stg.sand_sample_target[0][1]]) == + np.nanmin( + np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]] - stg.time_sand[ + stg.sand_sample_target[0][1]])))[0][0] + ) + + if (stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1], int(self.slider_sand.value())] == + stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1], int(time_sand_calibration)]): + self.axis_vertical_profile_SSC_sand.scatter(stg.Ctot_sand[stg.sand_sample_target[0][1]], + stg.depth_sand[stg.sand_sample_target[0][1]], + marker='*', s=48, c='r', edgecolors='r') + self.axis_vertical_profile_SSC_sand.text( + stg.Ctot_sand[stg.sand_sample_target[0][1]], + stg.depth_sand[stg.sand_sample_target[0][1]], + stg.sand_sample_target[0][0]) + + else: + + time_sand_calibration = ( + np.where(np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]] - stg.time_sand[ + stg.sand_sample_target[0][1]]) == + np.nanmin(np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1]] - stg.time_sand[ + stg.sand_sample_target[0][1]])))[0][0] + ) + + if (stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1], int(self.slider_sand.value())] == + stg.time[self.combobox_acoustic_data_choice.currentIndex()][ + stg.frequency_for_inversion[1], int(time_sand_calibration)]): + self.axis_vertical_profile_SSC_sand.scatter(stg.Ctot_fine[stg.sand_sample_target[0][1]], + stg.depth_fine[stg.sand_sample_target[0][1]], + marker='*', s=48, c='r', edgecolors='r') + self.axis_vertical_profile_SSC_sand.text( + stg.Ctot_fine[stg.sand_sample_target[0][1]], + stg.depth_fine[stg.sand_sample_target[0][1]], + stg.sand_sample_target[0][0]) + self.axis_vertical_profile_SSC_sand.set_xlabel("Inverted Sand SSC (g/L)") self.axis_vertical_profile_SSC_sand.set_ylabel("Depth (m)") self.figure_vertical_profile_SSC_sand.canvas.draw_idle() diff --git a/settings.py b/settings.py index 0a227e8..366ab41 100644 --- a/settings.py +++ b/settings.py @@ -191,7 +191,7 @@ sand_sample_target_indice = [] Ctot_fine_per_cent = [] Ctot_sand_per_cent = [] -fine_sample_position = [] +fine_sample_position = [] # [('F6', 5), ('F7', 6), ('F8', 7)] [('Fn', n-1)] sand_sample_position = []