Sediment calibration: Refactoring.
parent
4b6ee4af09
commit
9bb02edee4
|
|
@ -1168,82 +1168,110 @@ class SedimentCalibrationTab(QWidget):
|
||||||
self.fig_BS.canvas.draw_idle()
|
self.fig_BS.canvas.draw_idle()
|
||||||
|
|
||||||
def sample_choice_for_calibration(self):
|
def sample_choice_for_calibration(self):
|
||||||
|
fine_id = self.combobox_fine_sample_choice.currentIndexes()
|
||||||
|
fine_data = self.combobox_fine_sample_choice.currentData()
|
||||||
|
|
||||||
|
sand_id = self.combobox_sand_sample_choice.currentIndex()
|
||||||
|
sand_data = self.combobox_sand_sample_choice.currentData()
|
||||||
|
sand_text = self.combobox_sand_sample_choice.currentText()
|
||||||
|
|
||||||
# --- List selected fine samples ---
|
# --- List selected fine samples ---
|
||||||
stg.fine_sample_profile = [(f, int(f[1:]) - 1) for f in self.combobox_fine_sample_choice.currentData()]
|
stg.fine_sample_profile = [
|
||||||
stg.calib_fine_profiles = self.combobox_fine_sample_choice.currentIndexes()
|
(f, int(f[1:]) - 1) for f in fine_data
|
||||||
|
]
|
||||||
|
stg.calib_fine_profiles = fine_id
|
||||||
|
|
||||||
# --- List selected sand samples ---
|
# --- List selected sand samples ---
|
||||||
# stg.sand_sample_target = [(s, int(s[1:]) - 1) for s in self.combobox_sand_sample_choice.currentData()]
|
stg.sand_sample_target = [(sand_text, sand_id)]
|
||||||
stg.sand_sample_target = [(self.combobox_sand_sample_choice.currentText(),
|
stg.calib_sand_target = sand_id
|
||||||
self.combobox_sand_sample_choice.currentIndex())]
|
|
||||||
stg.calib_sand_target = self.combobox_sand_sample_choice.currentIndex()
|
|
||||||
|
|
||||||
# --- Find index in time (along acoustic recording) of sand sample target ---
|
t1, t2 = self.sample_choice_for_calibration_times()
|
||||||
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
d1, d2 = self.sample_choice_for_calibration_depths()
|
||||||
t1 = (
|
|
||||||
np.where(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq1.currentIndex()] - stg.time_sand[stg.sand_sample_target[0][1]]) ==
|
|
||||||
np.nanmin(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq1.currentIndex()] - stg.time_sand[stg.sand_sample_target[0][1]])))[0][0]
|
|
||||||
)
|
|
||||||
t2 = (
|
|
||||||
np.where(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq2.currentIndex()] - stg.time_sand[stg.sand_sample_target[0][1]]) ==
|
|
||||||
np.nanmin(np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq2.currentIndex()] - stg.time_sand[stg.sand_sample_target[0][1]])))[0][0]
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
t1 = (
|
|
||||||
np.where(np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq1.currentIndex()] - stg.time_sand[
|
|
||||||
stg.sand_sample_target[0][1]]) ==
|
|
||||||
np.nanmin(np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq1.currentIndex()] - stg.time_sand[
|
|
||||||
stg.sand_sample_target[0][1]])))[0][0]
|
|
||||||
)
|
|
||||||
t2 = (
|
|
||||||
np.where(np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq2.currentIndex()] - stg.time_sand[
|
|
||||||
stg.sand_sample_target[0][1]]) ==
|
|
||||||
np.nanmin(np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq2.currentIndex()] - stg.time_sand[
|
|
||||||
stg.sand_sample_target[0][1]])))[0][0]
|
|
||||||
)
|
|
||||||
|
|
||||||
# --- Find index in depth (along acoustic recording) of sand sample target ---
|
|
||||||
if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
|
||||||
d1 = (
|
|
||||||
np.where(np.abs(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq1.currentIndex()] - (-stg.depth_sand[stg.sand_sample_target[0][1]]) ) ==
|
|
||||||
np.nanmin(np.abs(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq1.currentIndex()] - (-stg.depth_sand[stg.sand_sample_target[0][1]]) )))[0][0]
|
|
||||||
)
|
|
||||||
d2 = (
|
|
||||||
np.where(np.abs(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq2.currentIndex()] - (-stg.depth_sand[stg.sand_sample_target[0][1]]) ) ==
|
|
||||||
np.nanmin(np.abs(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq2.currentIndex()] - (-stg.depth_sand[stg.sand_sample_target[0][1]]) )))[0][0]
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
d1 = (
|
|
||||||
np.where(np.abs(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq1.currentIndex()] - (-stg.depth_sand[
|
|
||||||
stg.sand_sample_target[0][1]]) ) ==
|
|
||||||
np.nanmin(np.abs(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq1.currentIndex()] - (-stg.depth_sand[
|
|
||||||
stg.sand_sample_target[0][1]]) )))[0][0]
|
|
||||||
)
|
|
||||||
d2 = (
|
|
||||||
np.where(np.abs(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq2.currentIndex()] - (-stg.depth_sand[
|
|
||||||
stg.sand_sample_target[0][1]]) ) ==
|
|
||||||
np.nanmin(np.abs(stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
|
|
||||||
self.combobox_freq2.currentIndex()] - (-stg.depth_sand[
|
|
||||||
stg.sand_sample_target[0][1]]) )))[0][0]
|
|
||||||
)
|
|
||||||
|
|
||||||
stg.sand_sample_target_indice = [(d1, t1), (d2, t2)]
|
stg.sand_sample_target_indice = [(d1, t1), (d2, t2)]
|
||||||
|
|
||||||
|
def sample_choice_for_calibration_times(self):
|
||||||
|
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||||
|
|
||||||
|
freq1_id = self.combobox_freq1.currentIndex()
|
||||||
|
freq2_id = self.combobox_freq1.currentIndex()
|
||||||
|
|
||||||
|
# --- Find index in time (along acoustic recording) of sand sample target ---
|
||||||
|
if stg.time_cross_section[data_id].shape != (0,):
|
||||||
|
time_data = stg.time_cross_section
|
||||||
|
else:
|
||||||
|
time_data = stg.time
|
||||||
|
|
||||||
|
t1 = (
|
||||||
|
np.where(
|
||||||
|
np.abs(
|
||||||
|
time_data[data_id][freq1_id]
|
||||||
|
- stg.time_sand[stg.sand_sample_target[0][1]]
|
||||||
|
) == np.nanmin(
|
||||||
|
np.abs(
|
||||||
|
time_data[data_id][freq1_id]
|
||||||
|
- stg.time_sand[stg.sand_sample_target[0][1]]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)[0][0]
|
||||||
|
)
|
||||||
|
t2 = (
|
||||||
|
np.where(
|
||||||
|
np.abs(
|
||||||
|
time_data[data_id][freq2_id]
|
||||||
|
- stg.time_sand[stg.sand_sample_target[0][1]]
|
||||||
|
) == np.nanmin(
|
||||||
|
np.abs(
|
||||||
|
time_data[data_id][freq2_id]
|
||||||
|
- stg.time_sand[stg.sand_sample_target[0][1]]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)[0][0]
|
||||||
|
)
|
||||||
|
|
||||||
|
return (t1, t2)
|
||||||
|
|
||||||
|
def sample_choice_for_calibration_depths(self):
|
||||||
|
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||||
|
|
||||||
|
freq1_id = self.combobox_freq1.currentIndex()
|
||||||
|
freq2_id = self.combobox_freq1.currentIndex()
|
||||||
|
|
||||||
|
# --- Find index in depth (along acoustic recording) of sand sample target ---
|
||||||
|
if stg.depth_cross_section[data_id].shape != (0,):
|
||||||
|
depth_data = stg.depth_cross_section
|
||||||
|
else:
|
||||||
|
depth_data = stg.depth
|
||||||
|
|
||||||
|
d1 = (
|
||||||
|
np.where(
|
||||||
|
np.abs(
|
||||||
|
depth_data[data_id][freq1_id]
|
||||||
|
- (-stg.depth_sand[stg.sand_sample_target[0][1]])
|
||||||
|
) == np.nanmin(
|
||||||
|
np.abs(
|
||||||
|
depth_data[data_id][freq1_id] -
|
||||||
|
(-stg.depth_sand[stg.sand_sample_target[0][1]])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)[0][0]
|
||||||
|
)
|
||||||
|
d2 = (
|
||||||
|
np.where(
|
||||||
|
np.abs(
|
||||||
|
depth_data[data_id][freq2_id]
|
||||||
|
- (-stg.depth_sand[stg.sand_sample_target[0][1]])
|
||||||
|
) == np.nanmin(
|
||||||
|
np.abs(
|
||||||
|
depth_data[data_id][freq2_id]
|
||||||
|
- (-stg.depth_sand[stg.sand_sample_target[0][1]])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)[0][0]
|
||||||
|
)
|
||||||
|
|
||||||
|
return (d1, d2)
|
||||||
|
|
||||||
def summary_samples_choices(self):
|
def summary_samples_choices(self):
|
||||||
|
|
||||||
self.pushbutton_compute_calibration.setToolTip("Calibration is computed at abscissa " + str(self.combobox_sand_sample_choice.currentText()))
|
self.pushbutton_compute_calibration.setToolTip("Calibration is computed at abscissa " + str(self.combobox_sand_sample_choice.currentText()))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue