修改了部分命名规则
This commit is contained in:
@ -7,7 +7,7 @@ from PySide6.QtWidgets import QMessageBox, QMainWindow, QApplication
|
||||
from matplotlib.backends.backend_qt import NavigationToolbar2QT
|
||||
from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as FigureCanvas
|
||||
from matplotlib.figure import Figure
|
||||
from numpy import repeat, convolve, ones, mean, std, int64, argmax, linspace, diff
|
||||
from numpy import convolve, ones, mean, std, int64, argmax, linspace, diff
|
||||
from overrides import overrides
|
||||
from pandas import read_csv, DataFrame
|
||||
from scipy.signal import find_peaks, resample, butter, sosfiltfilt, correlate
|
||||
|
||||
@ -89,9 +89,9 @@ class SettingWindow(QMainWindow):
|
||||
|
||||
Config.update({
|
||||
"Path": {
|
||||
"Input_OrgBCG": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_ORGBCG_ALIGNED /
|
||||
"Input_orgBcg": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_ORGBCG_ALIGNED /
|
||||
Path(str(self.sampID)) / Path(ConfigParams.ARTIFACT_LABEL_INPUT_ORGBCG_FILENAME +
|
||||
str(Config["InputConfig"]["OrgBCGFreq"]) +
|
||||
str(Config["InputConfig"]["orgBcgFreq"]) +
|
||||
ConfigParams.ENDSWITH_TXT))),
|
||||
"Input_BCG": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_ORGBCG_ALIGNED /
|
||||
Path(str(self.sampID)) / Path(ConfigParams.ARTIFACT_LABEL_INPUT_BCG_FILENAME +
|
||||
@ -110,9 +110,9 @@ class SettingWindow(QMainWindow):
|
||||
})
|
||||
|
||||
# 数据回显
|
||||
self.ui.spinBox_input_freq_orgBcg.setValue(Config["InputConfig"]["OrgBCGFreq"])
|
||||
self.ui.spinBox_input_freq_orgBcg.setValue(Config["InputConfig"]["orgBcgFreq"])
|
||||
self.ui.spinBox_input_freq_BCG.setValue(Config["InputConfig"]["BCGFreq"])
|
||||
self.ui.plainTextEdit_file_path_input_orgBcg.setPlainText(Config["Path"]["Input_OrgBCG"])
|
||||
self.ui.plainTextEdit_file_path_input_orgBcg.setPlainText(Config["Path"]["Input_orgBcg"])
|
||||
self.ui.plainTextEdit_file_path_input_BCG.setPlainText(Config["Path"]["Input_BCG"])
|
||||
self.ui.plainTextEdit_file_path_save_a.setPlainText(Config["Path"]["Save_a"])
|
||||
self.ui.plainTextEdit_file_path_save_b.setPlainText(Config["Path"]["Save_b"])
|
||||
@ -120,16 +120,16 @@ class SettingWindow(QMainWindow):
|
||||
|
||||
def __write_config__(self):
|
||||
# 从界面写入配置
|
||||
Config["InputConfig"]["OrgBCGFreq"] = self.ui.spinBox_input_freq_orgBcg.value()
|
||||
Config["InputConfig"]["orgBcgFreq"] = self.ui.spinBox_input_freq_orgBcg.value()
|
||||
Config["InputConfig"]["BCGFreq"] = self.ui.spinBox_input_freq_BCG.value()
|
||||
Config["Path"]["Input_OrgBCG"] = self.ui.plainTextEdit_file_path_input_orgBcg.toPlainText()
|
||||
Config["Path"]["Input_orgBcg"] = self.ui.plainTextEdit_file_path_input_orgBcg.toPlainText()
|
||||
Config["Path"]["Input_BCG"] = self.ui.plainTextEdit_file_path_input_BCG.toPlainText()
|
||||
Config["Path"]["Save_a"] = self.ui.plainTextEdit_file_path_save_a.toPlainText()
|
||||
Config["Path"]["Save_b"] = self.ui.plainTextEdit_file_path_save_b.toPlainText()
|
||||
Config["Path"]["Save_c"] = self.ui.plainTextEdit_file_path_save_c.toPlainText()
|
||||
|
||||
# 保存配置到文件
|
||||
self.config["InputConfig"]["OrgBCGFreq"] = self.ui.spinBox_input_freq_orgBcg.value()
|
||||
self.config["InputConfig"]["orgBcgFreq"] = self.ui.spinBox_input_freq_orgBcg.value()
|
||||
self.config["InputConfig"]["BCGFreq"] = self.ui.spinBox_input_freq_BCG.value()
|
||||
|
||||
with open(ConfigParams.ARTIFACT_LABEL_CONFIG_FILE_PATH, "w") as f:
|
||||
@ -450,7 +450,7 @@ class MainWindow_artifact_label(QMainWindow):
|
||||
try:
|
||||
# 计算傅里叶变换
|
||||
fft_result = fft(self.data.orgBcg[rect_left:rect_right])
|
||||
fft_freqs = fftfreq(len(self.data.orgBcg[rect_left:rect_right]), 1 / Config["InputConfig"]["OrgBCGFreq"])
|
||||
fft_freqs = fftfreq(len(self.data.orgBcg[rect_left:rect_right]), 1 / Config["InputConfig"]["orgBcgFreq"])
|
||||
# 确定频率高于20Hz的成分
|
||||
high_freq_indices = abs(fft_freqs) > 20
|
||||
high_freq_fft = fft_result[high_freq_indices]
|
||||
@ -463,7 +463,7 @@ class MainWindow_artifact_label(QMainWindow):
|
||||
# 计算傅里叶变换
|
||||
fft_result = fft(self.data.orgBcg[rect_left:rect_right])
|
||||
fft_freqs = fftfreq(len(self.data.orgBcg[rect_left:rect_right]),
|
||||
1 / Config["InputConfig"]["OrgBCGFreq"])
|
||||
1 / Config["InputConfig"]["orgBcgFreq"])
|
||||
# 确定频率高于20Hz的成分
|
||||
high_freq_indices = abs(fft_freqs) > 20
|
||||
high_freq_fft = fft_result[high_freq_indices]
|
||||
@ -1158,11 +1158,11 @@ class Data:
|
||||
self.df_Artifact_a = DataFrame(columns=["number", "type", "startTime", "endTime"])
|
||||
|
||||
def open_file(self):
|
||||
if (not Path(Config["Path"]["Input_OrgBCG"]).exists()) or (not Path(Config["Path"]["Input_BCG"]).exists()):
|
||||
if (not Path(Config["Path"]["Input_orgBcg"]).exists()) or (not Path(Config["Path"]["Input_BCG"]).exists()):
|
||||
return Result().failure(info=Constants.INPUT_FAILURE + Constants.ARTIFACT_LABEL_FAILURE_REASON["Data_Path_Not_Exist"])
|
||||
|
||||
try:
|
||||
self.orgBcg = read_csv(Config["Path"]["Input_OrgBCG"],
|
||||
self.orgBcg = read_csv(Config["Path"]["Input_orgBcg"],
|
||||
encoding=ConfigParams.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
self.BCG = read_csv(Config["Path"]["Input_BCG"],
|
||||
|
||||
@ -33,7 +33,7 @@ class ConfigParams:
|
||||
APPROXIMATELY_ALIGN_CONFIG_FILE_PATH: str = "./config/Config_approximately_align.yaml"
|
||||
APPROXIMATELY_ALIGN_CONFIG_NEW_CONTENT: dict = {
|
||||
"InputConfig": {
|
||||
"OrgBCGFreq": 1000,
|
||||
"orgBcgFreq": 1000,
|
||||
"ThoFreq": 100,
|
||||
"AbdFreq": 100
|
||||
},
|
||||
@ -227,7 +227,7 @@ class ConfigParams:
|
||||
ARTIFACT_LABEL_CONFIG_FILE_PATH: str = "./config/Config_artifact_label.yaml"
|
||||
ARTIFACT_LABEL_CONFIG_NEW_CONTENT: dict = {
|
||||
"InputConfig": {
|
||||
"OrgBCGFreq": 1000,
|
||||
"orgBcgFreq": 1000,
|
||||
"BCGFreq": 1000
|
||||
},
|
||||
"CustomAutoplayArgs": {
|
||||
@ -248,7 +248,7 @@ class ConfigParams:
|
||||
SA_LABEL_CONFIG_FILE_PATH: str = "./config/Config_SA_label.yaml"
|
||||
SA_LABEL_CONFIG_NEW_CONTENT: dict = {
|
||||
"InputConfig": {
|
||||
"OrgBCGFreq": 1000,
|
||||
"orgBcgFreq": 1000,
|
||||
"ThoFreq": 100,
|
||||
"AbdFreq": 100,
|
||||
"FlowTFreq": 100,
|
||||
|
||||
Reference in New Issue
Block a user