修复了多处滤波器的滤波参数不判断是否合法的问题

当滤波器阶数为0时,将输出原始信号
This commit is contained in:
2025-06-03 23:56:36 +08:00
parent 7197994019
commit ba2de0df39
6 changed files with 46 additions and 16 deletions

View File

@ -986,17 +986,31 @@ class Data:
try:
if Config["Mode"] == "BCG":
self.processed_data = data_preprocess_for_label_check(self.raw_data,
Config["Filter"]["BCGBandPassOrder"],
Config["Filter"]["BCGBandPassLow"],
Config["Filter"]["BCGBandPassHigh"],
Config["InputConfig"]["Freq"])
if Config["Filter"]["BCGBandPassOrder"] == 0:
self.processed_data = self.raw_data
else:
if ((Config["Filter"]["BCGBandPassLow"] >= Config["Filter"]["BCGBandPassHigh"]) or
(Config["Filter"]["BCGBandPassLow"] <= 0) or (Config["Filter"]["BCGBandPassHigh"] <= 0)):
return Result().failure(
info=Constants.PREPROCESS_FAILURE + Constants.FAILURE_REASON["Filter_Args_Not_Correct"])
self.processed_data = data_preprocess_for_label_check(self.raw_data,
Config["Filter"]["BCGBandPassOrder"],
Config["Filter"]["BCGBandPassLow"],
Config["Filter"]["BCGBandPassHigh"],
Config["InputConfig"]["Freq"])
elif Config["Mode"] == "ECG":
self.processed_data = data_preprocess_for_label_check(self.raw_data,
Config["Filter"]["ECGBandPassOrder"],
Config["Filter"]["ECGBandPassLow"],
Config["Filter"]["ECGBandPassHigh"],
Config["InputConfig"]["Freq"])
if Config["Filter"]["ECGBandPassOrder"] == 0:
self.processed_data = self.raw_data
else:
if ((Config["Filter"]["ECGBandPassLow"] >= Config["Filter"]["ECGBandPassHigh"]) or
(Config["Filter"]["ECGBandPassLow"] <= 0) or (Config["Filter"]["ECGBandPassHigh"] <= 0)):
return Result().failure(
info=Constants.PREPROCESS_FAILURE + Constants.FAILURE_REASON["Filter_Args_Not_Correct"])
self.processed_data = data_preprocess_for_label_check(self.raw_data,
Config["Filter"]["ECGBandPassOrder"],
Config["Filter"]["ECGBandPassLow"],
Config["Filter"]["ECGBandPassHigh"],
Config["InputConfig"]["Freq"])
else:
raise ValueError("模式不存在")
self.original_peak_y = [self.processed_data[x] for x in self.original_peak]