Compare commits

..

5 Commits

9 changed files with 139 additions and 80 deletions

View File

@ -31,13 +31,13 @@ class AboutWindow(QDialog):
super().__init__() super().__init__()
self.logo_path = "./Logo" self.logo_path = "./logos"
self.logo_AcouSed = QPixmap(self.logo_path + "/" + "Logo_AcouSed_AboutAcouSedWindow.png") self.logo_AcouSed = QPixmap(self.logo_path + "/" + "AcouSed.png")
self.logo_AcouSed.scaled(16, 16, Qt.KeepAspectRatio, Qt.SmoothTransformation) self.logo_AcouSed.scaled(16, 16, Qt.KeepAspectRatio, Qt.SmoothTransformation)
self.logo_INRAE = QPixmap(self.logo_path + "/" + "BlocMarque-INRAE-Inter.jpg") self.logo_INRAE = QPixmap(self.logo_path + "/" + "BlocMarque-INRAE-Inter.jpg")
self.setGeometry(400, 200, 300, 200) self.setGeometry(400, 200, 350, 200)
self.setWindowTitle("About AcouSed") self.setWindowTitle("About AcouSed")
@ -51,7 +51,7 @@ class AboutWindow(QDialog):
self.label_logo_AcouSed = QLabel() self.label_logo_AcouSed = QLabel()
self.label_logo_AcouSed.setPixmap(self.logo_AcouSed.scaledToHeight(128, Qt.SmoothTransformation)) self.label_logo_AcouSed.setPixmap(self.logo_AcouSed.scaledToHeight(128, Qt.SmoothTransformation))
self.gridLayout.addWidget(self.label_logo_AcouSed, 0, 0, 3, 1, Qt.AlignCenter) self.gridLayout.addWidget(self.label_logo_AcouSed, 0, 0, 5, 1, Qt.AlignCenter)
self.label_acoused = QLabel() self.label_acoused = QLabel()
self.label_acoused.setText("Acoused 2.0") self.label_acoused.setText("Acoused 2.0")
@ -70,7 +70,13 @@ class AboutWindow(QDialog):
self.label_contact = QLabel() self.label_contact = QLabel()
self.label_contact.setText("Contact : celine.berni@inrae.fr \n" self.label_contact.setText("Contact : celine.berni@inrae.fr \n"
" jerome.lecoz@inrae.fr") " jerome.lecoz@inrae.fr")
self.gridLayout.addWidget(self.label_contact, 3, 1, 1, 1, Qt.AlignLeft) self.gridLayout.addWidget(self.label_contact, 3, 1, 1, 1, Qt.AlignCenter)
self.label_link = QLabel()
self.label_link.setText("< a href = https://forgemia.inra.fr/theophile.terraz/acoused > "
"https://forgemia.inra.fr/theophile.terraz/acoused </a>")
self.label_link.setOpenExternalLinks(True)
self.gridLayout.addWidget(self.label_link, 4, 1, 1, 1, Qt.AlignCenter)
# ---------------------------------------------------------- # ----------------------------------------------------------
@ -179,7 +185,7 @@ class Support(QDialog):
super().__init__() super().__init__()
self.logo_path = "./Logo" self.logo_path = "./logos"
self.logo_OSR = QPixmap(self.logo_path + '/' + "OSR.png") self.logo_OSR = QPixmap(self.logo_path + '/' + "OSR.png")
self.logo_CNR = QPixmap(self.logo_path + '/' + "CNR.png") self.logo_CNR = QPixmap(self.logo_path + '/' + "CNR.png")

View File

@ -626,17 +626,19 @@ class AcousticDataTab(QWidget):
self.delBtn.clicked.connect(self.remove_file_from_ListWidget) self.delBtn.clicked.connect(self.remove_file_from_ListWidget)
self.clearBtn.clicked.connect(self.clear_files_from_ListWidget) self.clearBtn.clicked.connect(self.clear_files_from_ListWidget)
self.fileListWidget.itemSelectionChanged.connect(self.print_selected_file) self.fileListWidget.itemSelectionChanged.connect(self.fileListWidget_event)
self.fileListWidget.itemSelectionChanged.connect(self.fill_measurements_information_groupbox)
self.fileListWidget.itemSelectionChanged.connect(self.fill_table) # self.fileListWidget.itemSelectionChanged.connect(self.print_selected_file)
self.fileListWidget.itemSelectionChanged.connect(self.compute_tmin_tmax) # self.fileListWidget.itemSelectionChanged.connect(self.fill_measurements_information_groupbox)
self.fileListWidget.itemSelectionChanged.connect(self.compute_rmin_rmax) # self.fileListWidget.itemSelectionChanged.connect(self.fill_table)
self.fileListWidget.itemSelectionChanged.connect(self.update_frequency_combobox) # self.fileListWidget.itemSelectionChanged.connect(self.compute_tmin_tmax)
# self.fileListWidget.itemSelectionChanged.connect(self.plot_backscattered_acoustic_signal_recording) # self.fileListWidget.itemSelectionChanged.connect(self.compute_rmin_rmax)
# self.fileListWidget.itemSelectionChanged.connect(self.plot_profile) # self.fileListWidget.itemSelectionChanged.connect(self.update_frequency_combobox)
self.fileListWidget.itemSelectionChanged.connect(self.update_plot_backscattered_acoustic_signal_recording) # # self.fileListWidget.itemSelectionChanged.connect(self.plot_backscattered_acoustic_signal_recording)
self.fileListWidget.itemSelectionChanged.connect(self.update_plot_profile) # # self.fileListWidget.itemSelectionChanged.connect(self.plot_profile)
self.fileListWidget.itemSelectionChanged.connect(self.set_range_for_spinboxes_bathymetry) # self.fileListWidget.itemSelectionChanged.connect(self.update_plot_backscattered_acoustic_signal_recording)
# self.fileListWidget.itemSelectionChanged.connect(self.update_plot_profile)
# self.fileListWidget.itemSelectionChanged.connect(self.set_range_for_spinboxes_bathymetry)
self.combobox_ABS_name.currentIndexChanged.connect(self.fill_measurements_information_groupbox) self.combobox_ABS_name.currentIndexChanged.connect(self.fill_measurements_information_groupbox)
@ -744,6 +746,20 @@ class AcousticDataTab(QWidget):
self.groupbox_transect_2Dplot_raw_BS_data.setTitle(_translate("CONSTANT_STRING", cs.RAW_ACOUSTIC_DATA_2D_FIELD)) self.groupbox_transect_2Dplot_raw_BS_data.setTitle(_translate("CONSTANT_STRING", cs.RAW_ACOUSTIC_DATA_2D_FIELD))
def fileListWidget_event(self):
self.print_selected_file()
self.fill_measurements_information_groupbox()
self.fill_table()
self.compute_tmin_tmax()
self.compute_rmin_rmax()
self.update_frequency_combobox()
# self.fileListWidget.itemSelectionChanged.connect(self.plot_backscattered_acoustic_signal_recording)
# self.fileListWidget.itemSelectionChanged.connect(self.plot_profile)
self.update_plot_backscattered_acoustic_signal_recording()
self.update_plot_profile()
self.set_range_for_spinboxes_bathymetry()
def print_selected_file(self): def print_selected_file(self):
print(f"Selected file in list widget : {self.fileListWidget.selectedItems()}") print(f"Selected file in list widget : {self.fileListWidget.selectedItems()}")
print("self.fileListWidget.selectedItems()[1:] : ", self.fileListWidget.selectedItems()[1:]) print("self.fileListWidget.selectedItems()[1:] : ", self.fileListWidget.selectedItems()[1:])
@ -1365,13 +1381,18 @@ class AcousticDataTab(QWidget):
del current_item del current_item
# --- Clear variables --- # --- Clear variables ---
list_to_pop1 = ["stg.acoustic_data", "stg.date", "stg.hour", "stg.freq", "stg.freq_text", "stg.temperature", list_to_pop1 = [
"stg.nb_profiles", "stg.nb_profiles_per_sec", "stg.nb_cells", "stg.cell_size", "stg.acoustic_data", "stg.date", "stg.hour",
"stg.pulse_length", "stg.nb_pings_per_sec", "stg.nb_pings_averaged_per_profile", "stg.freq", "stg.freq_text",
"stg.kt_read", "stg.kt_corrected", "stg.gain_rx", "stg.gain_tx", "stg.nb_profiles", "stg.nb_profiles_per_sec",
"stg.filename_BS_raw_data", "stg.path_BS_raw_data", "stg.nb_cells", "stg.cell_size",
"stg.BS_raw_data", "stg.time", "stg.depth", "stg.pulse_length", "stg.nb_pings_per_sec",
"stg.BS_raw_data_reshape", "stg.time_reshape", "stg.depth_reshape"] "stg.nb_pings_averaged_per_profile",
"stg.kt_read", "stg.kt_corrected", "stg.gain_rx", "stg.gain_tx",
"stg.filename_BS_raw_data", "stg.path_BS_raw_data",
"stg.BS_raw_data", "stg.time", "stg.depth",
"stg.BS_raw_data_reshape", "stg.time_reshape", "stg.depth_reshape"
]
for p in list_to_pop1: for p in list_to_pop1:
if isinstance(eval(p), list): if isinstance(eval(p), list):
@ -1380,11 +1401,19 @@ class AcousticDataTab(QWidget):
if stg.BS_cross_section: if stg.BS_cross_section:
list_to_pop2 = ["stg.rmin", "stg.rmax", "stg.tmin", "stg.tmax", list_to_pop2 = ["stg.rmin", "stg.rmax", "stg.tmin", "stg.tmax",
"stg.time_cross_section", "stg.BS_cross_section"] "stg.time_cross_section", "stg.depth_cross_section", "stg.BS_cross_section"]
for k in list_to_pop2: for k in list_to_pop2:
exec(k + ".pop(current_row)") exec(k + ".pop(current_row)")
if stg.BS_stream_bed:
list_to_pop3 = ["stg.BS_stream_bed", "stg.depth_bottom",
"stg.val_bottom", "stg.ind_bottom", "stg.freq_bottom_detection"]
for s in list_to_pop3:
exec(s + ".pop(current_row)")
if self.fileListWidget.count() == 0: if self.fileListWidget.count() == 0:
# --- Clear measurements information --- # --- Clear measurements information ---
@ -1463,17 +1492,18 @@ class AcousticDataTab(QWidget):
list_to_clear = [ list_to_clear = [
"stg.acoustic_data", "stg.date", "stg.hour", "stg.acoustic_data", "stg.date", "stg.hour",
"stg.freq", "stg.freq_text", "stg.temperature", "stg.freq", "stg.freq_text",
"stg.nb_profiles", "stg.nb_profiles_per_sec", "stg.nb_profiles", "stg.nb_profiles_per_sec",
"stg.nb_cells", "stg.cell_size", "stg.nb_cells", "stg.cell_size",
"stg.pulse_length", "stg.nb_pings_per_sec", "stg.pulse_length", "stg.nb_pings_per_sec",
"stg.nb_pings_averaged_per_profile", "stg.nb_pings_averaged_per_profile",
"stg.kt_read", "stg.kt_corrected", "stg.gain_rx", "stg.gain_tx", "stg.kt_read", "stg.kt_corrected", "stg.gain_rx", "stg.gain_tx",
"stg.filename_BS_raw_data", "stg.path_BS_raw_data",
"stg.BS_raw_data", "stg.time", "stg.depth", "stg.BS_raw_data", "stg.time", "stg.depth",
"stg.BS_raw_data_reshape", "stg.time_reshape", "stg.depth_reshape", "stg.BS_raw_data_reshape", "stg.time_reshape", "stg.depth_reshape",
"stg.rmin", "stg.rmax", "stg.tmin", "stg.tmax", "stg.rmin", "stg.rmax", "stg.tmin", "stg.tmax",
"stg.time_cross_section", "stg.depth_cross_section", "stg.time_cross_section", "stg.depth_cross_section",
"stg.BS_cross_section" "stg.BS_cross_section", "stg.BS_stream_bed"
] ]
for k in list_to_clear: for k in list_to_clear:
@ -1481,6 +1511,7 @@ class AcousticDataTab(QWidget):
exec(k + ".clear()") exec(k + ".clear()")
self.fileListWidget.clear() self.fileListWidget.clear()
# self.fileListWidget.takeItem(0)
if self.fileListWidget.count() == 0: if self.fileListWidget.count() == 0:
# --- Clear measurmeents information --- # --- Clear measurmeents information ---
@ -1687,10 +1718,13 @@ class AcousticDataTab(QWidget):
self.fill_measurements_information_groupbox_kt() self.fill_measurements_information_groupbox_kt()
def fill_measurements_information_groupbox_datetime(self): def fill_measurements_information_groupbox_datetime(self):
file_id = self.fileListWidget.currentRow()
print("file_id ", file_id)
print("stg.date ", stg.date)
self.label_date_acoustic_file.clear() self.label_date_acoustic_file.clear()
self.label_date_acoustic_file.setText( self.label_date_acoustic_file.setText(
"Date: " + str(stg.date[self.fileListWidget.currentRow()]) "Date: " + str(stg.date[file_id])
) )
self.gridLayout_groupbox_info.addWidget( self.gridLayout_groupbox_info.addWidget(
self.label_date_acoustic_file, self.label_date_acoustic_file,
@ -1700,7 +1734,7 @@ class AcousticDataTab(QWidget):
self.label_hour_acoustic_file.clear() self.label_hour_acoustic_file.clear()
self.label_hour_acoustic_file.setText( self.label_hour_acoustic_file.setText(
"Hour: " + str(stg.hour[self.fileListWidget.currentRow()]) "Hour: " + str(stg.hour[file_id])
) )
self.gridLayout_groupbox_info.addWidget( self.gridLayout_groupbox_info.addWidget(
self.label_hour_acoustic_file, self.label_hour_acoustic_file,
@ -2017,7 +2051,8 @@ class AcousticDataTab(QWidget):
) )
def fill_table(self): def fill_table(self):
if self.fileListWidget.currentRow() != -1: # if self.fileListWidget.currentRow() != -1:
if self.fileListWidget.selectedItems() != []:
file_id = self.fileListWidget.currentRow() file_id = self.fileListWidget.currentRow()
header_list = [] header_list = []

View File

@ -1716,32 +1716,47 @@ 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(
self, "Open calibration",
[
stg.path_calibration_file
if stg.path_calibration_file
else stg.path_BS_raw_data[-1]
if self.combobox_acoustic_data_choice.count() > 0
else ""
][0],
"Calibration file (*.xls, *.ods, *csv)",
options=QFileDialog.DontUseNativeDialog
)
dir_name = os.path.dirname(filename[0]) if self.combobox_acoustic_data_choice.count() == 0:
name = os.path.basename(filename[0]) msgBox = QMessageBox()
msgBox.setWindowTitle("Calibration import error")
msgBox.setIconPixmap(
QPixmap(
self._path_icon("no_approved.png")
).scaledToHeight(32, Qt.SmoothTransformation)
)
msgBox.setText("Update data before importing calibration")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
stg.path_calibration_file = dir_name else:
stg.filename_calibration_file = name
self.lineEdit_import_calibration.clear() filename = QFileDialog.getOpenFileName(
self.lineEdit_import_calibration.setText(name) self, "Open calibration",
[
stg.path_calibration_file
if stg.path_calibration_file
else stg.path_BS_raw_data[-1]
if self.combobox_acoustic_data_choice.count() > 0
else ""
][0],
"Calibration file (*.xls, *.ods, *csv)",
options=QFileDialog.DontUseNativeDialog
)
self.lineEdit_import_calibration.setToolTip(dir_name) dir_name = os.path.dirname(filename[0])
name = os.path.basename(filename[0])
self.compute_depth_2D() stg.path_calibration_file = dir_name
self.read_calibration_file_and_fill_parameter() stg.filename_calibration_file = name
self.lineEdit_import_calibration.clear()
self.lineEdit_import_calibration.setText(name)
self.lineEdit_import_calibration.setToolTip(dir_name)
self.compute_depth_2D()
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()
@ -1784,19 +1799,8 @@ class SedimentCalibrationTab(QWidget):
) )
def read_calibration_file_and_fill_parameter(self): def read_calibration_file_and_fill_parameter(self):
if self.combobox_acoustic_data_choice.count() == 0:
msgBox = QMessageBox()
msgBox.setWindowTitle("Calibration import error")
msgBox.setIconPixmap(
QPixmap(
self._path_icon("no_approved.png")
).scaledToHeight(32, Qt.SmoothTransformation)
)
msgBox.setText("Update data before importing calibration")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
elif stg.filename_calibration_file == "": if stg.filename_calibration_file == "":
pass pass
@ -1996,17 +2000,31 @@ class SedimentCalibrationTab(QWidget):
def function_pushbutton_compute_calibration(self): def function_pushbutton_compute_calibration(self):
self.label_temperature.clear() if self.combobox_acoustic_data_choice.count() == 0:
self.label_temperature.setText("T = " + str(stg.temperature) + " °C") msgBox = QMessageBox()
msgBox.setWindowTitle("Calibration computation error")
msgBox.setIconPixmap(
QPixmap(
self._path_icon("no_approved.png")
).scaledToHeight(32, Qt.SmoothTransformation)
)
msgBox.setText("Update data before importing calibration")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
self.compute_depth_2D() else:
self.compute_ks()
self.compute_sv() self.label_temperature.clear()
self.compute_X() self.label_temperature.setText("T = " + str(stg.temperature) + " °C")
self.compute_kt2D_kt3D()
self.compute_J_cross_section() self.compute_depth_2D()
self.compute_alpha_s() self.compute_ks()
self.compute_zeta() self.compute_sv()
self.compute_X()
self.compute_kt2D_kt3D()
self.compute_J_cross_section()
self.compute_alpha_s()
self.compute_zeta()
def compute_ks(self): def compute_ks(self):
data_id = self.combobox_acoustic_data_choice.currentIndex() data_id = self.combobox_acoustic_data_choice.currentIndex()
@ -2058,11 +2076,11 @@ class SedimentCalibrationTab(QWidget):
stg.sv = [sv_freq1, sv_freq2] stg.sv = [sv_freq1, sv_freq2]
print( logger.debug(
f"sv for frequency of {stg.freq[data_id][self.combobox_freq1.currentIndex()]}" f"sv for frequency of {stg.freq[data_id][self.combobox_freq1.currentIndex()]}"
+ f" : {sv_freq1:.8f} /m \n" + f" : {sv_freq1:.8f} /m \n"
) )
print( logger.debug(
f"sv for frequency of {stg.freq[data_id][self.combobox_freq2.currentIndex()]}" f"sv for frequency of {stg.freq[data_id][self.combobox_freq2.currentIndex()]}"
+ f" : {sv_freq2:.8f} /m" + f" : {sv_freq2:.8f} /m"
) )
@ -2085,7 +2103,7 @@ class SedimentCalibrationTab(QWidget):
stg.X_exponent.clear() stg.X_exponent.clear()
stg.X_exponent.append(X_exponent) stg.X_exponent.append(X_exponent)
print(f"Exponent X = {X_exponent:.2f}\n") logger.debug(f"Exponent X = {X_exponent:.2f}\n")
self.lineEdit_X.setText(str("%.2f" % X_exponent)) self.lineEdit_X.setText(str("%.2f" % X_exponent))
@ -2210,8 +2228,8 @@ class SedimentCalibrationTab(QWidget):
stg.alpha_s = [alpha_s_freq1, alpha_s_freq2] stg.alpha_s = [alpha_s_freq1, alpha_s_freq2]
print(f"\u03B1s for frequency of freq1 : {alpha_s_freq1:.2f} /m \n") logger.debug(f"\u03B1s for frequency of freq1 : {alpha_s_freq1:.2f} /m \n")
print(f"\u03B1s for frequency of freq2 : {alpha_s_freq2:.2f} /m") logger.debug(f"\u03B1s for frequency of freq2 : {alpha_s_freq2:.2f} /m")
self.lineEdit_alphas_freq1.clear() self.lineEdit_alphas_freq1.clear()
self.lineEdit_alphas_freq1.setText(str("%.5f" % alpha_s_freq1)) self.lineEdit_alphas_freq1.setText(str("%.5f" % alpha_s_freq1))
@ -2274,8 +2292,8 @@ class SedimentCalibrationTab(QWidget):
stg.zeta = [zeta_freq1, zeta_freq2] stg.zeta = [zeta_freq1, zeta_freq2]
print(f"\u03B6 for frequency of freq1 : {zeta_freq1:.3f} /m \n") logger.debug(f"\u03B6 for frequency of freq1 : {zeta_freq1:.3f} /m \n")
print(f"\u03B6 for frequency of freq2 : {zeta_freq2:.3f} /m") logger.debug(f"\u03B6 for frequency of freq2 : {zeta_freq2:.3f} /m")
self.lineEdit_zeta_freq1.clear() self.lineEdit_zeta_freq1.clear()
self.lineEdit_zeta_freq1.setText(str("%.5f" % zeta_freq1)) self.lineEdit_zeta_freq1.setText(str("%.5f" % zeta_freq1))

BIN
logos/AcouSed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
logos/CNR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
logos/EDF.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
logos/OSR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
logos/Ubertone.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB