Compare commits

..

No commits in common. "4a8b318ea46ff09777f35e501381664906fe1a50" and "f23dceb42b2a853c36fd41dbd15adb6001cc062d" have entirely different histories.

5 changed files with 198 additions and 97 deletions

View File

@ -104,7 +104,7 @@ class CreateTableForSaveAs:
tmax_index INTEGER, tmax_value FLOAT, tmax_index INTEGER, tmax_value FLOAT,
rmin_index INTEGER, rmin_value FLOAT, rmin_index INTEGER, rmin_value FLOAT,
rmax_index INTEGER, rmax_value FLOAT, rmax_index INTEGER, rmax_value FLOAT,
freq_bottom_detection_index INTEGER, freq_bottom_detection_index FLOAT,
freq_bottom_detection_value STRING, freq_bottom_detection_value STRING,
depth_bottom_detection_min FLOAT, depth_bottom_detection_min FLOAT,
depth_bottom_detection_max FLOAT, depth_bottom_detection_max FLOAT,
@ -455,9 +455,9 @@ class CreateTableForSaveAs:
int(stg.rmax[i][0]), stg.rmax[i][1], int(stg.rmax[i][0]), stg.rmax[i][1],
stg.freq_bottom_detection[i][0], stg.freq_bottom_detection[i][0],
stg.freq_bottom_detection[i][1], stg.freq_bottom_detection[i][1],
stg.depth_bottom_detection_min[i], stg.depth_bottom_detection_min,
stg.depth_bottom_detection_max[i], stg.depth_bottom_detection_max,
stg.depth_bottom_detection_interval[i], stg.depth_bottom_detection_interval,
stg.SNR_filter_value[i], stg.SNR_filter_value[i],
stg.Nb_cells_to_average_BS_signal[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.rmin.append((next(it), next(it)))
stg.rmax.append((next(it), next(it))) stg.rmax.append((next(it), next(it)))
stg.freq_bottom_detection.append((next(it), next(it))) stg.freq_bottom_detection.append((next(it), next(it)))
stg.depth_bottom_detection_min.append(next(it)) stg.depth_bottom_detection_min = next(it)
stg.depth_bottom_detection_max.append(next(it)) stg.depth_bottom_detection_max = next(it)
stg.depth_bottom_detection_interval.append(next(it)) stg.depth_bottom_detection_interval = next(it)
stg.SNR_filter_value.append(next(it)) stg.SNR_filter_value.append(next(it))
stg.Nb_cells_to_average_BS_signal.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, QPushButton, QComboBox, QLineEdit, QLabel,
QGridLayout, QTableView, QSpacerItem, QSizePolicy, QGridLayout, QTableView, QSpacerItem, QSizePolicy,
QFileDialog, QMessageBox, QScrollArea, QFileDialog, QMessageBox, QScrollArea,
QSlider, QMenu, QCheckBox, QAbstractItemView QSlider, QMenu, QCheckBox
) )
from PyQt5.QtGui import QPixmap, QIcon from PyQt5.QtGui import QPixmap, QIcon
from PyQt5.QtCore import ( from PyQt5.QtCore import (
@ -161,7 +161,6 @@ class AcousticDataTab(QWidget):
self.gridLayout_groupbox_acoustic_file.addWidget(self.clearBtn, 0, 4, 1, 1) self.gridLayout_groupbox_acoustic_file.addWidget(self.clearBtn, 0, 4, 1, 1)
self.fileListWidget = FileListWidget() self.fileListWidget = FileListWidget()
self.fileListWidget.setSelectionMode(QAbstractItemView.SingleSelection)
self.gridLayout_groupbox_acoustic_file.addWidget(self.fileListWidget, 1, 0, 1, 5) self.gridLayout_groupbox_acoustic_file.addWidget(self.fileListWidget, 1, 0, 1, 5)
# ++++++++++++++++++++++++++++++++++++++ # ++++++++++++++++++++++++++++++++++++++
@ -761,6 +760,7 @@ class AcousticDataTab(QWidget):
self.water_attenuation() self.water_attenuation()
self.compute_tmin_tmax() self.compute_tmin_tmax()
self.compute_rmin_rmax() self.compute_rmin_rmax()
self.set_range_for_spinboxes_bathymetry()
self.combobox_ABS_system_choice.blockSignals(False) self.combobox_ABS_system_choice.blockSignals(False)
self.fileListWidget.blockSignals(False) self.fileListWidget.blockSignals(False)
@ -821,7 +821,7 @@ class AcousticDataTab(QWidget):
# self.fileListWidget.itemSelectionChanged.connect(self.plot_profile) # self.fileListWidget.itemSelectionChanged.connect(self.plot_profile)
self.update_plot_backscattered_acoustic_signal_recording() self.update_plot_backscattered_acoustic_signal_recording()
self.update_plot_profile() self.update_plot_profile()
self.update_bottom_detection_settings() self.set_range_for_spinboxes_bathymetry()
self.fileListWidget.blockSignals(False) self.fileListWidget.blockSignals(False)
@ -1688,9 +1688,6 @@ class AcousticDataTab(QWidget):
stg.val_bottom.append([]) stg.val_bottom.append([])
stg.ind_bottom.append([]) stg.ind_bottom.append([])
stg.freq_bottom_detection.append((0, 0)) 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_mean.append(np.array([]))
stg.BS_noise_raw_data.append(np.array([])) stg.BS_noise_raw_data.append(np.array([]))
@ -2317,8 +2314,12 @@ class AcousticDataTab(QWidget):
''' rmin and rmax are updated with double slider of depth ''' ''' rmin and rmax are updated with double slider of depth '''
data_id = self.fileListWidget.currentRow() data_id = self.fileListWidget.currentRow()
round_depth = np.round(stg.depth[data_id][0, :], 2) stg.rmin[data_id] = ((
depth_max = float( np.where(
np.abs(
np.round(
stg.depth[data_id][0, :], 2
) - float(
"".join( "".join(
findall( findall(
"[.0-9]", "[.0-9]",
@ -2326,7 +2327,58 @@ class AcousticDataTab(QWidget):
) )
) )
) )
depth_min = float( ) == 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()
)
)
)
))
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( "".join(
findall( findall(
"[.0-9]", "[.0-9]",
@ -2334,24 +2386,11 @@ class AcousticDataTab(QWidget):
) )
) )
) )
diff_max = np.abs(round_depth - depth_max)
diff_min = np.abs(round_depth - depth_min)
stg.rmin[data_id] = ((
np.where(diff_max == np.nanmin(diff_max))[0][0]+1,
depth_max
))
stg.rmax[data_id] = ((
np.where(diff_min == np.nanmin(diff_min))[0][0],
depth_min
)) ))
stg.depth_cross_section[data_id] = ( stg.depth_cross_section[data_id] = (
stg.depth[data_id][ stg.depth[data_id][:,
:, stg.rmin[data_id][0]:stg.rmax[data_id][0] stg.rmin[data_id][0]:stg.rmax[data_id][0]]
]
) )
def compute_BS_cross_section(self): def compute_BS_cross_section(self):
@ -2829,44 +2868,28 @@ class AcousticDataTab(QWidget):
self.lineEdit_slider.setText( self.lineEdit_slider.setText(
str(stg.time[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), self.slider.value()-1])) str(stg.time[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), self.slider.value()-1]))
def update_bottom_detection_settings(self): 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( self.lineEdit_depth_min_bathy.setText(
str(stg.depth_bottom_detection_min[data_id]) str(stg.depth_bottom_detection_min)
) )
self.lineEdit_depth_max_bathy.setText( self.lineEdit_depth_max_bathy.setText(
str(stg.depth_bottom_detection_max[data_id]) str(stg.depth_bottom_detection_max)
) )
self.lineEdit_next_cell_bathy.setText( self.lineEdit_next_cell_bathy.setText(
str(stg.depth_bottom_detection_interval[data_id]) str(stg.depth_bottom_detection_interval)
) )
def save_bottom_detection_settings(self): def save_bottom_detection_settings(self):
data_id = max(0, self.fileListWidget.currentRow()) stg.depth_bottom_detection_min = float(
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() self.lineEdit_depth_min_bathy.text()
) )
stg.depth_bottom_detection_max[data_id] = float( stg.depth_bottom_detection_max = float(
self.lineEdit_depth_max_bathy.text() self.lineEdit_depth_max_bathy.text()
) )
stg.depth_bottom_detection_interval[data_id] = float( stg.depth_bottom_detection_interval = float(
self.lineEdit_next_cell_bathy.text() self.lineEdit_next_cell_bathy.text()
) )

View File

@ -936,7 +936,6 @@ 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]
) )
@ -1508,39 +1507,121 @@ 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.clear() self.combobox_sand_sample_choice.addItems([f for f, _ in stg.sample_sand])
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[data_id].shape != (0,): if ((stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,)) and
time_data = stg.time_cross_section (stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,))):
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)): 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.where(
time_diff == np.nanmin(time_diff) 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], )[0][0],
np.where( np.where(
depth_diff == np.nanmin(depth_diff) 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] )[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):

View File

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