DataPrepare/utils/event_map.py
marques 8ee5980906 feat: Add utility functions for signal processing and event mapping
- 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.
2026-03-24 21:15:05 +08:00

42 lines
956 B
Python

# apnea event type to number mapping
E2N = {
"Hypopnea": 1,
"Central apnea": 2,
"Obstructive apnea": 3,
"Mixed apnea": 4
}
N2Chn = {
1: "Rpeak",
2: "ECG_Sync",
3: "Effort Tho",
4: "Effort Abd",
5: "Flow P",
6: "Flow T",
7: "SpO2",
8: "5_class"
}
Stage2N = {
"W": 5,
"N1": 3,
"N2": 2,
"N3": 1,
"R": 4,
}
# 设定事件和其对应颜色
# event_code color event
# 0 黑色 背景
# 1 粉色 低通气
# 2 蓝色 中枢性
# 3 红色 阻塞型
# 4 灰色 混合型
# 5 绿色 血氧饱和度下降
# 6 橙色 大体动
# 7 橙色 小体动
# 8 橙色 深呼吸
# 9 橙色 脉冲体动
# 10 橙色 无效片段
ColorCycle = ["black", "pink", "blue", "red", "silver", "green", "orange", "orange", "orange", "orange",
"orange"]