修复了多处滤波器的滤波参数不判断是否合法的问题
当滤波器阶数为0时,将输出原始信号
This commit is contained in:
@ -424,6 +424,10 @@ class Data:
|
||||
Constants.FAILURE_REASON["Data_Not_Exist"])
|
||||
|
||||
try:
|
||||
if ((Config["Filter"]["BandPassLow"] >= Config["Filter"]["BandPassHigh"]) or
|
||||
(Config["Filter"]["BandPassLow"] <= 0) or (Config["Filter"]["BandPassHigh"] <= 0)):
|
||||
return Result().failure(
|
||||
info=Constants.PREPROCESS_FAILURE + Constants.FAILURE_REASON["Filter_Args_Not_Correct"])
|
||||
self.processed_data = preprocess(self.raw_data,
|
||||
Config["InputConfig"]["Freq"],
|
||||
Config["Filter"]["BandPassLow"],
|
||||
@ -445,6 +449,9 @@ class Data:
|
||||
Constants.FAILURE_REASON["Data_Not_Exist"])
|
||||
|
||||
try:
|
||||
if Config["IntervalLow"] >= Config["IntervalHigh"]:
|
||||
return Result().failure(
|
||||
info=Constants.DETECT_JPEAK_PREDICT_FAILURE + Constants.FAILURE_REASON["Interval_Args_Not_Correct"])
|
||||
self.peak, self.interval = Jpeak_Detection(model.selected_model,
|
||||
Path(model.model_folder_path) / Path(model.selected_model),
|
||||
self.processed_data,
|
||||
|
||||
@ -425,6 +425,10 @@ class Data:
|
||||
Constants.FAILURE_REASON["Data_Not_Exist"])
|
||||
|
||||
try:
|
||||
if ((Config["Filter"]["BandPassLow"] >= Config["Filter"]["BandPassHigh"]) or
|
||||
(Config["Filter"]["BandPassLow"] <= 0) or (Config["Filter"]["BandPassHigh"] <= 0)):
|
||||
return Result().failure(
|
||||
info=Constants.PREPROCESS_FAILURE + Constants.FAILURE_REASON["Filter_Args_Not_Correct"])
|
||||
self.processed_data = preprocess(self.raw_data,
|
||||
Config["InputConfig"]["Freq"],
|
||||
Config["Filter"]["BandPassLow"],
|
||||
|
||||
@ -986,12 +986,26 @@ class Data:
|
||||
|
||||
try:
|
||||
if Config["Mode"] == "BCG":
|
||||
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":
|
||||
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"],
|
||||
|
||||
@ -456,7 +456,8 @@ class Data:
|
||||
if Config["Filter"]["BCGBandPassOrder"] == 0:
|
||||
self.processed_data = self.raw_data
|
||||
else:
|
||||
if Config["Filter"]["BCGBandPassLow"] >= Config["Filter"]["BCGBandPassHigh"]:
|
||||
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 = Butterworth_for_BCG_PreProcess(self.raw_data, type='bandpass',
|
||||
@ -468,7 +469,8 @@ class Data:
|
||||
if Config["Filter"]["ECGBandPassOrder"] == 0:
|
||||
self.processed_data = self.raw_data
|
||||
else:
|
||||
if Config["Filter"]["ECGBandPassLow"] >= Config["Filter"]["ECGBandPassHigh"]:
|
||||
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 = Butterworth_for_ECG_PreProcess(self.raw_data, type='bandpass',
|
||||
|
||||
@ -811,6 +811,7 @@ class MainWindow_resp_quality_label(QMainWindow):
|
||||
if self.ui.radioButton_orgBcg_fillterMode_custom.isChecked():
|
||||
if self.check_filter_args() is False:
|
||||
PublicFunc.msgbox_output(self, Constants.RESP_QUALITY_LABEL_CUSTOM_FILTER_ARGS_ERROR, Constants.MSGBOX_TYPE_ERROR)
|
||||
PublicFunc.finish_operation(self, ButtonState)
|
||||
return
|
||||
result = self.__plot__()
|
||||
if not result.status:
|
||||
@ -1035,7 +1036,8 @@ class MainWindow_resp_quality_label(QMainWindow):
|
||||
self.ax1_spectrum.set_title(Constants.RESP_QUALITY_LABEL_SPECTRUM_THO_TITLE, fontsize=8)
|
||||
|
||||
def check_filter_args(self):
|
||||
if (float(Config["Filter"]["BandPassLow"]) >= float(Config["Filter"]["BandPassHigh"])):
|
||||
if ((float(Config["Filter"]["BandPassLow"]) >= float(Config["Filter"]["BandPassHigh"])) or
|
||||
(float(Config["Filter"]["BandPassLow"]) <= 0) or (float(Config["Filter"]["BandPassHigh"]) <= 0)):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
@ -106,7 +106,8 @@ class Constants:
|
||||
"Data_Length_not_Correct": "(orgBcg和BCG长度不匹配)",
|
||||
"Artifact_Format_Not_Correct": "(体动长度或格式不正确)",
|
||||
"Data_Length_Not_Correct": "(信号长度不正确)",
|
||||
"Filter_Args_Not_Correct": "(滤波器参数输入不正确)",
|
||||
"Filter_Args_Not_Correct": "(滤波器参数输入不正确,上下截止频率都要大于0,且上截止频率应大于下截止频率)",
|
||||
"Interval_Args_Not_Correct": "(间期参数输入不正确,上间期阈值应大于下间期阈值)",
|
||||
|
||||
"Open_Data_Exception": "(打开数据异常)",
|
||||
"Process_Exception": "(处理异常)",
|
||||
@ -448,8 +449,8 @@ class Constants:
|
||||
RESP_QUALITY_LABEL_ADD_POINTS_SUCCESSFULLY: str = "成功新增点,横坐标:"
|
||||
RESP_QUALITY_LABEL_REMOVE_POINTS_SUCCESSFULLY: str = "成功删除点,横坐标:"
|
||||
RESP_QUALITY_LABEL_NO_POINT_IN_THE_INTERVAL: str = "所选区间内无新增或删除点"
|
||||
RESP_QUALITY_LABEL_CUSTOM_FILTER_ARGS_ERROR: str = "OrgBCG带通滤波频率设置范围应为数字,范围是0~1"
|
||||
RESP_QUALITY_LABEL_AUTOLABEL_ARGS_ERROR: str = "人工标注阈值设置范围应为数字,范围是0~1"
|
||||
RESP_QUALITY_LABEL_CUSTOM_FILTER_ARGS_ERROR: str = "OrgBCG带通滤波频率设置范围应为数字,范围是0~1,且上截止频率应大于下截止频率"
|
||||
RESP_QUALITY_LABEL_AUTOLABEL_ARGS_ERROR: str = "人工标注阈值设置范围应为数字,范围是0~1,且[1]应大于[0]"
|
||||
RESP_QUALITY_LABEL_CHECK_ARGS_QUESTION_CONTENT: str = "你确定要执行此操作吗,请确保参数输入正确"
|
||||
RESP_QUALITY_LABEL_ACTION_LABEL_MULTIPLE_NAME: str = f"批量更改标签({Params.RESP_QUALITY_LABEL_ACTION_LABEL_MULTIPLE_SHORTCUT_KEY})"
|
||||
RESP_QUALITY_LABEL_A_QUALITY: int = 1
|
||||
|
||||
Reference in New Issue
Block a user