Compare commits

..

12 Commits

3 changed files with 259 additions and 195 deletions

View File

@ -633,7 +633,7 @@ class AcousticDataTab(QWidget):
self.fileListWidget.itemSelectionChanged.connect(self.compute_rmin_rmax)
self.fileListWidget.itemSelectionChanged.connect(self.update_frequency_combobox)
# self.fileListWidget.itemSelectionChanged.connect(self.plot_backscattered_acoustic_signal_recording)
self.fileListWidget.itemSelectionChanged.connect(self.plot_profile)
# self.fileListWidget.itemSelectionChanged.connect(self.plot_profile)
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)
@ -1327,8 +1327,12 @@ class AcousticDataTab(QWidget):
self.fill_measurements_information_groupbox()
self.fill_table()
self.plot_backscattered_acoustic_signal_recording()
self.plot_profile()
self.update_frequency_combobox()
self.water_attenuation()
self.compute_tmin_tmax()
self.compute_rmin_rmax()
self.set_range_for_spinboxes_bathymetry()
stg.acoustic_data = list(
range(
@ -1370,7 +1374,7 @@ class AcousticDataTab(QWidget):
"stg.BS_raw_data_reshape", "stg.time_reshape", "stg.depth_reshape"]
for p in list_to_pop1:
if isinstance(p, list):
if isinstance(eval(p), list):
exec(p + ".pop(current_row)")
if stg.BS_cross_section:
@ -1473,7 +1477,7 @@ class AcousticDataTab(QWidget):
]
for k in list_to_clear:
if isinstance(k, list):
if isinstance(eval(k), list):
exec(k + ".clear()")
self.fileListWidget.clear()
@ -1684,6 +1688,7 @@ class AcousticDataTab(QWidget):
def fill_measurements_information_groupbox_datetime(self):
self.label_date_acoustic_file.clear()
self.label_date_acoustic_file.setText(
"Date: " + str(stg.date[self.fileListWidget.currentRow()])
)

View File

@ -1795,15 +1795,14 @@ class SedimentCalibrationTab(QWidget):
msgBox.setText("Update data before importing calibration")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
elif stg.filename_calibration_file == "":
pass
else:
# --- Read calibration file ---
data = pd.read_csv(
os.path.join(
stg.path_calibration_file,
stg.filename_calibration_file
),
header=0, index_col=0
)
data = pd.read_csv(os.path.join(stg.path_calibration_file, stg.filename_calibration_file), header=0, index_col=0)
# --- Fill spinboxes of calibration parameter ---
self.label_temperature.clear()
@ -2137,6 +2136,7 @@ class SedimentCalibrationTab(QWidget):
]
for i in range(self.combobox_acoustic_data_choice.count()):
J_cross_section_freq1 = np.array([])
J_cross_section_freq2 = np.array([])
@ -2220,25 +2220,19 @@ class SedimentCalibrationTab(QWidget):
self.lineEdit_alphas_freq2.setText(str("%.5f" % alpha_s_freq2))
if (alpha_s_freq1 < 0) or (alpha_s_freq2 < 0):
msgBox = QMessageBox()
msgBox.setWindowTitle("Alpha computation error")
msgBox.setIconPixmap(
QPixmap(
self._path_icon("no_approved.png")
).scaledToHeight(32, Qt.SmoothTransformation)
)
msgBox.setIconPixmap(QPixmap(self._path_icon("no_approved.png")).scaledToHeight(32, Qt.SmoothTransformation))
msgBox.setText("Sediment sound attenuation is negative !")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
else:
msgBox = QMessageBox()
msgBox.setWindowTitle("Alpha computation validation")
msgBox.setIconPixmap(
QPixmap(
self._path_icon("approved.png")
).scaledToHeight(32, Qt.SmoothTransformation)
)
msgBox.setIconPixmap(QPixmap(self._path_icon("approved.png")).scaledToHeight(32, Qt.SmoothTransformation))
msgBox.setText("Sediment sound attenuation is positive.")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
@ -2739,3 +2733,4 @@ class SedimentCalibrationTab(QWidget):
self.lineEdit_slider_FCB.setText(
str(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex(), self.slider_FCB.value()-1]))

View File

@ -447,8 +447,8 @@ class SignalProcessingTab(QWidget):
# --------------------------------------------------------------------------------------------------------------
self.pushbutton_update.clicked.connect(self.update_SignalPreprocessingTab)
self.pushbutton_update.clicked.connect(self.compute_average_profile_tail)
self.pushbutton_update.clicked.connect(self.plot_averaged_profile_tail)
# self.pushbutton_update.clicked.connect(self.compute_average_profile_tail)
# self.pushbutton_update.clicked.connect(self.plot_averaged_profile_tail)
self.combobox_acoustic_data_choice.currentIndexChanged.connect(self.combobox_acoustic_data_choice_change_index)
@ -501,6 +501,16 @@ class SignalProcessingTab(QWidget):
- the user remove a file (in the list widget) in the first tab (Acoustic data), so that the combobox
of data to be processed is updated,
- the user change the limits of one or all the records in the first tab (Acoustic data) """
if len(stg.filename_BS_raw_data) == 0:
msgBox = QMessageBox()
msgBox.setWindowTitle("Compute noise from profile tail error")
msgBox.setIcon(QMessageBox.Warning)
msgBox.setText("Download acoustic data in previous tab before updating data")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
else:
self.combobox_acoustic_data_choice.clear()
self.combobox_acoustic_data_choice.addItems(stg.filename_BS_raw_data)
@ -522,6 +532,9 @@ class SignalProcessingTab(QWidget):
self.combobox_acoustic_data_choice.currentIndexChanged.connect(self.combobox_acoustic_data_choice_change_index)
self.compute_average_profile_tail()
self.plot_averaged_profile_tail()
def activate_list_of_pre_processed_data(self):
for i in range(self.combobox_acoustic_data_choice.count()):
eval("self.lineEdit_list_pre_processed_data_" + str(i) + ".setDisabled(True)")
@ -654,6 +667,26 @@ class SignalProcessingTab(QWidget):
# --- Plot averaged signal ---
if len(stg.filename_BS_raw_data) == 0:
msgBox = QMessageBox()
msgBox.setWindowTitle("Compute noise from profile tail error")
msgBox.setIcon(QMessageBox.Warning)
msgBox.setText("Download acoustic data in previous tab before computing noise from profile tail")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
elif self.combobox_acoustic_data_choice.count() == 0:
msgBox = QMessageBox()
msgBox.setWindowTitle("Compute noise from profile tail error")
msgBox.setIcon(QMessageBox.Warning)
msgBox.setText("Refresh acoustic data before computing noise from profile tail")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
else:
if stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.verticalLayout_groupbox_plot_profile_tail.removeWidget(self.canvas_profile_tail)
@ -722,13 +755,18 @@ class SignalProcessingTab(QWidget):
def clear_noise_data(self):
if len(stg.filename_BS_raw_data) == 0:
pass
else:
stg.BS_noise_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_noise_averaged_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.time_noise[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] = 0
stg.SNR_filter_value[self.combobox_acoustic_data_choice.currentIndex()] = 0
stg.BS_raw_data_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
@ -739,7 +777,7 @@ class SignalProcessingTab(QWidget):
stg.BS_stream_bed_pre_process_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_stream_bed_pre_process_average[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
print("stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()]", stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()])
if stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 0:
self.lineEdit_noise_file.clear()
@ -1221,11 +1259,19 @@ class SignalProcessingTab(QWidget):
def remove_point_with_snr_filter(self):
if len(stg.BS_noise_raw_data) == 0:
if len(stg.filename_BS_raw_data) == 0:
msgBox = QMessageBox()
msgBox.setWindowTitle("Compute noise from profile tail error")
msgBox.setIcon(QMessageBox.Warning)
msgBox.setText("Download acoustic data in previous tab before applying SNR filter")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
elif len(stg.BS_noise_raw_data) == 0:
msgBox = QMessageBox()
msgBox.setWindowTitle("SNR filter Error")
msgBox.setIcon(QMessageBox.Warning)
msgBox.setText("Load Noise data from acoustic data tab before using SNR filter")
msgBox.setText("Define noise data (file or profile tail) before using SNR filter")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
@ -1504,6 +1550,24 @@ class SignalProcessingTab(QWidget):
def compute_averaged_BS_data(self):
if len(stg.filename_BS_raw_data) == 0:
msgBox = QMessageBox()
msgBox.setWindowTitle("Compute noise from profile tail error")
msgBox.setIcon(QMessageBox.Warning)
msgBox.setText("Download acoustic data in previous tab before applying SNR filter")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
elif len(stg.BS_noise_raw_data) == 0:
msgBox = QMessageBox()
msgBox.setWindowTitle("SNR filter Error")
msgBox.setIcon(QMessageBox.Warning)
msgBox.setText("Define noise data (file or profile tail) before using SNR filter")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
else:
kernel_avg = np.ones(2 * int(float(self.lineEdit_horizontal_average.text().replace(",", "."))) + 1)
print(kernel_avg)