- Created a new module `utils/__init__.py` to consolidate utility imports. - Added `event_map.py` for mapping apnea event types to numerical values and colors. - Implemented various filtering functions in `filter_func.py`, including Butterworth, Bessel, downsampling, and notch filters. - Developed `operation_tools.py` for dataset configuration loading, event mask generation, and signal processing utilities. - Introduced `split_method.py` for segmenting data based on movement and amplitude criteria. - Added `statistics_metrics.py` for calculating amplitude metrics and generating confusion matrices. - Included a new Excel file for additional data storage.
43 lines
847 B
Python
43 lines
847 B
Python
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.append(str(Path(__file__).resolve().parent.parent))
|
|
project_root_path = Path(__file__).resolve().parent.parent
|
|
|
|
import shutil
|
|
import draw_tools
|
|
import utils
|
|
import numpy as np
|
|
import signal_method
|
|
import os
|
|
import mne
|
|
from tqdm import tqdm
|
|
import xml.etree.ElementTree as ET
|
|
import re
|
|
|
|
# 获取分期和事件标签,以及不可用区间
|
|
|
|
def process_one_signal(samp_id, show=False):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
yaml_path = project_root_path / "dataset_config/SHHS1_config.yaml"
|
|
|
|
conf = utils.load_dataset_conf(yaml_path)
|
|
|
|
root_path = Path(conf["root_path"])
|
|
save_path = Path(conf["mask_save_path"])
|
|
|
|
print(f"root_path: {root_path}")
|
|
print(f"save_path: {save_path}")
|
|
|
|
org_signal_root_path = root_path / "OrgBCG_Aligned"
|
|
label_root_path = root_path / "Label"
|
|
|