Sediment calibration: Some refactoring and fix #6.
parent
0ce60afd04
commit
b7ae9dfe69
|
|
@ -1928,28 +1928,42 @@ class SedimentCalibrationTab(QWidget):
|
||||||
self.compute_zeta()
|
self.compute_zeta()
|
||||||
|
|
||||||
def compute_ks(self):
|
def compute_ks(self):
|
||||||
|
|
||||||
# --- Compute ks ---
|
|
||||||
psd_number_of_particles = (
|
psd_number_of_particles = (
|
||||||
self.inv_hc.compute_particle_size_distribution_in_number_of_particles(
|
self.inv_hc.compute_particle_size_distribution_in_number_of_particles(
|
||||||
num_sample=stg.sand_sample_target[0][1], r_grain=stg.radius_grain_sand,
|
num_sample=stg.sand_sample_target[0][1],
|
||||||
frac_vol_cumul=stg.frac_vol_sand_cumul))
|
r_grain=stg.radius_grain_sand,
|
||||||
|
frac_vol_cumul=stg.frac_vol_sand_cumul
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
ks_freq1 = self.inv_hc.ks(proba_num=psd_number_of_particles,
|
ks_freq1 = self.inv_hc.ks(
|
||||||
freq=stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
|
proba_num=psd_number_of_particles,
|
||||||
self.combobox_freq1.currentIndex()],
|
freq=stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
|
||||||
C=stg.water_velocity)
|
self.combobox_freq1.currentIndex()
|
||||||
|
],
|
||||||
|
C=stg.water_velocity
|
||||||
|
)
|
||||||
|
|
||||||
ks_freq2 = self.inv_hc.ks(proba_num=psd_number_of_particles,
|
ks_freq2 = self.inv_hc.ks(
|
||||||
freq=stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
|
proba_num=psd_number_of_particles,
|
||||||
self.combobox_freq2.currentIndex()],
|
freq=stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
|
||||||
C=stg.water_velocity)
|
self.combobox_freq2.currentIndex()
|
||||||
|
],
|
||||||
|
C=stg.water_velocity
|
||||||
|
)
|
||||||
|
|
||||||
stg.ks = [ks_freq1, ks_freq2]
|
stg.ks = [ks_freq1, ks_freq2]
|
||||||
|
|
||||||
print("\n************************************************************** \n")
|
logger.debug(
|
||||||
print(f"ks for frequency of {stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex()]} : {ks_freq1} m/kg^0.5 \n")
|
"ks for frequency of "
|
||||||
print(f"ks for frequency of {stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex()]} : {ks_freq2} m/kg^0.5")
|
+ f"{stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex()]} : "
|
||||||
|
+ f"{ks_freq1} m/kg^0.5 \n"
|
||||||
|
)
|
||||||
|
logger.debug(
|
||||||
|
"ks for frequency of "
|
||||||
|
+ f"{stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex()]} : " +
|
||||||
|
f"{ks_freq2} m/kg^0.5"
|
||||||
|
)
|
||||||
|
|
||||||
self.lineEdit_ks_freq1.clear()
|
self.lineEdit_ks_freq1.clear()
|
||||||
self.lineEdit_ks_freq1.setText(str("%.5f" % ks_freq1))
|
self.lineEdit_ks_freq1.setText(str("%.5f" % ks_freq1))
|
||||||
|
|
@ -1958,8 +1972,6 @@ class SedimentCalibrationTab(QWidget):
|
||||||
self.lineEdit_ks_freq2.setText(str("%.5f" % ks_freq2))
|
self.lineEdit_ks_freq2.setText(str("%.5f" % ks_freq2))
|
||||||
|
|
||||||
def compute_sv(self):
|
def compute_sv(self):
|
||||||
|
|
||||||
# --- Compute sv ---
|
|
||||||
sv_freq1 = self.inv_hc.sv(ks=stg.ks[0], M_sand=stg.Ctot_sand[stg.sand_sample_target[0][1]])
|
sv_freq1 = self.inv_hc.sv(ks=stg.ks[0], M_sand=stg.Ctot_sand[stg.sand_sample_target[0][1]])
|
||||||
sv_freq2 = self.inv_hc.sv(ks=stg.ks[1], M_sand=stg.Ctot_sand[stg.sand_sample_target[0][1]])
|
sv_freq2 = self.inv_hc.sv(ks=stg.ks[1], M_sand=stg.Ctot_sand[stg.sand_sample_target[0][1]])
|
||||||
|
|
||||||
|
|
@ -1975,8 +1987,6 @@ class SedimentCalibrationTab(QWidget):
|
||||||
self.lineEdit_sv_freq2.setText(str("%.5f" % sv_freq2))
|
self.lineEdit_sv_freq2.setText(str("%.5f" % sv_freq2))
|
||||||
|
|
||||||
def compute_X(self):
|
def compute_X(self):
|
||||||
|
|
||||||
# --- Compute exponent X ---
|
|
||||||
X_exponent = self.inv_hc.X_exponent(freq1=stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex()],
|
X_exponent = self.inv_hc.X_exponent(freq1=stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex()],
|
||||||
freq2=stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex()],
|
freq2=stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex()],
|
||||||
sv_freq1=stg.sv[0], sv_freq2=stg.sv[1])
|
sv_freq1=stg.sv[0], sv_freq2=stg.sv[1])
|
||||||
|
|
@ -1989,71 +1999,39 @@ class SedimentCalibrationTab(QWidget):
|
||||||
self.lineEdit_X.setText(str("%.2f" % X_exponent))
|
self.lineEdit_X.setText(str("%.2f" % X_exponent))
|
||||||
|
|
||||||
def compute_kt2D_kt3D(self):
|
def compute_kt2D_kt3D(self):
|
||||||
|
|
||||||
# --- Compute kt2D, kt3D and depth_2D ---
|
|
||||||
|
|
||||||
for i in range(self.combobox_acoustic_data_choice.count()):
|
for i in range(self.combobox_acoustic_data_choice.count()):
|
||||||
|
|
||||||
if stg.depth_cross_section[i].shape != (0,):
|
if stg.depth_cross_section[i].shape != (0,):
|
||||||
|
depth_data = stg.depth_cross_section
|
||||||
if stg.time_cross_section[i].shape != (0,):
|
|
||||||
|
|
||||||
if stg.kt_corrected != stg.kt_read:
|
|
||||||
|
|
||||||
stg.kt2D[i] = np.repeat(np.array([stg.kt_corrected]).transpose(),
|
|
||||||
stg.time_cross_section[i].shape[1], axis=1)
|
|
||||||
stg.kt3D[i] = np.repeat(stg.kt2D[i][:, np.newaxis, :], stg.depth_cross_section[i].shape[1], axis=1)
|
|
||||||
|
|
||||||
else:
|
|
||||||
|
|
||||||
stg.kt2D[i] = np.repeat(np.array([stg.kt_read]).transpose(),
|
|
||||||
stg.time_cross_section[i].shape[1], axis=1)
|
|
||||||
stg.kt3D[i] = np.repeat(stg.kt2D[i][:, np.newaxis, :], stg.depth_cross_section[i].shape[1], axis=1)
|
|
||||||
|
|
||||||
elif stg.time[i].shape != (0,):
|
|
||||||
|
|
||||||
if (stg.kt_corrected != stg.kt_read):
|
|
||||||
|
|
||||||
stg.kt2D[i] = np.repeat(np.array([stg.kt_corrected]).transpose(), stg.time[i].shape[1], axis=1)
|
|
||||||
stg.kt3D[i] = np.repeat(stg.kt2D[i][:, np.newaxis, :], stg.depth_cross_section[i].shape[1], axis=1)
|
|
||||||
|
|
||||||
else:
|
|
||||||
|
|
||||||
stg.kt2D[i] = np.repeat(np.array([stg.kt_read]).transpose(), stg.time[i].shape[1], axis=1)
|
|
||||||
stg.kt3D[i] = np.repeat(stg.kt2D[i][:, np.newaxis, :], stg.depth_cross_section[i].shape[1], axis=1)
|
|
||||||
|
|
||||||
elif stg.depth[i].shape != (0,):
|
elif stg.depth[i].shape != (0,):
|
||||||
|
depth_data = stg.depth
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
if stg.time_cross_section[i].shape != (0,):
|
if stg.time_cross_section[i].shape != (0,):
|
||||||
|
time_data = stg.time_cross_section
|
||||||
|
elif stg.time[i].shape != (0,):
|
||||||
|
time_data = stg.time
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
if (stg.kt_corrected != stg.kt_read):
|
if stg.kt_corrected != stg.kt_read:
|
||||||
|
kt_data = stg.kt_corrected
|
||||||
|
else:
|
||||||
|
kt_data = stg.kt_read
|
||||||
|
|
||||||
stg.kt2D[i] = np.repeat(np.array([stg.kt_corrected]).transpose(),
|
stg.kt2D[i] = np.repeat(
|
||||||
stg.time_cross_section[i].shape[1], axis=1)
|
np.array([kt_data]).transpose(),
|
||||||
stg.kt3D[i] = np.repeat(stg.kt2D[i][:, np.newaxis, :], stg.depth[i].shape[1], axis=1)
|
time_data[i].shape[1],
|
||||||
|
axis=1
|
||||||
|
)
|
||||||
|
|
||||||
else:
|
stg.kt3D[i] = np.repeat(
|
||||||
|
stg.kt2D[i][:, np.newaxis, :],
|
||||||
stg.kt2D[i] = np.repeat(np.array([stg.kt_read]).transpose(),
|
depth_data[i].shape[1],
|
||||||
stg.time_cross_section[i].shape[1], axis=1)
|
axis=1
|
||||||
stg.kt3D[i] = np.repeat(stg.kt2D[i][:, np.newaxis, :], stg.depth[i].shape[1], axis=1)
|
)
|
||||||
|
|
||||||
elif stg.time[i].shape != (0,):
|
|
||||||
|
|
||||||
if (stg.kt_corrected != stg.kt_read):
|
|
||||||
|
|
||||||
stg.kt2D[i] = np.repeat(np.array([stg.kt_corrected]).transpose(), stg.time[i].shape[1], axis=1)
|
|
||||||
stg.kt3D[i] = np.repeat(stg.kt2D[i][:, np.newaxis, :],
|
|
||||||
stg.depth[i].shape[1],
|
|
||||||
axis=1)
|
|
||||||
|
|
||||||
else:
|
|
||||||
|
|
||||||
stg.kt2D[i] = np.repeat(np.array([stg.kt_read]).transpose(), stg.time[i].shape[1], axis=1)
|
|
||||||
stg.kt3D[i] = np.repeat(stg.kt2D[i][:, np.newaxis, :], stg.depth[i].shape[1], axis=1)
|
|
||||||
|
|
||||||
def compute_J_cross_section(self):
|
def compute_J_cross_section(self):
|
||||||
|
|
||||||
for i in range(self.combobox_acoustic_data_choice.count()):
|
for i in range(self.combobox_acoustic_data_choice.count()):
|
||||||
|
|
||||||
J_cross_section_freq1 = np.array([])
|
J_cross_section_freq1 = np.array([])
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue