生理信号估算_vital-sign-extraction
2026/7/23 20:40:35 网站建设 项目流程

以下为本文档的中文说明

该技能用于从经过清洗的一维生理时间序列信号中估算心率和呼吸率,单位为每分钟次数(bpm)。支持的信号类型包括雷达相位信号、WiFi CSI幅度、PPG信号或胸部运动信号。使用场景包括:当Claude需要从噪声信号中选择合适的HR/BR带通滤波器边界;在噪声频带中识别峰值频率;排除HR二次谐波对基频的干扰;处理呼吸缓慢时呼吸谐波泄漏到HR频带的问题;标记低置信度的估算结果。核心处理流程包括:将信号分割为呼吸频带和心率频带两个独立的带通滤波器;使用零填充Welch功率谱密度估计计算峰值频率;从各频带中提取峰值对应的频率并转换为bpm值。该技能明确了其不适用的场景:心律失常或逐搏分析、多人源信号分离、以及快速非平稳速率估算。它通常作为雷达信号处理技能的下游模块使用。


Vital-Sign Extraction

Given a cleaned 1-D periodic signal (radar phase, WiFi CSI, PPG, piezo), estimate heart rate and breathing rate in bpm.

Upstream ingestion of radar captures is theradar-signal-processingskill. This skill picks up after a 1-D signal is extracted.

Pipeline (do every step)

  1. Split into BR and HR bandswith two separate bandpasses:
    • BR:butter(4, [0.08, 0.5], btype='band', fs=fs)— 4.8–30 bpm
    • HR:butter(4, [0.7, 3.0], btype='band', fs=fs)— 42–180 bpm
  2. Peak frequency via zero-padded Welch PSD:
    nperseg=min(len(x),int(fs*25))f,p=welch(x,fs=fs,nperseg=nperseg,noverlap=nperseg//2,nfft=8*nperseg,detrend='constant')in_band=(f>=lo)&(f<=hi)peak_hz=f[in_band][np.argmax(p[in_band])]
  3. HR harmonic rejection — always run:
    f_sub=f_peak/2.0if0.7<=f_sub<=3.0:p_sub=np.interp(f_sub,f,p)p_top=np.interp(f_peak,f,p)ifp_sub>0.5*p_top:f_peak=f_sub# the peak was the 2nd harmonichr_bpm=f_peak*60
  4. Cross-check with autocorrelation:
    ac=np.correlate(x-x.mean(),x-x.mean(),mode='full')ac=ac[len(ac)//2:]/ac[len(ac)//2]lag=int(fs/f_hi)+np.argmax(ac[int(fs/f_hi):int(fs/f_lo)])bpm_ac=60*fs/lag
    Ifabs(bpm_ac - bpm_psd) > 5, flag as low confidence.

Decision rules

IfThen
f_peak/2in HR band andp_sub > 0.5 × p_topPick sub-harmonic (fundamental)
PSD and autocorrelation disagree by > 5 bpmFlag low confidence; do not commit to one value
BR estimate < 10 bpm (slow breather)Expect HR-band contamination — see references/harmonic-pitfalls.md
HR > 150 bpm (tachycardia)Widen HR band upper to 3.3 Hz, re-estimate
Clip < 15 s longPSD bin spacing > tolerance — prefer autocorrelation or flag inconclusive

Sanity checks before reporting

  • BR < HR. Always true for a live adult at rest — if violated you swapped bands.
  • HR × duration_minutes ≈ peak count in find_peaks(bandpassed_hr). Off by 2× → harmonic error slipped through.
  • Resting adult plausibility: HR 50–90 bpm, BR 10–20 bpm. Way outside → re-check band edges, decimation factor, and harmonic rejection.

Why the band edges above, not textbook 0.1–0.5 / 0.8–2.5

See references/band-rationale.md. Short version: textbook bands miss slow breathers (supine clinical subjects breathe 5–10 bpm) and bradycardia (athletes, post-tilt-down).

Why HR-harmonic and BR-leakage are critical

See references/harmonic-pitfalls.md. These are the two failure modes that cost naïve pipelines the most accuracy on real data.

Not in scope

  • Arrhythmia / irregular rhythms — use R-peak / foot detection + RR-interval analysis, not PSD.
  • Multiple subjects in one signal — run source separation first.
  • Rapidly non-stationary rate (exercise ramp) — use a spectrogram, not single-window PSD.

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询