AgentSkillsCN

neurokit2-biosignal-processing

处理并分析神经生理信号,包括 EDA(皮肤电活动)、ECG(心电图)和 RSP(呼吸信号)。适用于提取皮肤电导反应、检测心跳 R 波峰值、分析呼吸模式,或从 CSV 时间序列数据中计算生物信号特征。

SKILL.md
--- frontmatter
name: neurokit2-biosignal-processing
description: Process and analyze neurophysiological signals including EDA (electrodermal activity), ECG (electrocardiogram), and RSP (respiration). Use when extracting skin conductance responses, detecting heartbeat R-peaks, analyzing breathing patterns, or computing biosignal features from CSV time-series data.

NeuroKit2: Neurophysiological Signal Processing

Overview

NeuroKit2 is a Python toolkit for processing biosignals. It provides automated pipelines for cleaning, peak detection, and feature extraction from EDA, ECG, EMG, RSP, and other physiological signals.

Quick Start

bash
python scripts/extract_eda_scr.py --input eda_signal.csv --output scr_features.csv --sampling_rate 250

Scripts

scripts/extract_eda_scr.py

Extract Skin Conductance Response (SCR) features from EDA signals.

bash
python scripts/extract_eda_scr.py --input <eda.csv> --output <features.csv> --sampling_rate <hz>

Parameters:

  • --input — CSV file with single-column EDA signal data
  • --output — Output CSV with SCR onset, peak, amplitude, rise time
  • --sampling_rate — Signal sampling rate in Hz (must match recording device)

scripts/extract_ecg_peaks.py

Detect R-peaks and P-waves from ECG signals.

bash
python scripts/extract_ecg_peaks.py --input <ecg.csv> --output <peaks.csv> --sampling_rate <hz>

Parameters:

  • --input — CSV file with single-column ECG signal data
  • --output — Output CSV with peak sample indices
  • --sampling_rate — Signal sampling rate in Hz (default: 150)

scripts/extract_rsp.py

Analyze respiration signals to extract breathing rate and peak times.

bash
python scripts/extract_rsp.py --input <rsp.csv> --output <features.csv> --sampling_rate <hz>

Important Notes

  • Sampling rate is critical — Incorrect values produce wrong peak detection results
  • Output format — CSV columns with values in [v1,v2,...] array notation
  • Dependency — Requires neurokit2 package (pip install neurokit2)