A push button is added to clear noise data and plots.
parent
44b87378b8
commit
3b84cc634e
|
|
@ -44,6 +44,7 @@ class SignalProcessingTab(QWidget):
|
|||
self.icon_triangle_left_to_begin = QIcon(self.path_icon + "triangle_left_to_begin.png")
|
||||
self.icon_triangle_right_to_end = QIcon(self.path_icon + "triangle_right_to_end.png")
|
||||
self.icon_update = QIcon(self.path_icon + "update.png")
|
||||
self.icon_clear = QIcon(self.path_icon + "clear.png")
|
||||
|
||||
### --- General layout of widgets ---
|
||||
|
||||
|
|
@ -83,8 +84,6 @@ class SignalProcessingTab(QWidget):
|
|||
self.combobox_fileListWidget = ComboBoxShowPopUpWindow()
|
||||
self.horizontalLayout_groupbox_data_to_be_processed.addWidget(self.combobox_fileListWidget)
|
||||
|
||||
self.combobox_fileListWidget.ShowPopUpWindowSignal.connect(self.event_combobobx_fileListWidget)
|
||||
|
||||
self.pushbutton_update = QPushButton()
|
||||
self.pushbutton_update.setIcon(self.icon_update)
|
||||
self.pushbutton_update.setMaximumWidth(40)
|
||||
|
|
@ -109,6 +108,11 @@ class SignalProcessingTab(QWidget):
|
|||
self.radiobutton_value = QRadioButton("Value")
|
||||
self.gridLayout_radiobutton_noise_data.addWidget(self.radiobutton_value, 0, 2, 1, 1)
|
||||
|
||||
self.pushbutton_clear_noise = QPushButton()
|
||||
self.pushbutton_clear_noise.setIcon(self.icon_clear)
|
||||
self.pushbutton_clear_noise.setMaximumWidth(50)
|
||||
self.gridLayout_radiobutton_noise_data.addWidget(self.pushbutton_clear_noise, 0, 3, 1, 1)
|
||||
|
||||
### --- Groupbox download noise file ---
|
||||
|
||||
self.groupbox_download_noise_file = QGroupBox()
|
||||
|
|
@ -148,6 +152,7 @@ class SignalProcessingTab(QWidget):
|
|||
self.label_noise_value.setText("Value : ")
|
||||
self.gridLayout_compute_noise_from_value.addWidget(self.label_noise_value, 0, 0, 1, 1)
|
||||
self.spinbox_compute_noise_from_value = QDoubleSpinBox()
|
||||
self.spinbox_compute_noise_from_value.setDecimals(6)
|
||||
self.gridLayout_compute_noise_from_value.addWidget(self.spinbox_compute_noise_from_value, 0, 1, 1, 1)
|
||||
self.label_Volts = QLabel("Volts")
|
||||
self.gridLayout_compute_noise_from_value.addWidget(self.label_Volts, 0, 2, 1, 1)
|
||||
|
|
@ -401,13 +406,17 @@ class SignalProcessingTab(QWidget):
|
|||
|
||||
# --- Connect signal of widget ---
|
||||
|
||||
self.pushbutton_update.clicked.connect(self.event_combobobx_fileListWidget)
|
||||
self.pushbutton_update.clicked.connect(self.remove_point_with_snr_filter)
|
||||
self.combobox_fileListWidget.ShowPopUpWindowSignal.connect(self.event_combobobx_fileListWidget)
|
||||
# self.combobox_fileListWidget.currentIndexChanged.connect(self.combobox_fileListWidget_change_index)
|
||||
|
||||
# self.pushbutton_update.clicked.connect(self.update_SignalPreprocessingTab)
|
||||
|
||||
self.radiobutton_file.toggled.connect(self.onClicked_radiobutton_noise_data)
|
||||
self.radiobutton_profile_tail.toggled.connect(self.onClicked_radiobutton_noise_data)
|
||||
self.radiobutton_value.toggled.connect(self.onClicked_radiobutton_noise_data)
|
||||
|
||||
self.pushbutton_clear_noise.clicked.connect(self.clear_noise_data)
|
||||
|
||||
self.pushbutton_noise_file.clicked.connect(self.open_dialog_box)
|
||||
|
||||
self.pushbutton_compute_noise_from_value.clicked.connect(self.compute_noise_from_value)
|
||||
|
|
@ -1081,6 +1090,39 @@ class SignalProcessingTab(QWidget):
|
|||
def fill_combobox_fileListWidget(self):
|
||||
self.combobox_fileListWidget.addItems([stg.filename_BS_raw_data])
|
||||
|
||||
def update_SignalPreprocessingTab(self):
|
||||
|
||||
self.combobox_fileListWidget.addItems([""] + stg.filename_BS_raw_data)
|
||||
|
||||
|
||||
# def combobox_fileListWidget_change_index(self):
|
||||
#
|
||||
# if stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex() - 1].shape != (0,):
|
||||
#
|
||||
# if stg.noise_method[self.combobox_fileListWidget.currentIndex() - 1] == 1:
|
||||
# self.radiobutton_file.setVisible(True)
|
||||
# self.lineEdit_noise_file.setText(stg.filename_BS_noise_data[self.combobox_fileListWidget.currentIndex() - 1])
|
||||
# self.radiobutton_profile_tail.setVisible(False)
|
||||
# self.radiobutton_value.setVisible(False)
|
||||
# elif stg.noise_method[self.combobox_fileListWidget.currentIndex() - 1] == 2:
|
||||
# self.radiobutton_file.setVisible(False)
|
||||
# self.radiobutton_profile_tail.setVisible(True)
|
||||
# self.radiobutton_value.setVisible(False)
|
||||
# elif stg.noise_method[self.combobox_fileListWidget.currentIndex() - 1] == 3:
|
||||
# self.radiobutton_file.setVisible(False)
|
||||
# self.radiobutton_profile_tail.setVisible(False)
|
||||
# self.radiobutton_value.setVisible(True)
|
||||
#
|
||||
# self.spinbox_SNR_criterion.setValue(stg.SNR_filter_value[self.combobox_fileListWidget.currentIndex() - 1])
|
||||
# self.plot_transect_with_SNR_data()
|
||||
# self.plot_BS_signal_filtered_with_SNR()
|
||||
#
|
||||
# self.plot_profile_and_position_on_transect_with_slider()
|
||||
#
|
||||
# else:
|
||||
#
|
||||
# self.clear_noise_data()
|
||||
|
||||
def onClicked_radiobutton_noise_data(self):
|
||||
# radiobutton = self.sender()
|
||||
# if radiobutton.isChecked():
|
||||
|
|
@ -1099,6 +1141,73 @@ class SignalProcessingTab(QWidget):
|
|||
self.groupbox_compute_noise_from_profile_tail.setVisible(False)
|
||||
self.groupbox_compute_noise_from_value.setVisible(True)
|
||||
|
||||
def clear_noise_data(self):
|
||||
|
||||
stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex() - 1] = np.array([])
|
||||
stg.BS_noise_averaged_data[self.combobox_fileListWidget.currentIndex() - 1] = np.array([])
|
||||
stg.SNR_raw_data[self.combobox_fileListWidget.currentIndex() - 1] = np.array([])
|
||||
stg.SNR_cross_section[self.combobox_fileListWidget.currentIndex() - 1] = np.array([])
|
||||
stg.SNR_stream_bed[self.combobox_fileListWidget.currentIndex() - 1] = np.array([])
|
||||
stg.time_noise[self.combobox_fileListWidget.currentIndex() - 1] = np.array([])
|
||||
stg.noise_method[self.combobox_fileListWidget.currentIndex() - 1] = 0
|
||||
stg.SNR_filter_value[self.combobox_fileListWidget.currentIndex() - 1] = 0
|
||||
|
||||
stg.BS_raw_data_pre_process_SNR[self.combobox_fileListWidget.currentIndex() - 1] = np.array([])
|
||||
stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex() - 1] = np.array([])
|
||||
stg.BS_raw_data_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex() - 1] = np.array([])
|
||||
|
||||
stg.BS_cross_section_pre_process_SNR[self.combobox_fileListWidget.currentIndex() - 1] = np.array([])
|
||||
stg.BS_cross_section_pre_process_average[self.combobox_fileListWidget.currentIndex() - 1] = np.array([])
|
||||
stg.BS_cross_section_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex() - 1] = np.array([])
|
||||
|
||||
stg.BS_stream_bed_pre_process_SNR[self.combobox_fileListWidget.currentIndex() - 1] = np.array([])
|
||||
stg.BS_stream_bed_pre_process_average[self.combobox_fileListWidget.currentIndex() - 1] = np.array([])
|
||||
stg.BS_stream_bed_pre_process_SNR_average[self.combobox_fileListWidget.currentIndex() - 1] = np.array([])
|
||||
|
||||
print("All is clear")
|
||||
|
||||
if self.radiobutton_file.isChecked():
|
||||
self.lineEdit_noise_file.clear()
|
||||
|
||||
elif self.radiobutton_profile_tail.isChecked():
|
||||
pass
|
||||
|
||||
elif self.radiobutton_value.isChecked():
|
||||
self.spinbox_compute_noise_from_value.setValue(0)
|
||||
|
||||
self.spinbox_SNR_criterion.setValue(0)
|
||||
|
||||
self.spinbox_average_horizontal.setValue(0)
|
||||
|
||||
self.label_profile_number.clear()
|
||||
self.label_profile_number.setText("Profile ")
|
||||
|
||||
self.canvas_SNR.figure.clear()
|
||||
self.fig_SNR.clf()
|
||||
self.axis_SNR.tolist().clear()
|
||||
self.canvas_SNR = FigureCanvas()
|
||||
self.scroll_SNR.setWidget(self.canvas_SNR)
|
||||
print("SNR plot is clear")
|
||||
|
||||
self.canvas_BS.figure.clear()
|
||||
self.fig_BS.clf()
|
||||
self.axis_BS.tolist().clear()
|
||||
self.canvas_BS = FigureCanvas()
|
||||
self.scroll_BS.setWidget(self.canvas_BS)
|
||||
print("BS plot is clear")
|
||||
|
||||
self.combobox_frequency_profile.clear()
|
||||
|
||||
self.canvas_profile.figure.clear()
|
||||
self.figure_profile.clf()
|
||||
self.axis_profile.tolist().clear()
|
||||
self.canvas_profile = FigureCanvas()
|
||||
self.scroll_profile.setWidget(self.canvas_profile)
|
||||
print("Profile plot is clear")
|
||||
|
||||
self.slider.setValue(0)
|
||||
self.slider.setMaximum(10)
|
||||
|
||||
def open_dialog_box(self):
|
||||
|
||||
if self.sender().objectName() == "pushbutton_noise_file":
|
||||
|
|
@ -1168,7 +1277,9 @@ class SignalProcessingTab(QWidget):
|
|||
|
||||
stg.noise_method[self.combobox_fileListWidget.currentIndex() - 1] = 1
|
||||
|
||||
noise_data = AcousticDataLoader(stg.path_BS_noise_data + "/" + stg.filename_BS_noise_data)
|
||||
noise_data = AcousticDataLoader(stg.path_BS_noise_data[self.combobox_fileListWidget.currentIndex() - 1] +
|
||||
"/" +
|
||||
stg.filename_BS_noise_data[self.combobox_fileListWidget.currentIndex() - 1])
|
||||
stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex() - 1] = noise_data._BS_raw_data
|
||||
# stg.date_noise = noise_data._date
|
||||
# stg.hour_noise = noise_data._hour
|
||||
|
|
@ -1282,57 +1393,104 @@ class SignalProcessingTab(QWidget):
|
|||
|
||||
def compute_noise_from_value(self):
|
||||
|
||||
stg.noise_method[self.combobox_fileListWidget.currentIndex() - 1] = 3
|
||||
|
||||
# --- Compute noise from value and compute SNR ---
|
||||
|
||||
if len(stg.BS_stream_bed) == 0:
|
||||
if stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex() - 1].shape != (0,):
|
||||
|
||||
if self.spinbox_compute_noise_from_value.value() == 0:
|
||||
stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex() - 1] = (
|
||||
np.full(stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex() - 1].shape,
|
||||
self.spinbox_compute_noise_from_value.value()))
|
||||
stg.SNR_stream_bed[self.combobox_fileListWidget.currentIndex() - 1] = (
|
||||
np.divide((stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex() - 1]
|
||||
- stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex() - 1]) ** 2,
|
||||
stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex() - 1] ** 2))
|
||||
|
||||
stg.BS_noise_raw_data = np.full(stg.BS_cross_section[0].shape,
|
||||
self.spinbox_compute_noise_from_value.value())
|
||||
print(f"stg.BS_noise_raw_data.shape : {stg.BS_noise_raw_data.shape}")
|
||||
stg.SNR_cross_section = np.full(stg.BS_cross_section[0].shape, 1e3)
|
||||
stg.time_noise[self.combobox_fileListWidget.currentIndex() - 1] = (
|
||||
stg.time_cross_section[self.combobox_fileListWidget.currentIndex() - 1])
|
||||
|
||||
elif stg.BS_cross_section[self.combobox_fileListWidget.currentIndex() - 1].shape != (0,):
|
||||
|
||||
stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex() - 1] = (
|
||||
np.full(stg.BS_cross_section[self.combobox_fileListWidget.currentIndex() - 1].shape,
|
||||
self.spinbox_compute_noise_from_value.value()))
|
||||
stg.SNR_cross_section[self.combobox_fileListWidget.currentIndex() - 1] = (
|
||||
np.divide((stg.BS_cross_section[self.combobox_fileListWidget.currentIndex() - 1]
|
||||
- stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex() - 1]) ** 2,
|
||||
stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex() - 1] ** 2))
|
||||
|
||||
stg.time_noise[self.combobox_fileListWidget.currentIndex() - 1] = (
|
||||
stg.time_cross_section[self.combobox_fileListWidget.currentIndex() - 1])
|
||||
|
||||
else:
|
||||
|
||||
stg.BS_noise_raw_data = np.full(stg.BS_cross_section[0].shape,
|
||||
self.spinbox_compute_noise_from_value.value())
|
||||
stg.SNR_cross_section = np.divide((stg.BS_cross_section[0] - stg.BS_noise_raw_data) ** 2,
|
||||
stg.BS_noise_raw_data ** 2)
|
||||
stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex() - 1] = (
|
||||
np.full(stg.BS_raw_data[self.combobox_fileListWidget.currentIndex() - 1].shape,
|
||||
self.spinbox_compute_noise_from_value.value()))
|
||||
stg.SNR_raw_data[self.combobox_fileListWidget.currentIndex() - 1] = (
|
||||
np.divide((stg.BS_raw_data[self.combobox_fileListWidget.currentIndex() - 1]
|
||||
- stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex() - 1]) ** 2,
|
||||
stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex() - 1] ** 2))
|
||||
|
||||
else:
|
||||
stg.time_noise[self.combobox_fileListWidget.currentIndex() - 1] = (
|
||||
stg.time[self.combobox_fileListWidget.currentIndex() - 1])
|
||||
|
||||
if self.spinbox_compute_noise_from_value.value() == 0:
|
||||
|
||||
stg.BS_noise_raw_data = np.full(stg.BS_stream_bed.shape,
|
||||
self.spinbox_compute_noise_from_value.value())
|
||||
stg.SNR_stream_bed = np.full(stg.BS_stream_bed.shape, 1e3)
|
||||
|
||||
else:
|
||||
|
||||
stg.BS_noise_raw_data = np.full(stg.BS_stream_bed.shape,
|
||||
self.spinbox_compute_noise_from_value.value())
|
||||
stg.SNR_stream_bed = np.divide((stg.BS_stream_bed - stg.BS_noise_raw_data) ** 2,
|
||||
stg.BS_noise_raw_data ** 2)
|
||||
# if len(stg.BS_stream_bed) == 0:
|
||||
#
|
||||
# if self.spinbox_compute_noise_from_value.value() == 0:
|
||||
#
|
||||
# stg.BS_noise_raw_data = np.full(stg.BS_cross_section[0].shape,
|
||||
# self.spinbox_compute_noise_from_value.value())
|
||||
# print(f"stg.BS_noise_raw_data.shape : {stg.BS_noise_raw_data.shape}")
|
||||
# stg.SNR_cross_section = np.full(stg.BS_cross_section[0].shape, 1e3)
|
||||
#
|
||||
# else:
|
||||
#
|
||||
# stg.BS_noise_raw_data = np.full(stg.BS_cross_section[0].shape,
|
||||
# self.spinbox_compute_noise_from_value.value())
|
||||
# stg.SNR_cross_section = np.divide((stg.BS_cross_section[0] - stg.BS_noise_raw_data) ** 2,
|
||||
# stg.BS_noise_raw_data ** 2)
|
||||
#
|
||||
# else:
|
||||
#
|
||||
# if self.spinbox_compute_noise_from_value.value() == 0:
|
||||
#
|
||||
# stg.BS_noise_raw_data = np.full(stg.BS_stream_bed.shape,
|
||||
# self.spinbox_compute_noise_from_value.value())
|
||||
# stg.SNR_stream_bed = np.full(stg.BS_stream_bed.shape, 1e3)
|
||||
#
|
||||
# else:
|
||||
#
|
||||
# stg.BS_noise_raw_data = np.full(stg.BS_stream_bed.shape,
|
||||
# self.spinbox_compute_noise_from_value.value())
|
||||
# stg.SNR_stream_bed = np.divide((stg.BS_stream_bed - stg.BS_noise_raw_data) ** 2,
|
||||
# stg.BS_noise_raw_data ** 2)
|
||||
|
||||
# --- Trigger graphic widgets ---
|
||||
|
||||
self.combobox_freq_noise.addItems([f for f in stg.freq_text])
|
||||
self.plot_noise()
|
||||
self.plot_transect_with_SNR_data()
|
||||
self.combobox_freq_noise.currentIndexChanged.connect(self.plot_noise)
|
||||
if stg.SNR_filter_value[self.combobox_fileListWidget.currentIndex() - 1] == 0:
|
||||
self.spinbox_SNR_criterion.setValue(0)
|
||||
else:
|
||||
self.spinbox_SNR_criterion.setValue(stg.SNR_filter_value[self.combobox_fileListWidget.currentIndex() - 1])
|
||||
|
||||
self.plot_transect_with_SNR_data()
|
||||
|
||||
self.remove_point_with_snr_filter()
|
||||
|
||||
self.combobox_frequency_profile.addItems([f for f in stg.freq_text])
|
||||
self.combobox_frequency_profile.addItems(
|
||||
[f for f in stg.freq_text[self.combobox_fileListWidget.currentIndex() - 1]])
|
||||
self.combobox_frequency_profile.currentIndexChanged.connect(
|
||||
self.plot_profile_and_position_on_transect_with_slider)
|
||||
self.slider.setMaximum(stg.t.shape[1])
|
||||
|
||||
if stg.time_cross_section[self.combobox_fileListWidget.currentIndex() - 1].shape != (0,):
|
||||
self.slider.setMaximum(stg.time_cross_section[self.combobox_fileListWidget.currentIndex() - 1].shape[1])
|
||||
else:
|
||||
self.slider.setMaximum(stg.time[self.combobox_fileListWidget.currentIndex() - 1].shape[1])
|
||||
|
||||
self.compute_averaged_BS_data()
|
||||
self.plot_profile_and_position_on_transect_with_slider()
|
||||
|
||||
stg.noise_method[self.combobox_fileListWidget.currentIndex() - 1] = 3
|
||||
|
||||
def plot_noise(self):
|
||||
self.horizontalLayout_groupbox_plot_noise_data.removeWidget(self.canvas_noise)
|
||||
|
||||
|
|
@ -1517,6 +1675,8 @@ class SignalProcessingTab(QWidget):
|
|||
|
||||
else:
|
||||
|
||||
stg.SNR_filter_value[self.combobox_fileListWidget.currentIndex() - 1] = self.spinbox_SNR_criterion.value()
|
||||
|
||||
if stg.BS_stream_bed[self.combobox_fileListWidget.currentIndex() - 1].shape != (0,):
|
||||
|
||||
stg.BS_stream_bed_pre_process_SNR = deepcopy(stg.BS_stream_bed)
|
||||
|
|
@ -1851,6 +2011,9 @@ class SignalProcessingTab(QWidget):
|
|||
self.label_profile_number.clear()
|
||||
self.label_profile_number.setText("Profile " + str(self.slider.value()) + " / " + str(self.slider.maximum()))
|
||||
|
||||
if ((self.combobox_fileListWidget.currentIndex() != -1) and
|
||||
(stg.BS_noise_raw_data[self.combobox_fileListWidget.currentIndex() - 1].shape != (0,))):
|
||||
|
||||
self.figure_profile, self.axis_profile = plt.subplots(nrows=2, ncols=1, layout="constrained")
|
||||
self.canvas_profile = FigureCanvas(self.figure_profile)
|
||||
self.scroll_profile.setWidget(self.canvas_profile)
|
||||
|
|
@ -2028,7 +2191,7 @@ class SignalProcessingTab(QWidget):
|
|||
[self.combobox_frequency_profile.currentIndex(), :, :],
|
||||
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
||||
|
||||
else:
|
||||
elif stg.BS_raw_data_pre_process_average[self.combobox_fileListWidget.currentIndex() - 1].shape != (0,):
|
||||
|
||||
# --- Plot profile ---
|
||||
self.axis_profile[0].plot(
|
||||
|
|
@ -2063,8 +2226,6 @@ class SignalProcessingTab(QWidget):
|
|||
[self.combobox_frequency_profile.currentIndex(), :, :],
|
||||
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
||||
|
||||
self.axis_profile[0].set_xlabel("Acoustic Backscatter Signal (V)")
|
||||
self.axis_profile[0].set_ylabel("Depth (m)")
|
||||
|
||||
self.axis_profile[1].plot(
|
||||
stg.time[self.combobox_fileListWidget.currentIndex() - 1]
|
||||
|
|
@ -2073,6 +2234,9 @@ class SignalProcessingTab(QWidget):
|
|||
-stg.depth[self.combobox_fileListWidget.currentIndex() - 1][self.combobox_frequency_profile.currentIndex(), :],
|
||||
color='red', linestyle="solid", linewidth=2)
|
||||
|
||||
self.axis_profile[0].set_xlabel("Acoustic Backscatter Signal (V)")
|
||||
self.axis_profile[0].set_ylabel("Depth (m)")
|
||||
|
||||
if len(stg.depth_bottom[self.combobox_fileListWidget.currentIndex() - 1]) != 0:
|
||||
if stg.time_cross_section[self.combobox_fileListWidget.currentIndex() - 1].shape != (0,):
|
||||
self.axis_profile[1].plot(stg.time_cross_section[self.combobox_fileListWidget.currentIndex() - 1][self.combobox_frequency_profile.currentIndex(), :],
|
||||
|
|
|
|||
Loading…
Reference in New Issue