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

View File

@ -1795,15 +1795,14 @@ class SedimentCalibrationTab(QWidget):
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()
elif stg.filename_calibration_file == "":
pass
else: else:
# --- Read calibration file --- # --- Read calibration file ---
data = pd.read_csv( data = pd.read_csv(os.path.join(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()
@ -2137,6 +2136,7 @@ class SedimentCalibrationTab(QWidget):
] ]
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([])
@ -2220,25 +2220,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()
@ -2739,3 +2733,4 @@ class SedimentCalibrationTab(QWidget):
self.lineEdit_slider_FCB.setText( self.lineEdit_slider_FCB.setText(
str(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ str(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex(), self.slider_FCB.value()-1])) 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.update_SignalPreprocessingTab)
self.pushbutton_update.clicked.connect(self.compute_average_profile_tail) # 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.plot_averaged_profile_tail)
self.combobox_acoustic_data_choice.currentIndexChanged.connect(self.combobox_acoustic_data_choice_change_index) 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 - 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, of data to be processed is updated,
- the user change the limits of one or all the records in the first tab (Acoustic data) """ - 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.clear()
self.combobox_acoustic_data_choice.addItems(stg.filename_BS_raw_data) 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.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): def activate_list_of_pre_processed_data(self):
for i in range(self.combobox_acoustic_data_choice.count()): for i in range(self.combobox_acoustic_data_choice.count()):
eval("self.lineEdit_list_pre_processed_data_" + str(i) + ".setDisabled(True)") eval("self.lineEdit_list_pre_processed_data_" + str(i) + ".setDisabled(True)")
@ -654,6 +667,26 @@ class SignalProcessingTab(QWidget):
# --- Plot averaged signal --- # --- 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,): if stg.BS_mean[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.verticalLayout_groupbox_plot_profile_tail.removeWidget(self.canvas_profile_tail) self.verticalLayout_groupbox_plot_profile_tail.removeWidget(self.canvas_profile_tail)
@ -722,13 +755,18 @@ class SignalProcessingTab(QWidget):
def clear_noise_data(self): 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_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_noise_averaged_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_raw_data[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.SNR_cross_section[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.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.time_noise[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.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([]) 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_SNR[self.combobox_acoustic_data_choice.currentIndex()] = np.array([])
stg.BS_stream_bed_pre_process_average[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: if stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 0:
self.lineEdit_noise_file.clear() self.lineEdit_noise_file.clear()
@ -1221,11 +1259,19 @@ class SignalProcessingTab(QWidget):
def remove_point_with_snr_filter(self): 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 = QMessageBox()
msgBox.setWindowTitle("SNR filter Error") msgBox.setWindowTitle("SNR filter Error")
msgBox.setIcon(QMessageBox.Warning) 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.setStandardButtons(QMessageBox.Ok)
msgBox.exec() msgBox.exec()
@ -1504,6 +1550,24 @@ class SignalProcessingTab(QWidget):
def compute_averaged_BS_data(self): 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) kernel_avg = np.ones(2 * int(float(self.lineEdit_horizontal_average.text().replace(",", "."))) + 1)
print(kernel_avg) print(kernel_avg)