Compare commits

..

6 Commits

5 changed files with 96 additions and 197 deletions

View File

@ -104,7 +104,7 @@ class CreateTableForSaveAs:
tmax_index INTEGER, tmax_value FLOAT,
rmin_index INTEGER, rmin_value FLOAT,
rmax_index INTEGER, rmax_value FLOAT,
freq_bottom_detection_index FLOAT,
freq_bottom_detection_index INTEGER,
freq_bottom_detection_value STRING,
depth_bottom_detection_min FLOAT,
depth_bottom_detection_max FLOAT,
@ -455,9 +455,9 @@ class CreateTableForSaveAs:
int(stg.rmax[i][0]), stg.rmax[i][1],
stg.freq_bottom_detection[i][0],
stg.freq_bottom_detection[i][1],
stg.depth_bottom_detection_min,
stg.depth_bottom_detection_max,
stg.depth_bottom_detection_interval,
stg.depth_bottom_detection_min[i],
stg.depth_bottom_detection_max[i],
stg.depth_bottom_detection_interval[i],
stg.SNR_filter_value[i],
stg.Nb_cells_to_average_BS_signal[i]
)

View File

@ -528,9 +528,9 @@ class ReadTableForOpen:
stg.rmin.append((next(it), next(it)))
stg.rmax.append((next(it), next(it)))
stg.freq_bottom_detection.append((next(it), next(it)))
stg.depth_bottom_detection_min = next(it)
stg.depth_bottom_detection_max = next(it)
stg.depth_bottom_detection_interval = next(it)
stg.depth_bottom_detection_min.append(next(it))
stg.depth_bottom_detection_max.append(next(it))
stg.depth_bottom_detection_interval.append(next(it))
stg.SNR_filter_value.append(next(it))
stg.Nb_cells_to_average_BS_signal.append(next(it))

View File

@ -41,7 +41,7 @@ from PyQt5.QtWidgets import (
QPushButton, QComboBox, QLineEdit, QLabel,
QGridLayout, QTableView, QSpacerItem, QSizePolicy,
QFileDialog, QMessageBox, QScrollArea,
QSlider, QMenu, QCheckBox
QSlider, QMenu, QCheckBox, QAbstractItemView
)
from PyQt5.QtGui import QPixmap, QIcon
from PyQt5.QtCore import (
@ -161,6 +161,7 @@ class AcousticDataTab(QWidget):
self.gridLayout_groupbox_acoustic_file.addWidget(self.clearBtn, 0, 4, 1, 1)
self.fileListWidget = FileListWidget()
self.fileListWidget.setSelectionMode(QAbstractItemView.SingleSelection)
self.gridLayout_groupbox_acoustic_file.addWidget(self.fileListWidget, 1, 0, 1, 5)
# ++++++++++++++++++++++++++++++++++++++
@ -760,7 +761,6 @@ class AcousticDataTab(QWidget):
self.water_attenuation()
self.compute_tmin_tmax()
self.compute_rmin_rmax()
self.set_range_for_spinboxes_bathymetry()
self.combobox_ABS_system_choice.blockSignals(False)
self.fileListWidget.blockSignals(False)
@ -821,7 +821,7 @@ class AcousticDataTab(QWidget):
# self.fileListWidget.itemSelectionChanged.connect(self.plot_profile)
self.update_plot_backscattered_acoustic_signal_recording()
self.update_plot_profile()
self.set_range_for_spinboxes_bathymetry()
self.update_bottom_detection_settings()
self.fileListWidget.blockSignals(False)
@ -1688,6 +1688,9 @@ class AcousticDataTab(QWidget):
stg.val_bottom.append([])
stg.ind_bottom.append([])
stg.freq_bottom_detection.append((0, 0))
stg.depth_bottom_detection_min.append(0.0)
stg.depth_bottom_detection_max.append(0.0)
stg.depth_bottom_detection_interval.append(0.0)
stg.BS_mean.append(np.array([]))
stg.BS_noise_raw_data.append(np.array([]))
@ -2314,83 +2317,41 @@ class AcousticDataTab(QWidget):
''' rmin and rmax are updated with double slider of depth '''
data_id = self.fileListWidget.currentRow()
round_depth = np.round(stg.depth[data_id][0, :], 2)
depth_max = float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_max_limits.text()
)
)
)
depth_min = float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_min_limits.text()
)
)
)
diff_max = np.abs(round_depth - depth_max)
diff_min = np.abs(round_depth - depth_min)
stg.rmin[data_id] = ((
np.where(
np.abs(
np.round(
stg.depth[data_id][0, :], 2
) - float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_max_limits.text()
)
)
)
) == np.nanmin(
np.abs(
np.round(stg.depth[data_id][0, :], 2)
- float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_max_limits.text()
)
)
)
)
)
)[0][0]+1,
float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_max_limits.text()
)
)
)
np.where(diff_max == np.nanmin(diff_max))[0][0]+1,
depth_max
))
stg.rmax[data_id] = ((
np.where(
np.abs(
np.round(
stg.depth[data_id][0, :], 2
) - float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_min_limits.text()
)
)
)
) == np.nanmin(
np.abs(
np.round(stg.depth[data_id][0, :], 2)
- float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_min_limits.text()
)
)
)
)
)
)[0][0],
float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_min_limits.text()
)
)
)
np.where(diff_min == np.nanmin(diff_min))[0][0],
depth_min
))
stg.depth_cross_section[data_id] = (
stg.depth[data_id][:,
stg.rmin[data_id][0]:stg.rmax[data_id][0]]
stg.depth[data_id][
:, stg.rmin[data_id][0]:stg.rmax[data_id][0]
]
)
def compute_BS_cross_section(self):
@ -2868,28 +2829,44 @@ class AcousticDataTab(QWidget):
self.lineEdit_slider.setText(
str(stg.time[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), self.slider.value()-1]))
def update_bottom_detection_settings(self):
data_id = max(0, self.fileListWidget.currentRow())
if stg.depth_bottom_detection_interval[data_id] == 0.0:
self.set_range_for_spinboxes_bathymetry()
return
self.combobox_frequency_bathymetry.setCurrentIndex(
int(stg.freq_bottom_detection[data_id][0])
)
self.lineEdit_depth_min_bathy.setText(
str(stg.depth_bottom_detection_min)
str(stg.depth_bottom_detection_min[data_id])
)
self.lineEdit_depth_max_bathy.setText(
str(stg.depth_bottom_detection_max)
str(stg.depth_bottom_detection_max[data_id])
)
self.lineEdit_next_cell_bathy.setText(
str(stg.depth_bottom_detection_interval)
str(stg.depth_bottom_detection_interval[data_id])
)
def save_bottom_detection_settings(self):
stg.depth_bottom_detection_min = float(
data_id = max(0, self.fileListWidget.currentRow())
stg.freq_bottom_detection[data_id] = (
int(self.combobox_frequency_bathymetry.currentIndex()),
str(self.combobox_frequency_bathymetry.currentText()),
)
stg.depth_bottom_detection_min[data_id] = float(
self.lineEdit_depth_min_bathy.text()
)
stg.depth_bottom_detection_max = float(
stg.depth_bottom_detection_max[data_id] = float(
self.lineEdit_depth_max_bathy.text()
)
stg.depth_bottom_detection_interval = float(
stg.depth_bottom_detection_interval[data_id] = float(
self.lineEdit_next_cell_bathy.text()
)

View File

@ -936,6 +936,7 @@ class AcousticInversionTab(QWidget):
def fill_combobox_fine_sample(self):
data_id = self.combobox_acoustic_data_choice.currentIndex()
self.combobox_fine_sample_choice.clear()
self.combobox_fine_sample_choice.addItems(
[f for f, _ in stg.sample_fine]
)
@ -1507,121 +1508,39 @@ class AcousticInversionTab(QWidget):
# --- Plot sand SSC : measured vs inverted ---
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 ---
if ((stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,)) and
(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))):
if stg.time_cross_section[data_id].shape != (0,):
time_data = stg.time_cross_section
else:
time_data = stg.time
if stg.depth_cross_section[data_id].shape != (0,):
depth_data = stg.depth_cross_section
else:
depth_data = stg.depth
freq = stg.frequency_for_inversion[1]
for j in range(len(stg.time_sand)):
time_diff = np.abs(time_data[data_id][freq] - stg.time_sand[j])
depth_diff = np.abs(depth_data[data_id][freq] - (-stg.depth_sand[j]))
(stg.sand_sample_position.
append(
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]))
time_diff == np.nanmin(time_diff)
)[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])))
depth_diff == np.nanmin(depth_diff)
)[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):

View File

@ -2414,6 +2414,10 @@ class SedimentCalibrationTab(QWidget):
data_id = self.combobox_acoustic_data_choice.currentIndex()
fcb_id = self.combobox_frequency_FCB.currentIndex()
if (self.lineEdit_FCB_from.text() == ''
or self.lineEdit_FCB_to.text() == ''):
return
self.update_plot_FCB()
if stg.FCB.shape == (0,):
@ -2437,8 +2441,7 @@ class SedimentCalibrationTab(QWidget):
np.round(
np.abs(
x - float(
self.lineEdit_FCB_from\
.text().replace(',','.')
self.lineEdit_FCB_from.text().replace(',','.')
)
), 2
) == np.min(