优化代码,注释掉不必要的计算,新增数据切割时的打印信息,调整信号时长计算逻辑

This commit is contained in:
2026-04-28 10:55:01 +08:00
parent 9a5f1a5a54
commit af3e717bb1
4 changed files with 8 additions and 5 deletions

4
.gitignore vendored
View File

@ -253,5 +253,5 @@ config/*
func/detect_Jpeak_model/* func/detect_Jpeak_model/*
.idea/* .idea/*
!./logs !./logs
!./config !./config/.gitkeep
!./func/detect_Jpeak_model !./func/detect_Jpeak_model

View File

@ -354,7 +354,9 @@ class Data:
"Get_Artifact_Format_Exception"] + "\n" + format_exc()) "Get_Artifact_Format_Exception"] + "\n" + format_exc())
self.config.update({ self.config.update({
"SignalSecond": int(len(self.OrgBCG) // self.config["Config"]["InputConfig"]["OrgBCGFreq"]) "SignalSecond": min(int(len(self.OrgBCG) // self.config["Config"]["InputConfig"]["OrgBCGFreq"]),
int(len(self.Tho) // self.config["Config"]["InputConfig"]["ThoFreq"]),
)
}) })
# 批量将睡眠分期按照映射转换为数字 # 批量将睡眠分期按照映射转换为数字

View File

@ -1353,7 +1353,7 @@ class Data:
# 计算互相关1/2 # 计算互相关1/2
try: try:
# 计算因子 # 计算因子
MULTIPLE_FACTOER = Params.APPROXIMATELY_ALIGN_CONFIG_NEW_CONTENT["Multiple_Factor"] # MULTIPLE_FACTOER = Params.APPROXIMATELY_ALIGN_CONFIG_NEW_CONTENT["Multiple_Factor"]
a = self.processed_downsample_Tho[ a = self.processed_downsample_Tho[
Config["PSGConfig"]["PreCut"]:len(self.processed_downsample_Tho) - Config["PSGConfig"][ Config["PSGConfig"]["PreCut"]:len(self.processed_downsample_Tho) - Config["PSGConfig"][
"PostCut"]].copy() "PostCut"]].copy()
@ -1365,7 +1365,7 @@ class Data:
# a = a.astype(int64) # a = a.astype(int64)
# v = v.astype(int64) # v = v.astype(int64)
tho_relate = correlate(a, v, mode='full') tho_relate = correlate(a, v, mode='full')
tho_relate = tho_relate / (MULTIPLE_FACTOER ** 2) # tho_relate = tho_relate / (MULTIPLE_FACTOER ** 2)
tho_relate2 = - tho_relate tho_relate2 = - tho_relate
result = {"tho_relate": tho_relate, "tho_relate2": tho_relate2} result = {"tho_relate": tho_relate, "tho_relate2": tho_relate2}

View File

@ -547,6 +547,7 @@ class Data:
try: try:
for key, raw in self.raw.items(): for key, raw in self.raw.items():
print(f"Cutting data for channel: {key}, original length: {len(raw)}")
if Config["ChannelInput"][key].startswith("PSG:"): if Config["ChannelInput"][key].startswith("PSG:"):
# 转换切割点 # 转换切割点
ECG_freq = Config["ECGFreq"] ECG_freq = Config["ECGFreq"]