List of pre-processed data files are added in Signal pre-processing tab.
parent
2390b5c524
commit
e0130b07fe
|
|
@ -1450,13 +1450,14 @@ class AcousticDataTab(QWidget):
|
|||
# stg.filename_BS_raw_data = name
|
||||
# self.load_BS_acoustic_raw_data()
|
||||
try:
|
||||
if self.fileListWidget.count() == 0:
|
||||
stg.path_BS_raw_data = [dir_name]
|
||||
stg.filename_BS_raw_data = [name]
|
||||
print(f"0 dir name : {dir_name} & file name : {name}")
|
||||
else:
|
||||
# if self.fileListWidget.count() == 0:
|
||||
# stg.path_BS_raw_data = [dir_name]
|
||||
# stg.filename_BS_raw_data = [name]
|
||||
# print(f"0 dir name : {dir_name} & file name : {name}")
|
||||
# else:
|
||||
stg.path_BS_raw_data.append(dir_name)
|
||||
stg.filename_BS_raw_data.append(name)
|
||||
stg.data_preprocessed.append(name)
|
||||
print(f"1 dir name : {dir_name} & file name : {name}")
|
||||
self.load_BS_acoustic_raw_data()
|
||||
print("0 Lecture de la donnée BS")
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import sys
|
|||
|
||||
from PyQt5.QtWidgets import (QWidget, QHBoxLayout, QVBoxLayout, QPushButton, QGroupBox, QLabel, QCheckBox,
|
||||
QSpinBox, QDoubleSpinBox, QComboBox, QLineEdit, QSlider, QGridLayout, QMessageBox,
|
||||
QScrollArea, QRadioButton, QFileDialog, QSpacerItem, QSizePolicy, QTextEdit)
|
||||
from PyQt5.QtGui import QFont, QIcon, QPixmap
|
||||
QScrollArea, QRadioButton, QFileDialog, QSpacerItem, QSizePolicy, QTextEdit, QPlainTextEdit)
|
||||
from PyQt5.QtGui import QFont, QIcon, QPixmap, QSyntaxHighlighter, QTextCharFormat
|
||||
from PyQt5.QtCore import Qt, QCoreApplication, QEvent, pyqtSignal
|
||||
|
||||
import numpy as np
|
||||
|
|
@ -28,6 +28,32 @@ import settings as stg
|
|||
_translate = QCoreApplication.translate
|
||||
|
||||
|
||||
class SyntaxHighlighter(QSyntaxHighlighter):
|
||||
def __init__(self, parent):
|
||||
super(SyntaxHighlighter, self).__init__(parent)
|
||||
self._highlight_lines = dict()
|
||||
|
||||
def highlight_line(self, line, fmt):
|
||||
if isinstance(line, int) and line >= 0 and isinstance(fmt, QTextCharFormat):
|
||||
self._highlight_lines[line] = fmt
|
||||
tb = self.document().findBlockByLineNumber(line)
|
||||
self.rehighlightBlock(tb)
|
||||
print("self._highlight_lines ", self._highlight_lines[line])
|
||||
print("tb", tb)
|
||||
print("self.rehighlightBlock(tb) ", self.rehighlightBlock(tb))
|
||||
|
||||
def clear_highlight(self):
|
||||
self._highlight_lines = dict()
|
||||
self.rehighlight()
|
||||
print("self._highlight_lines ", self._highlight_lines)
|
||||
|
||||
def highlightBlock(self, text):
|
||||
line = self.currentBlock().blockNumber()
|
||||
fmt = self._highlight_lines.get(line)
|
||||
if fmt is not None:
|
||||
self.setFormat(0, len(text), fmt)
|
||||
|
||||
|
||||
class SignalProcessingTab(QWidget):
|
||||
|
||||
''' This class generates the Signal Processing Tab '''
|
||||
|
|
@ -398,8 +424,10 @@ class SignalProcessingTab(QWidget):
|
|||
|
||||
self.verticalLayout_list_pre_processed_data = QVBoxLayout(self.groupbox_list_pre_processed_data)
|
||||
|
||||
self.textEdit_list_pre_processed_data = QTextEdit()
|
||||
self.verticalLayout_list_pre_processed_data.addWidget(self.textEdit_list_pre_processed_data)
|
||||
self.plaintextedit_list_pre_processed_data = QPlainTextEdit()
|
||||
self.verticalLayout_list_pre_processed_data.addWidget(self.plaintextedit_list_pre_processed_data)
|
||||
|
||||
# self.plaintextedit_list_pre_processed_data.appendPlainText("blablabla \nblobloblo")
|
||||
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -438,7 +466,6 @@ class SignalProcessingTab(QWidget):
|
|||
self.slider.valueChanged.connect(self.update_lineEdit_by_moving_slider)
|
||||
self.slider.valueChanged.connect(self.plot_profile_and_position_on_transect_with_slider)
|
||||
|
||||
|
||||
# ______ _______
|
||||
# | | | | \
|
||||
# | | | | \
|
||||
|
|
@ -1108,52 +1135,66 @@ class SignalProcessingTab(QWidget):
|
|||
# self.combobox_fileListWidget.setCurrentIndex(0)
|
||||
# self.combobox_fileListWidget.currentIndexChanged.connect(self.combobox_fileListWidget_change_index)
|
||||
|
||||
self.plaintextedit_list_pre_processed_data.clear()
|
||||
for t in range(self.combobox_fileListWidget.count()):
|
||||
self.plaintextedit_list_pre_processed_data.appendPlainText(stg.filename_BS_raw_data[t] + "\n")
|
||||
|
||||
self.plaintextedit_list_pre_processed_data.textChanged.connect(self.rename_data_preprocessed)
|
||||
|
||||
# if self.combobox_fileListWidget.count() > 0:
|
||||
# for c in range(self.combobox_frequency_profile.count()):
|
||||
#
|
||||
# if stg.SNR_stream_bed[c].shape != (0,):
|
||||
# if (stg.SNR_stream_bed[c].shape != (0,)) and (stg.SNR_stream_bed[c] != stg.BS_stream_bed[c]):
|
||||
#
|
||||
# if stg.SNR_stream_bed[c] != stg.BS_stream_bed[c]:
|
||||
#
|
||||
# if stg.SNR_stream_bed[c].shape != (0,):
|
||||
# # --- Case where the user change limits of BS_stream_bed or BS_cross_section in Acoustic data tab ---
|
||||
# stg.SNR_stream_bed[c] = (
|
||||
# stg.SNR_stream_bed[c][:, stg.BS_stream_bed[c].shape[1], stg.BS_stream_bed[c].shape[2]])
|
||||
# else:
|
||||
# pass
|
||||
# stg.SNR_stream_bed[c][:, :stg.BS_stream_bed[c].shape[1], :stg.BS_stream_bed[c].shape[2]])
|
||||
#
|
||||
# # --- Case where user change limits of BS_raw_data so that BS_cross_section is computed ---
|
||||
# # else:
|
||||
# #
|
||||
# # if stg.noise_method[c] == 1:
|
||||
# # self.load_noise_data_and_compute_SNR()
|
||||
# # elif stg.noise_method[c] == 2:
|
||||
# # pass
|
||||
# # elif stg.noise_method[c] == 3:
|
||||
# # self.compute_noise_from_value()
|
||||
#
|
||||
# # continuer ici en calculant SNR_stream_bed si on a travailler avec raw data et qu'on revient sur le 1er onglet
|
||||
# # pour couper ou rajouter la detection du fond. Du coup, il faudra recalculer le SNR stream bed ou cross section
|
||||
#
|
||||
# stg.BS_stream_bed_pre_process_SNR[c] = (
|
||||
# stg.SNR_stream_bed[c][:, stg.BS_stream_bed[c].shape[1], stg.BS_stream_bed[c].shape[2]])
|
||||
# stg.SNR_stream_bed[c][:, :stg.BS_stream_bed[c].shape[1], :stg.BS_stream_bed[c].shape[2]])
|
||||
#
|
||||
# if stg.BS_stream_bed_pre_process_SNR_average[c].shape != (0,):
|
||||
# stg.BS_stream_bed_pre_process_SNR_average[c] = (
|
||||
# stg.BS_stream_bed_pre_process_SNR_average[c][:, stg.BS_stream_bed[c].shape[1],stg.BS_stream_bed[c].shape[2]])
|
||||
# stg.BS_stream_bed_pre_process_SNR_average[c][:, :stg.BS_stream_bed[c].shape[1], :stg.BS_stream_bed[c].shape[2]])
|
||||
#
|
||||
# elif stg.BS_stream_bed_pre_process_average[c].shape != (0,):
|
||||
# stg.BS_stream_bed_pre_process_average[c] = (
|
||||
# stg.BS_stream_bed_pre_process_average[c][:, stg.BS_stream_bed[c].shape[1],stg.BS_stream_bed[c].shape[2]])
|
||||
# stg.BS_stream_bed_pre_process_average[c][:, :stg.BS_stream_bed[c].shape[1], :stg.BS_stream_bed[c].shape[2]])
|
||||
#
|
||||
# elif (stg.BS_cross_section[c].shape != (0,)) and (stg.SNR_cross_section[c] != stg.BS_cross_section[c]):
|
||||
#
|
||||
# elif stg.BS_cross_section[c].shape != (0,):
|
||||
#
|
||||
# if stg.SNR_cross_section[c] != stg.BS_cross_section[c]:
|
||||
#
|
||||
# stg.SNR_cross_section[c] = (
|
||||
# stg.SNR_cross_section[c][:, stg.BS_cross_section[c].shape[1], stg.BS_cross_section[c].shape[2]])
|
||||
#
|
||||
# stg.BS_cross_section_pre_process_SNR[c] = (
|
||||
# stg.SNR_cross_section[c][:, stg.BS_cross_section[c].shape[1], stg.BS_cross_section[c].shape[2]])
|
||||
#
|
||||
# if stg.BS_cross_section_pre_process_SNR_average[c].shape != (0,):
|
||||
# stg.BS_cross_section_pre_process_SNR_average[c] = (
|
||||
# stg.BS_cross_section_pre_process_SNR_average[c][:, stg.BS_cross_section[c].shape[1],stg.BS_cross_section[c].shape[2]])
|
||||
#
|
||||
# elif stg.BS_cross_section_pre_process_average[c].shape != (0,):
|
||||
# stg.BS_cross_section_pre_process_average[c] = (
|
||||
# stg.BS_cross_section_pre_process_average[c][:, stg.BS_cross_section[c].shape[1],stg.BS_cross_section[c].shape[2]])
|
||||
#
|
||||
# elif stg.BS_raw_data[c].shape != (0,):
|
||||
# # if stg.SNR_cross_section[c] != stg.BS_cross_section[c]:
|
||||
#
|
||||
# stg.SNR_cross_section[c] = (
|
||||
# stg.SNR_cross_section[c][:, stg.BS_cross_section[c].shape[1], stg.BS_cross_section[c].shape[2]])
|
||||
#
|
||||
# stg.BS_cross_section_pre_process_SNR[c] = (
|
||||
# stg.SNR_cross_section[c][:, stg.BS_cross_section[c].shape[1], stg.BS_cross_section[c].shape[2]])
|
||||
#
|
||||
# if stg.BS_cross_section_pre_process_SNR_average[c].shape != (0,):
|
||||
# stg.BS_cross_section_pre_process_SNR_average[c] = (
|
||||
# stg.BS_cross_section_pre_process_SNR_average[c][:, stg.BS_cross_section[c].shape[1],stg.BS_cross_section[c].shape[2]])
|
||||
#
|
||||
# elif stg.BS_cross_section_pre_process_average[c].shape != (0,):
|
||||
# stg.BS_cross_section_pre_process_average[c] = (
|
||||
# stg.BS_cross_section_pre_process_average[c][:, stg.BS_cross_section[c].shape[1],stg.BS_cross_section[c].shape[2]])
|
||||
#
|
||||
# self.plot_transect_with_SNR_data()
|
||||
|
||||
# else:
|
||||
#
|
||||
# if stg.SNR_cross_section[c] != stg.BS_cross_section[c]:
|
||||
#
|
||||
|
|
@ -1171,6 +1212,17 @@ class SignalProcessingTab(QWidget):
|
|||
# stg.BS_cross_section_pre_process_average[c] = (
|
||||
# stg.BS_cross_section_pre_process_average[c][:, stg.BS_cross_section[c].shape[1],stg.BS_cross_section[c].shape[2]])
|
||||
|
||||
def rename_data_preprocessed(self):
|
||||
print("stg.data_preprocessed ", stg.data_preprocessed)
|
||||
print("QPlainTextEdit.textCursor().blockNumber() ", QPlainTextEdit.textCursor(self.plaintextedit_list_pre_processed_data).blockNumber())
|
||||
line_number = int(QPlainTextEdit.textCursor(self.plaintextedit_list_pre_processed_data).blockNumber()/2)
|
||||
stg.data_preprocessed[line_number] = (
|
||||
QPlainTextEdit.textCursor(self.plaintextedit_list_pre_processed_data).blockNumber()/2)
|
||||
print("stg.data_preprocessed ", stg.data_preprocessed)
|
||||
line = QPlainTextEdit.textCursor(self.plaintextedit_list_pre_processed_data).blockNumber()
|
||||
print(self.plaintextedit_list_pre_processed_data.setTextCursor(QPlainTextEdit.textCursor(self.plaintextedit_list_pre_processed_data)))
|
||||
# textCursor().currentList().itemText(line)
|
||||
|
||||
|
||||
def combobox_fileListWidget_change_index(self):
|
||||
|
||||
|
|
@ -1346,6 +1398,7 @@ class SignalProcessingTab(QWidget):
|
|||
|
||||
stg.noise_method[self.combobox_fileListWidget.currentIndex()] = 1
|
||||
|
||||
|
||||
def load_noise_data_and_compute_SNR(self):
|
||||
|
||||
stg.noise_method[self.combobox_fileListWidget.currentIndex()] = 1
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ noise_method = []
|
|||
noise_value = []
|
||||
SNR_filter_value = []
|
||||
Nb_cells_to_average_BS_signal = []
|
||||
data_preprocessed = []
|
||||
|
||||
date = []
|
||||
date_noise = []
|
||||
|
|
|
|||
Loading…
Reference in New Issue