Compare commits

..

No commits in common. "571ac20d37fb441431f222589aa267bda8a6d696" and "8c7c4cafbcc1175bc708fd64d0144b5e8618d459" have entirely different histories.

6 changed files with 541 additions and 782 deletions

View File

@ -1,23 +1,27 @@
# AcouSed # AcouSed
AcouSed for **Acou**stic Backscattering for Concentration of Suspended **Sed**iments in Rivers is a software developped by INRAE, in collaboation with CNR. AcouSed for **Acou**stic Backscattering for Concentration of Suspended **Sed**iments in Rivers is a software developped by INRAE, in collaboation with CNR.
![](icons/Logo-INRAE.jpg) ![](icons/Logo-INRAE.jpg)
It is divided in six tabs: It is divided in six tabs:
- Acoustic data : acoustic raw data are downloaded and visualised - Acoustic data : acoustic raw data are downloaded and visualised
- Signal preprocessing : acoustic raw signal is preprocessed with filters - Signal preprocessing : acoustic raw signal is preprocessed with filters
- Sample data : fine and sand sediments samples data are downloaded and visualised - Sample data : fine and sand sediments samples data are downloaded and visualised
- Calibration : calibration parameter are computed - Calibration : calibration parameter are computed
- Inversion : inversion method is calculated to provide fine and sand sediments fields - Inversion : inversion method is calculated to provide fine and sand sediments fields
## Installation ## Software documentation
### Installation
Acoused is developped for Linux and Windows on Python version 3.8 or Acoused is developped for Linux and Windows on Python version 3.8 or
greater. By default, Acoused is developped with Pypi package greater. By default, Acoused is developped with Pypi package
dependencies, but is also possible to use Guix package manager to run dependencies, but is also possible to use Guix package manager to run
Acoused. Acoused.
## Development documentation
### **TODO** Windows ### **TODO** Windows
### Linux ### Linux
@ -45,15 +49,16 @@ script `guix.sh` to run the program.
guix shell sqlitebrowser -- ./guix.sh guix shell sqlitebrowser -- ./guix.sh
``` ```
## Support files & References ## License
- [ ] [Acoustic inversion method diagram](https://forgemia.inra.fr/theophile.terraz/acoused/-/blob/main/Acoustic_Inversion_theory.pdf?ref_type=heads) AcouSed
- [ ] [Tutorial AQUAscat software : AQUAtalk](https://forgemia.inra.fr/theophile.terraz/acoused/-/blob/main/Tutorial_AQUAscat_software.pdf?ref_type=heads) Copyright (C) 2024 - INRAE
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- [ ] [Adrien Vergne thesis (2018)](https://theses.fr/2018GREAU046) This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- [ ] [Vergne A., Le Coz J., Berni C., & Pierrefeu G. (2020), Water Resources Research, 56(2)](https://doi.org/10.1029/2019WR024877)
- [ ] [Vergne A., Berni C., Le Coz J., & Tencé F., (2021), Water Resources Research, 57(9)](https://doi.org/10.1029/2021WR029589) You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
## Authors & Contacts ## Authors & Contacts
@ -63,16 +68,15 @@ script `guix.sh` to run the program.
If you have any questions or suggestions, please contact us to celine.berni@inrae.fr and/or jerome.lecoz@inrae.fr. If you have any questions or suggestions, please contact us to celine.berni@inrae.fr and/or jerome.lecoz@inrae.fr.
## Acknowledgment (Funding) ## Acknowledgment (Funding)
This study was conducted within the [Rhône Sediment Observatory](https://observatoire-sediments-rhone.fr/) (OSR), a multi-partner research program funded through the Plan Rhône by the European Regional Development Fund (ERDF), Agence de lEau RMC, CNR, EDF and three regional councils (Auvergne-Rhône-Alpes, PACA and Occitanie). It was also support by CNR.
This study was conducted within the [Rhône Sediment Observatory](https://observatoire-sediments-rhone.fr/) (OSR), a multi-partner research program funded through the Plan Rhône by the European Regional Development Fund (ERDF), Agence de lEau RMC, CNR, EDF and three regional councils (Auvergne-Rhône-Alpes, PACA and Occitanie). It was also support by CNR. ## Support files & References
## License - [ ] [Acoustic inversion method diagram](https://forgemia.inra.fr/theophile.terraz/acoused/-/blob/main/Acoustic_Inversion_theory.pdf?ref_type=heads)
- [ ] [Tutorial AQUAscat software : AQUAtalk](https://forgemia.inra.fr/theophile.terraz/acoused/-/blob/main/Tutorial_AQUAscat_software.pdf?ref_type=heads)
AcouSed
Copyright (C) 2024-2025 - INRAE
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - [ ] [Adrien Vergne thesis (2018)](https://theses.fr/2018GREAU046)
- [ ] [Vergne A., Le Coz J., Berni C., & Pierrefeu G. (2020), Water Resources Research, 56(2)](https://doi.org/10.1029/2019WR024877)
- [ ] [Vergne A., Berni C., Le Coz J., & Tencé F., (2021), Water Resources Research, 57(9)](https://doi.org/10.1029/2021WR029589)
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

File diff suppressed because it is too large Load Diff

View File

@ -147,14 +147,12 @@ class Ui_MainWindow(object):
icon6.addPixmap(QtGui.QPixmap("icons/en.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon6.addPixmap(QtGui.QPixmap("icons/en.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionEnglish.setIcon(icon6) self.actionEnglish.setIcon(icon6)
self.actionEnglish.setObjectName("actionEnglish") self.actionEnglish.setObjectName("actionEnglish")
self.actionEnglish.setEnabled(False)
self.actionFrench = QtWidgets.QAction(self.mainwindow) self.actionFrench = QtWidgets.QAction(self.mainwindow)
icon7 = QtGui.QIcon() icon7 = QtGui.QIcon()
icon7.addPixmap(QtGui.QPixmap("icons/fr.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon7.addPixmap(QtGui.QPixmap("icons/fr.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionFrench.setIcon(icon7) self.actionFrench.setIcon(icon7)
self.actionFrench.setObjectName("actionFrench") self.actionFrench.setObjectName("actionFrench")
self.actionFrench.setEnabled(False)
self.action_ABSCalibrationConstant = QtWidgets.QAction(self.mainwindow) self.action_ABSCalibrationConstant = QtWidgets.QAction(self.mainwindow)
self.action_ABSCalibrationConstant.setText("ABS constant calibration kt") self.action_ABSCalibrationConstant.setText("ABS constant calibration kt")
@ -270,10 +268,7 @@ class Ui_MainWindow(object):
) )
def save(self): def save(self):
if stg.dirname_save_as: UpdateTableForSave()
UpdateTableForSave()
else:
self.save_as()
def open(self): def open(self):
reader = ReadTableForOpen() reader = ReadTableForOpen()

View File

@ -87,13 +87,11 @@ class SedimentCalibrationTab(QWidget):
# 1O units is 100% , 1 units is 10% # 1O units is 100% , 1 units is 10%
self.horizontalLayoutTop = QHBoxLayout() self.horizontalLayoutTop = QHBoxLayout()
self.verticalLayoutMain.addLayout(self.horizontalLayoutTop, 5) # 1O units is 100% , 1 units is 10% self.verticalLayoutMain.addLayout(self.horizontalLayoutTop, 5)
self.horizontalLayoutBottom = QHBoxLayout() self.horizontalLayoutBottom = QHBoxLayout()
self.verticalLayoutMain.addLayout(self.horizontalLayoutBottom, 5) self.verticalLayoutMain.addLayout(self.horizontalLayoutBottom, 5)
# --------------------------------------------------------------------------------------------------------------
self.groupbox_acoustic_data = QGroupBox() self.groupbox_acoustic_data = QGroupBox()
self.horizontalLayoutTop.addWidget(self.groupbox_acoustic_data, 6) self.horizontalLayoutTop.addWidget(self.groupbox_acoustic_data, 6)
@ -120,7 +118,6 @@ class SedimentCalibrationTab(QWidget):
self.groupbox_data_plot = QGroupBox() self.groupbox_data_plot = QGroupBox()
self.horizontalLayout_groupbox_acoustic_data.addWidget(self.groupbox_data_plot, 7) self.horizontalLayout_groupbox_acoustic_data.addWidget(self.groupbox_data_plot, 7)
# --- Groupbox data choice ---
self.verticalLayout_groupbox_data_choice = QVBoxLayout(self.groupbox_data_choice) self.verticalLayout_groupbox_data_choice = QVBoxLayout(self.groupbox_data_choice)
self._setup_widgets_acoustic_data_1() self._setup_widgets_acoustic_data_1()
@ -350,9 +347,6 @@ class SedimentCalibrationTab(QWidget):
self.groupbox_FCB = QGroupBox() self.groupbox_FCB = QGroupBox()
self.horizontalLayoutBottom.addWidget(self.groupbox_FCB, 6) self.horizontalLayoutBottom.addWidget(self.groupbox_FCB, 6)
# +++++++++++++++++++++++++++++++++++++
# +++ Groupbox sediment calibration +++
self.groupbox_sediment_calibration.setTitle("Step 3 : Compute Calibration") self.groupbox_sediment_calibration.setTitle("Step 3 : Compute Calibration")
self.verticalLayout_groupbox_sediment_calibration = QVBoxLayout(self.groupbox_sediment_calibration) self.verticalLayout_groupbox_sediment_calibration = QVBoxLayout(self.groupbox_sediment_calibration)
@ -1606,7 +1600,7 @@ class SedimentCalibrationTab(QWidget):
for k in stg.fine_sample_profile for k in stg.fine_sample_profile
] ]
r_bottom = [stg.depth_bottom[data_choice][ r_bottom = stg.depth_bottom[data_choice][
np.where( np.where(
np.abs( np.abs(
time_data[data_choice][ time_data[data_choice][
@ -1621,7 +1615,7 @@ class SedimentCalibrationTab(QWidget):
- stg.time_fine[stg.fine_sample_profile[-1][1]]) - stg.time_fine[stg.fine_sample_profile[-1][1]])
) )
)[0][0] )[0][0]
] if len(stg.depth_bottom[data_choice])!=0 else np.array([])][0] ]
logger.debug( logger.debug(
"call 'inv_hc.M_profile_SCC_fine_interpolated' params:" "call 'inv_hc.M_profile_SCC_fine_interpolated' params:"
@ -1716,18 +1710,14 @@ class SedimentCalibrationTab(QWidget):
self.animaiton_groupbox_compute.start() self.animaiton_groupbox_compute.start()
def import_calibration_file(self): def import_calibration_file(self):
filename = QFileDialog.getOpenFileName( filename = QFileDialog.getOpenFileName(
self, "Open calibration", self, "Open calibration",
[ [stg.path_calibration_file if stg.path_calibration_file else
stg.path_calibration_file stg.path_BS_raw_data[
if stg.path_calibration_file -1] if self.combobox_acoustic_data_choice.count() > 0 else ""][0],
else stg.path_BS_raw_data[-1]
if self.combobox_acoustic_data_choice.count() > 0
else ""
][0],
"Calibration file (*.xls, *.ods, *csv)", "Calibration file (*.xls, *.ods, *csv)",
options=QFileDialog.DontUseNativeDialog options=QFileDialog.DontUseNativeDialog)
)
dir_name = os.path.dirname(filename[0]) dir_name = os.path.dirname(filename[0])
name = os.path.basename(filename[0]) name = os.path.basename(filename[0])
@ -1740,189 +1730,114 @@ class SedimentCalibrationTab(QWidget):
self.lineEdit_import_calibration.setToolTip(dir_name) self.lineEdit_import_calibration.setToolTip(dir_name)
self.compute_depth_2D()
self.read_calibration_file_and_fill_parameter() self.read_calibration_file_and_fill_parameter()
def update_label_freq1_for_calibration(self): def update_label_freq1_for_calibration(self):
self.label_freq1.clear() self.label_freq1.clear()
self.label_freq1.setText( self.label_freq1.setText(str(self.combobox_freq1.currentText()))
str(self.combobox_freq1.currentText())
)
def update_label_freq2_for_calibration(self): def update_label_freq2_for_calibration(self):
self.label_freq2.clear() self.label_freq2.clear()
self.label_freq2.setText( self.label_freq2.setText(self.combobox_freq2.currentText())
self.combobox_freq2.currentText()
)
def update_label_kt_value_for_calibration(self): def update_label_kt_value_for_calibration(self):
print("self.combobox_freq1.currentIndex() ",
self.combobox_freq1.currentIndex(),
self.combobox_freq1.currentText())
freq_1 = self.combobox_freq1.currentIndex()
freq_2 = self.combobox_freq2.currentIndex()
self.label_kt_freq1.clear() self.label_kt_freq1.clear()
if stg.kt_corrected[freq_1] != stg.kt_read[freq_1]: print("self.combobox_freq1.currentIndex() ", self.combobox_freq1.currentIndex(), self.combobox_freq1.currentText())
self.label_kt_freq1.setText( if stg.kt_corrected[self.combobox_freq1.currentIndex()] != stg.kt_read[self.combobox_freq1.currentIndex()]:
str('%.4f' % stg.kt_corrected[freq_1]) self.label_kt_freq1.setText(str('%.4f' % stg.kt_corrected[self.combobox_freq1.currentIndex()]))
)
else: else:
self.label_kt_freq1.setText( self.label_kt_freq1.setText(str('%.4f' % stg.kt_read[self.combobox_freq1.currentIndex()]))
str('%.4f' % stg.kt_read[freq_1])
)
self.label_kt_freq2.clear() self.label_kt_freq2.clear()
if stg.kt_corrected[freq_2] != stg.kt_read[freq_2]: if stg.kt_corrected[self.combobox_freq2.currentIndex()] != stg.kt_read[self.combobox_freq2.currentIndex()]:
self.label_kt_freq2.setText( self.label_kt_freq2.setText(str('%.4f' % stg.kt_corrected[self.combobox_freq2.currentIndex()]))
str('%.4f' % stg.kt_corrected[freq_2])
)
else: else:
self.label_kt_freq2.setText( self.label_kt_freq2.setText(str('%.4f' % stg.kt_read[self.combobox_freq2.currentIndex()]))
str('%.4f' % stg.kt_read[freq_2])
)
def read_calibration_file_and_fill_parameter(self): def read_calibration_file_and_fill_parameter(self):
if self.combobox_acoustic_data_choice.count() == 0: if self.combobox_acoustic_data_choice.count() == 0:
msgBox = QMessageBox() msgBox = QMessageBox()
msgBox.setWindowTitle("Calibration import error") msgBox.setWindowTitle("Calibration import error")
msgBox.setIconPixmap( msgBox.setIconPixmap(
QPixmap( QPixmap(self._path_icon("no_approved.png")).scaledToHeight(32, Qt.SmoothTransformation))
self._path_icon("no_approved.png")
).scaledToHeight(32, Qt.SmoothTransformation)
)
msgBox.setText("Update data before importing calibration") msgBox.setText("Update data before importing calibration")
msgBox.setStandardButtons(QMessageBox.Ok) msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec() msgBox.exec()
else: else:
# --- Read calibration file --- # --- Read calibration file ---
data = pd.read_csv( data = pd.read_csv(stg.path_calibration_file + "/" + stg.filename_calibration_file, header=0, index_col=0)
os.path.join(
stg.path_calibration_file,
stg.filename_calibration_file
),
header=0, index_col=0
)
# --- Fill spinboxes of calibration parameter --- # --- Fill spinboxes of calibration parameter ---
self.label_temperature.clear() self.label_temperature.clear()
self.label_temperature.setText( self.label_temperature.setText("T = " + str(stg.temperature) + " °C")
"T = " + str(stg.temperature) + " °C"
)
self.label_freq1.clear() self.label_freq1.clear()
self.label_freq1.setText(data.columns[0]) self.label_freq1.setText(data.columns[0])
data_id = self.combobox_acoustic_data_choice.currentIndex() index_freq1 = np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) ==
data.columns[0])[0][0]
index_freq1 = np.where(
np.asarray(
stg.freq_text[data_id]
) == data.columns[0]
)[0][0]
stg.frequencies_for_calibration.clear() stg.frequencies_for_calibration.clear()
stg.frequencies_for_calibration.append( stg.frequencies_for_calibration.append((stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
( index_freq1],
stg.freq[data_id][index_freq1], index_freq1))
index_freq1
)
)
self.label_freq2.clear() self.label_freq2.clear()
self.label_freq2.setText(data.columns[1]) self.label_freq2.setText(data.columns[1])
index_freq2 = np.where( index_freq2 = np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) ==
np.asarray( data.columns[1])[0][0]
stg.freq_text[data_id] stg.frequencies_for_calibration.append((stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
) == data.columns[1] index_freq2],
)[0][0] index_freq2))
stg.frequencies_for_calibration.append(
(
stg.freq[data_id][index_freq2],
index_freq2
)
)
stg.frequency_for_inversion = tuple() stg.frequency_for_inversion = tuple()
stg.frequency_for_inversion = ( stg.frequency_for_inversion = (stg.freq[self.combobox_acoustic_data_choice.currentIndex()][index_freq2],
stg.freq[data_id][index_freq2], index_freq2)
index_freq2
)
self.lineEdit_ks_freq1.clear() self.lineEdit_ks_freq1.clear()
self.lineEdit_ks_freq1.setText( self.lineEdit_ks_freq1.setText(str("%.5f" % float(data.iloc[0][0])))
str("%.5f" % float(data.iloc[0][0]))
)
self.lineEdit_ks_freq2.clear() self.lineEdit_ks_freq2.clear()
self.lineEdit_ks_freq2.setText( self.lineEdit_ks_freq2.setText(str("%.5f" % float(data.iloc[0][1])))
str("%.5f" % float(data.iloc[0][1]))
)
stg.ks.clear() stg.ks.clear()
stg.ks = [ stg.ks = [float(self.lineEdit_ks_freq1.text()), float(self.lineEdit_ks_freq2.text())]
float(self.lineEdit_ks_freq1.text()),
float(self.lineEdit_ks_freq2.text())
]
self.lineEdit_sv_freq1.clear() self.lineEdit_sv_freq1.clear()
self.lineEdit_sv_freq1.setText( self.lineEdit_sv_freq1.setText(str("%.5f" % float(data.iloc[1][0])))
str("%.5f" % float(data.iloc[1][0]))
)
self.lineEdit_sv_freq2.clear() self.lineEdit_sv_freq2.clear()
self.lineEdit_sv_freq2.setText( self.lineEdit_sv_freq2.setText(str("%.5f" % float(data.iloc[1][1])))
str("%.5f" % float(data.iloc[1][1]))
)
stg.sv.clear() stg.sv.clear()
stg.sv = [ stg.sv = [float(self.lineEdit_sv_freq1.text()), float(self.lineEdit_sv_freq2.text())]
float(self.lineEdit_sv_freq1.text()),
float(self.lineEdit_sv_freq2.text())
]
self.lineEdit_X.clear() self.lineEdit_X.clear()
self.lineEdit_X.setText( self.lineEdit_X.setText(str("%.2f" % float(data.iloc[2][0])))
str("%.2f" % float(data.iloc[2][0]))
)
stg.X_exponent.clear() stg.X_exponent.clear()
stg.X_exponent.append(float(self.lineEdit_X.text())) stg.X_exponent.append(float(self.lineEdit_X.text()))
self.lineEdit_alphas_freq1.clear() self.lineEdit_alphas_freq1.clear()
self.lineEdit_alphas_freq1.setText( self.lineEdit_alphas_freq1.setText(str("%.5f" % float(data.iloc[3][0])))
str("%.5f" % float(data.iloc[3][0]))
)
self.lineEdit_alphas_freq2.clear() self.lineEdit_alphas_freq2.clear()
self.lineEdit_alphas_freq2.setText( self.lineEdit_alphas_freq2.setText(str("%.5f" % float(data.iloc[3][1])))
str("%.5f" % float(data.iloc[3][1]))
)
stg.alpha_s.clear() stg.alpha_s.clear()
stg.alpha_s = [ stg.alpha_s = [float(self.lineEdit_alphas_freq1.text()), float(self.lineEdit_alphas_freq2.text())]
float(self.lineEdit_alphas_freq1.text()),
float(self.lineEdit_alphas_freq2.text())
]
self.lineEdit_zeta_freq1.clear() self.lineEdit_zeta_freq1.clear()
self.lineEdit_zeta_freq1.setText( self.lineEdit_zeta_freq1.setText(str("%.5f" % float(data.iloc[4][0])))
str("%.5f" % float(data.iloc[4][0]))
)
self.lineEdit_zeta_freq2.clear() self.lineEdit_zeta_freq2.clear()
self.lineEdit_zeta_freq2.setText( self.lineEdit_zeta_freq2.setText(str("%.5f" % float(data.iloc[4][1])))
str("%.5f" % float(data.iloc[4][1]))
)
stg.zeta.clear() stg.zeta.clear()
stg.zeta = [ stg.zeta = [float(self.lineEdit_zeta_freq1.text()), float(self.lineEdit_zeta_freq2.text())]
float(self.lineEdit_zeta_freq1.text()),
float(self.lineEdit_zeta_freq2.text())
]
self.compute_kt2D_kt3D() self.compute_kt2D_kt3D()
self.compute_J_cross_section() self.compute_J_cross_section()
@ -1996,6 +1911,9 @@ class SedimentCalibrationTab(QWidget):
axis=1)) axis=1))
def function_pushbutton_compute_calibration(self): def function_pushbutton_compute_calibration(self):
if len(stg.sand_sample_target_indice) == 0:
self._data_validity_message_box()
return
self.label_temperature.clear() self.label_temperature.clear()
self.label_temperature.setText("T = " + str(stg.temperature) + " °C") self.label_temperature.setText("T = " + str(stg.temperature) + " °C")
@ -2010,8 +1928,6 @@ class SedimentCalibrationTab(QWidget):
self.compute_zeta() self.compute_zeta()
def compute_ks(self): def compute_ks(self):
data_id = self.combobox_acoustic_data_choice.currentIndex()
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], num_sample=stg.sand_sample_target[0][1],
@ -2022,13 +1938,17 @@ class SedimentCalibrationTab(QWidget):
ks_freq1 = self.inv_hc.ks( ks_freq1 = self.inv_hc.ks(
proba_num=psd_number_of_particles, proba_num=psd_number_of_particles,
freq=stg.freq[data_id][self.combobox_freq1.currentIndex()], freq=stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq1.currentIndex()
],
C=stg.water_velocity C=stg.water_velocity
) )
ks_freq2 = self.inv_hc.ks( ks_freq2 = self.inv_hc.ks(
proba_num=psd_number_of_particles, proba_num=psd_number_of_particles,
freq=stg.freq[data_id][self.combobox_freq2.currentIndex()], freq=stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex()
],
C=stg.water_velocity C=stg.water_velocity
) )
@ -2036,12 +1956,12 @@ class SedimentCalibrationTab(QWidget):
logger.debug( logger.debug(
"ks for frequency of " "ks for frequency of "
+ f"{stg.freq[data_id][self.combobox_freq1.currentIndex()]} : " + f"{stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex()]} : "
+ f"{ks_freq1} m/kg^0.5 \n" + f"{ks_freq1} m/kg^0.5 \n"
) )
logger.debug( logger.debug(
"ks for frequency of " "ks for frequency of "
+ f"{stg.freq[data_id][self.combobox_freq2.currentIndex()]} : " + + f"{stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex()]} : " +
f"{ks_freq2} m/kg^0.5" f"{ks_freq2} m/kg^0.5"
) )
@ -2052,21 +1972,13 @@ 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):
data_id = self.combobox_acoustic_data_choice.currentIndex()
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]])
stg.sv = [sv_freq1, sv_freq2] stg.sv = [sv_freq1, sv_freq2]
print( print(f"sv for frequency of {stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex()]} : {sv_freq1:.8f} /m \n")
f"sv for frequency of {stg.freq[data_id][self.combobox_freq1.currentIndex()]}" print(f"sv for frequency of {stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex()]} : {sv_freq2:.8f} /m")
+ f" : {sv_freq1:.8f} /m \n"
)
print(
f"sv for frequency of {stg.freq[data_id][self.combobox_freq2.currentIndex()]}"
+ f" : {sv_freq2:.8f} /m"
)
self.lineEdit_sv_freq1.clear() self.lineEdit_sv_freq1.clear()
self.lineEdit_sv_freq1.setText(str("%.5f" % sv_freq1)) self.lineEdit_sv_freq1.setText(str("%.5f" % sv_freq1))
@ -2075,13 +1987,9 @@ 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):
data_id = self.combobox_acoustic_data_choice.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()],
X_exponent = self.inv_hc.X_exponent( sv_freq1=stg.sv[0], sv_freq2=stg.sv[1])
freq1=stg.freq[data_id][self.combobox_freq1.currentIndex()],
freq2=stg.freq[data_id][self.combobox_freq2.currentIndex()],
sv_freq1=stg.sv[0], sv_freq2=stg.sv[1]
)
stg.X_exponent.clear() stg.X_exponent.clear()
stg.X_exponent.append(X_exponent) stg.X_exponent.append(X_exponent)
@ -2124,89 +2032,190 @@ class SedimentCalibrationTab(QWidget):
) )
def compute_J_cross_section(self): def compute_J_cross_section(self):
lst_bs_data = [
stg.BS_stream_bed_pre_process_average,
stg.BS_stream_bed_pre_process_SNR,
stg.BS_stream_bed,
stg.BS_cross_section_pre_process_average,
stg.BS_cross_section_pre_process_SNR,
stg.BS_cross_section,
stg.BS_raw_data_pre_process_average,
stg.BS_raw_data_pre_process_SNR,
stg.BS_raw_data
]
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([])
J_cross_section_freq2 = np.array([]) J_cross_section_freq2 = np.array([])
for data in lst_bs_data: # --- Compute J ---
if data[i].shape != (0,): if stg.BS_stream_bed_pre_process_average[i].shape != (0,):
bs_data = data
break
print(f"{stg.depth_2D[i].shape}") J_cross_section_freq1 = self.inv_hc.j_cross_section(
print(f"{stg.depth_2D[i]}") BS=stg.BS_stream_bed_pre_process_average[i][
stg.frequencies_for_calibration[0][1], :, :],
r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1],
:, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[0][1], :, :])
J_cross_section_freq1 = self.inv_hc.j_cross_section( J_cross_section_freq2 = self.inv_hc.j_cross_section(
BS = bs_data[i][ BS=stg.BS_stream_bed_pre_process_average[i][
stg.frequencies_for_calibration[0][1], :, : stg.frequencies_for_calibration[1][1], :, :],
], r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1],
r2D = stg.depth_2D[i][ :, :],
stg.frequencies_for_calibration[0][1], :, : kt=stg.kt3D[i][stg.frequencies_for_calibration[1][1], :, :])
],
kt = stg.kt3D[i][
stg.frequencies_for_calibration[0][1], :, :
]
)
J_cross_section_freq2 = self.inv_hc.j_cross_section( elif stg.BS_stream_bed_pre_process_SNR[i].shape != (0,):
BS = bs_data[i][
stg.frequencies_for_calibration[1][1], :, : J_cross_section_freq1 = self.inv_hc.j_cross_section(
], BS=stg.BS_stream_bed_pre_process_SNR[i][
r2D = stg.depth_2D[i][ stg.frequencies_for_calibration[0][1], :, :],
stg.frequencies_for_calibration[1][1], :, : r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1],
], :, :],
kt = stg.kt3D[i][ kt=stg.kt3D[i][stg.frequencies_for_calibration[0][1], :, :])
stg.frequencies_for_calibration[1][1], :, :
] J_cross_section_freq2 = self.inv_hc.j_cross_section(
) BS=stg.BS_stream_bed_pre_process_SNR[i][
stg.frequencies_for_calibration[1][1], :, :],
r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1],
:, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[1][1], :, :])
elif stg.BS_stream_bed[i].shape != (0,):
J_cross_section_freq1 = self.inv_hc.j_cross_section(
BS=stg.BS_stream_bed[i][stg.frequencies_for_calibration[0][1], :, :],
r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1], :, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[0][1], :, :])
J_cross_section_freq2 = self.inv_hc.j_cross_section(
BS=stg.BS_stream_bed[i][
stg.frequencies_for_calibration[1][1], :, :],
r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1], :, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[1][1], :, :])
elif stg.BS_cross_section_pre_process_average[i].shape != (0,):
J_cross_section_freq1 = self.inv_hc.j_cross_section(
BS=stg.BS_cross_section_pre_process_average[i][
stg.frequencies_for_calibration[0][1], :, :],
r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1],
:, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[0][1], :, :])
J_cross_section_freq2 = self.inv_hc.j_cross_section(
BS=stg.BS_cross_section_pre_process_average[i][
stg.frequencies_for_calibration[1][1], :, :],
r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1],
:, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[1][1], :, :])
elif stg.BS_cross_section_pre_process_SNR[i].shape != (0,):
J_cross_section_freq1 = self.inv_hc.j_cross_section(
BS=stg.BS_cross_section_pre_process_SNR[i][
stg.frequencies_for_calibration[0][1], :, :],
r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1],
:, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[0][1], :, :])
J_cross_section_freq2 = self.inv_hc.j_cross_section(
BS=stg.BS_cross_section_pre_process_SNR[i][
stg.frequencies_for_calibration[1][1], :, :],
r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1],
:, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[1][1], :, :])
elif stg.BS_cross_section[i].shape != (0,):
J_cross_section_freq1 = self.inv_hc.j_cross_section(
BS=stg.BS_cross_section[i][
stg.frequencies_for_calibration[0][1], :, :],
r2D=stg.depth_2D[i, :, :][stg.frequencies_for_calibration[0][1], :, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[0][1], :, :])
J_cross_section_freq2 = self.inv_hc.j_cross_section(
BS=stg.BS_cross_section[i][
stg.frequencies_for_calibration[1][1], :, :],
r2D=stg.depth_2D[i, :, :][stg.frequencies_for_calibration[1][1], :, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[1][1], :, :])
elif stg.BS_raw_data_pre_process_average[i].shape != (0,):
J_cross_section_freq1 = self.inv_hc.j_cross_section(
BS=stg.BS_raw_data_pre_process_average[i][
stg.frequencies_for_calibration[0][1], :, :],
r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1], :, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[0][1], :, :])
J_cross_section_freq2 = self.inv_hc.j_cross_section(
BS=stg.BS_raw_data_pre_process_average[i][
stg.frequencies_for_calibration[1][1], :, :],
r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1], :, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[1][1], :, :])
elif stg.BS_raw_data_pre_process_SNR[i].shape != (0,):
J_cross_section_freq1 = self.inv_hc.j_cross_section(
BS=stg.BS_raw_data_pre_process_SNR[i][
stg.frequencies_for_calibration[0][1], :, :],
r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1], :, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[0][1], :, :])
J_cross_section_freq2 = self.inv_hc.j_cross_section(
BS=stg.BS_raw_data_pre_process_SNR[i][
stg.frequencies_for_calibration[1][1], :, :],
r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1], :, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[1][1], :, :])
elif stg.BS_raw_data:
J_cross_section_freq1 = self.inv_hc.j_cross_section(
BS=stg.BS_raw_data[i][
stg.frequencies_for_calibration[0][1], :, :],
r2D=stg.depth_2D[i][stg.frequencies_for_calibration[0][1], :, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[0][1], :, :])
J_cross_section_freq2 = self.inv_hc.j_cross_section(
BS=stg.BS_raw_data[i][
stg.frequencies_for_calibration[1][1], :, :],
r2D=stg.depth_2D[i][stg.frequencies_for_calibration[1][1], :, :],
kt=stg.kt3D[i][stg.frequencies_for_calibration[1][1], :, :])
stg.J_cross_section[i][0] = J_cross_section_freq1 stg.J_cross_section[i][0] = J_cross_section_freq1
stg.J_cross_section[i][1] = J_cross_section_freq2 stg.J_cross_section[i][1] = J_cross_section_freq2
def compute_alpha_s(self): def compute_alpha_s(self):
data_id = self.combobox_acoustic_data_choice.currentIndex()
freq_1 = self.combobox_freq1.currentIndex()
freq_2 = self.combobox_freq2.currentIndex()
depth_data = stg.depth # --- Compute alpha_s ---
if stg.depth_cross_section[data_id].shape != (0,): if stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
depth_data = stg.depth_cross_section
alpha_s_freq1 = self.inv_hc.alpha_s( alpha_s_freq1 = self.inv_hc.alpha_s(
sv=stg.sv[0], sv=stg.sv[0],
j_cross_section=stg.J_cross_section[data_id][0][ j_cross_section=stg.J_cross_section[self.combobox_acoustic_data_choice.currentIndex()][0][
stg.sand_sample_target_indice[0][0], stg.sand_sample_target_indice[0][0], stg.sand_sample_target_indice[0][1]],
stg.sand_sample_target_indice[0][1] depth=stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
], self.combobox_freq1.currentIndex(), stg.sand_sample_target_indice[0][0]],
depth=depth_data[data_id][ alpha_w=stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
freq_1, stg.sand_sample_target_indice[0][0] self.combobox_freq1.currentIndex()])
],
alpha_w=stg.water_attenuation[data_id][freq_1]
)
alpha_s_freq2 = self.inv_hc.alpha_s( alpha_s_freq2 = self.inv_hc.alpha_s(
sv=stg.sv[1], sv=stg.sv[1],
j_cross_section=stg.J_cross_section[data_id][1][ j_cross_section=stg.J_cross_section[self.combobox_acoustic_data_choice.currentIndex()][1][
stg.sand_sample_target_indice[1][0], stg.sand_sample_target_indice[1][0], stg.sand_sample_target_indice[1][1]],
stg.sand_sample_target_indice[1][1] depth=stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
], self.combobox_freq2.currentIndex(), stg.sand_sample_target_indice[1][0]],
depth=depth_data[data_id][ alpha_w=stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
freq_2, stg.sand_sample_target_indice[1][0] self.combobox_freq2.currentIndex()])
],
alpha_w=stg.water_attenuation[data_id][freq_2] else:
)
alpha_s_freq1 = self.inv_hc.alpha_s(
sv=stg.sv[0],
j_cross_section=stg.J_cross_section[self.combobox_acoustic_data_choice.currentIndex()][0][
stg.sand_sample_target_indice[0][0], stg.sand_sample_target_indice[0][1]],
depth=stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq1.currentIndex(), stg.sand_sample_target_indice[0][0]],
alpha_w=stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq1.currentIndex()])
alpha_s_freq2 = self.inv_hc.alpha_s(
sv=stg.sv[1],
j_cross_section=stg.J_cross_section[self.combobox_acoustic_data_choice.currentIndex()][1][
stg.sand_sample_target_indice[1][0], stg.sand_sample_target_indice[1][1]],
depth=stg.depth[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex(), stg.sand_sample_target_indice[1][0]],
alpha_w=stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_freq2.currentIndex()])
stg.alpha_s = [alpha_s_freq1, alpha_s_freq2] stg.alpha_s = [alpha_s_freq1, alpha_s_freq2]
@ -2220,25 +2229,19 @@ class SedimentCalibrationTab(QWidget):
self.lineEdit_alphas_freq2.setText(str("%.5f" % alpha_s_freq2)) self.lineEdit_alphas_freq2.setText(str("%.5f" % alpha_s_freq2))
if (alpha_s_freq1 < 0) or (alpha_s_freq2 < 0): if (alpha_s_freq1 < 0) or (alpha_s_freq2 < 0):
msgBox = QMessageBox() msgBox = QMessageBox()
msgBox.setWindowTitle("Alpha computation error") msgBox.setWindowTitle("Alpha computation error")
msgBox.setIconPixmap( msgBox.setIconPixmap(QPixmap(self._path_icon("no_approved.png")).scaledToHeight(32, Qt.SmoothTransformation))
QPixmap(
self._path_icon("no_approved.png")
).scaledToHeight(32, Qt.SmoothTransformation)
)
msgBox.setText("Sediment sound attenuation is negative !") msgBox.setText("Sediment sound attenuation is negative !")
msgBox.setStandardButtons(QMessageBox.Ok) msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec() msgBox.exec()
else: else:
msgBox = QMessageBox() msgBox = QMessageBox()
msgBox.setWindowTitle("Alpha computation validation") msgBox.setWindowTitle("Alpha computation validation")
msgBox.setIconPixmap( msgBox.setIconPixmap(QPixmap(self._path_icon("approved.png")).scaledToHeight(32, Qt.SmoothTransformation))
QPixmap(
self._path_icon("approved.png")
).scaledToHeight(32, Qt.SmoothTransformation)
)
msgBox.setText("Sediment sound attenuation is positive.") msgBox.setText("Sediment sound attenuation is positive.")
msgBox.setStandardButtons(QMessageBox.Ok) msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec() msgBox.exec()

View File

@ -647,9 +647,6 @@ class SignalProcessingTab(QWidget):
stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()] = ( stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()] = (
np.nanmean(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][:, :, val1:val2], axis=2)) np.nanmean(stg.BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][:, :, val1:val2], axis=2))
if stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.compute_noise_from_profile_tail_value()
def plot_averaged_profile_tail(self): def plot_averaged_profile_tail(self):
# --- Plot averaged signal --- # --- Plot averaged signal ---
@ -935,7 +932,7 @@ class SignalProcessingTab(QWidget):
# --- Compute noise from value and compute SNR --- # --- Compute noise from value and compute SNR ---
if stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,): if stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = ( stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = (
np.full(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape, np.full(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape,
float(self.lineEdit_profile_tail_value.text().replace(",", ".")))) float(self.lineEdit_profile_tail_value.text().replace(",", "."))))
@ -995,7 +992,7 @@ class SignalProcessingTab(QWidget):
self.plot_pre_processed_BS_signal() self.plot_pre_processed_BS_signal()
self.plot_pre_processed_profile() self.plot_pre_processed_profile()
# self.activate_list_of_pre_processed_data() self.activate_list_of_pre_processed_data()
def plot_noise(self): def plot_noise(self):
self.horizontalLayout_groupbox_plot_noise_data.removeWidget(self.canvas_noise) self.horizontalLayout_groupbox_plot_noise_data.removeWidget(self.canvas_noise)

View File

@ -33,8 +33,7 @@ logging.basicConfig(
) )
logger = logging.getLogger() logger = logging.getLogger()
# logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
logger.setLevel(logging.INFO)
class MainApplication(QMainWindow): class MainApplication(QMainWindow):
@ -54,6 +53,7 @@ class MainApplication(QMainWindow):
# -------------- Acoustic data tab --------------- # -------------- Acoustic data tab ---------------
self.acoustic_data_tab = AcousticDataTab(self.ui_mainwindow.tab1) self.acoustic_data_tab = AcousticDataTab(self.ui_mainwindow.tab1)
print("0 AcousticDataTab ", id(AcousticDataTab))
self.acoustic_data_tab\ self.acoustic_data_tab\
.combobox_ABS_system_choice\ .combobox_ABS_system_choice\