跳到正文

生理信号处理与研究分析

使用 NeuroKit2 处理心电、光电容积脉搏和其他生理信号,组织信号清洗、特征提取与研究分析。

开源精选医疗业务23 个文件50,135 Stars浏览次数 0K-Dense-AI/scientific-agent-skills MIT版本 a1043ef
开始使用

适用环境:Python 3.10+ and uv; pinned workflows use NeuroKit2 0.2.13. Core processing needs NumPy, SciPy, pandas<3, scikit-learn, matplotlib, PyWavelets, requests, and setuptools; selected EEG, cvxEDA, plotting, file-format, and RQA features need separately locked optional packages.

输入资料
获准使用的生理信号与采样信息 研究目标和 NeuroKit2 环境 阅读本节完整说明
交付内容
信号处理与特征资料 研究分析和质量检查记录 阅读本节完整说明
环境与依赖
For optional features, create a uv project, add only the packages actually required at reviewed exact versions, and commit/review the resulting uv.lock before uv sync --locked. NeuroKit2 exposes an upstream full extra, b… 阅读本节完整说明
  1. 获取完整包,保留配套文件的目录结构。
  2. 按照原文准备所需工具、依赖与输入资料。
  3. 阅读对应使用步骤与输入输出说明,在自己的环境中验证结果。

使用提示摘自原文,配套文件保留来源版本;实际运行条件以各包说明为准。

正文

获取原文件

references/eog.md

Checked 2026-10-01 against NeuroKit2 0.2.13 stable source/runtime and the official EOG API/example.

Scope and orientation

NeuroKit2's EOG pipeline is primarily a vertical EOG blink workflow. Stable eog_process() requires blinks to be positive-going peaks. Verify channel montage, polarity, reference, physical unit, sampling rate, hardware filters, amplifier range, clock, and synchronization before processing.

Do not use this module as a full gaze, saccade, fixation, or sleep-scoring system. Horizontal/vertical eye-movement interpretation and clinical/drowsiness monitoring need separate validated methods.

Optional MNE default

eog_peaks() and eog_findpeaks() default to method="mne". In the core 0.2.13 installation, MNE is optional; the default can therefore raise an ImportError. Either add MNE at a reviewed exact version to the project lock or choose a core method:

signals, info = nk.eog_process(
    veog,
    sampling_rate=200,
    method="neurokit",
)

eog_process() forwards **kwargs to cleaning and peak finding. Record the explicit method rather than relying on an environment-dependent default.

Stable schemas

The high-level return is (signals, info). Default columns are:

EOG_Raw, EOG_Clean, EOG_Blinks, EOG_Rate

info has EOG_Blinks (sample indices) and sampling_rate.

Low-level interfaces differ:

clean = nk.eog_clean(veog, sampling_rate=200, method="neurokit")

# Returns only an array of blink sample indices.
blink_indices = nk.eog_findpeaks(
    clean,
    sampling_rate=200,
    method="neurokit",
)

# Returns (same-length marker DataFrame, info dict).
blink_markers, blink_info = nk.eog_peaks(
    clean,
    sampling_rate=200,
    method="neurokit",
)

The 0.2.13 eog_peaks() docstring return section says array, while its tagged source returns (signals, info). The pinned source/runtime is authoritative for stable work.

Stable cleaning methods include neurokit, agarwal2019, mne, brainstorm, and kong1998. Peak methods include neurokit, mne, brainstorm, and blinker. MNE and some method paths need optional dependencies.

features = nk.eog_features(
    clean,
    blink_info["EOG_Blinks"],
    sampling_rate=200,
)

eog_features() needs both the cleaned signal and peak-index array. It returns a dict with event-level fields such as:

Blink_LeftZeros, Blink_RightZeros, Blink_pAVR,
Blink_nAVR, Blink_BAR, Blink_Duration

Do not pass the processed DataFrame as the only argument. Feature validity depends on positive orientation and accurate blink segmentation.

Sampling and artifacts

Choose a rate from the endpoint and hardware bandwidth, not a universal number. Basic blink timing may use lower rates than detailed eyelid velocity or saccade morphology. Validate temporal error against labeled data at the actual rate; 200–500 Hz is common in research but not a guarantee.

Inspect:

  • saturation and clipping during large eye movements;
  • baseline drift and electrode polarization;
  • frontal/facial EMG and movement/cable artifacts;
  • line noise and channel detachment;
  • polarity and montage changes across sessions; and
  • missing samples and synchronization with EEG/events.

Do not interpolate through a blink or across detachment. Preserve raw/clean overlays, blink markers, rejected segments, and manual review outcomes.

Event and interval analysis

epochs = nk.epochs_create(
    signals,
    events,
    sampling_rate=200,
    epochs_start=-0.5,
    epochs_end=2,
    baseline_correction=False,
)
event_features = nk.eog_eventrelated(epochs)
interval_features = nk.eog_intervalrelated(signals)

Documented event-related fields include EOG_Rate_Baseline, rate min/max/mean/SD and times, plus EOG_Blinks_Presence. Interval analysis returns EOG_Peaks_N and EOG_Rate_Mean in the official example. It does not universally return blink amplitude or duration summaries. Inspect columns at runtime.

Blink rate over short windows is unstable and task-dependent. A count/rate change does not uniquely identify attention, fatigue, stress, dry eye, dopamine, or a neurological condition.

EEG integration

EOG can help identify ocular contamination in EEG, but NeuroKit2 does not provide a complete validated correction pipeline here. With MNE:

  1. synchronize and preserve dedicated EOG channels;
  2. fit artifact identification/correction on appropriate data;
  3. verify component or regression selection without removing neural signal;
  4. compare raw and corrected ERPs/spectra/topographies; and
  5. report method, channels, filters, thresholds, components, and exclusions.

Avoid circularly selecting correction settings to maximize an experimental result.

Sources checked 2026-10-01

CONTACT HAONAN

联系haonan

医疗 AI · 产品与独立开发

刘浩南

关注医疗 AI 从 demo 到真实落地,聚焦产品化、商业化与院内工作流效率提升。

12年医疗产研经验,大湾区头部医疗AI公司前产品总监,独立开发者

医疗 AI 产品化医疗 AI 商业化院内工作流效率
刘浩南的微信联系二维码
微信扫一扫,联系 haonan