Processes and analyzes physiological biosignals (ECG, EEG, EDA, RSP, PPG, EMG, EOG) using the NeuroKit2 Python toolkit. Supports HRV, event-related potentials, complexity measures, and multi-modal integration for psychophysiology research.
Ships in alterlab-clinical-research. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
NeuroKit2 is a comprehensive Python toolkit for processing and analyzing physiological signals (biosignals). Use this skill to process cardiovascular, neural, autonomic, respiratory, and muscular signals for psychophysiology research, clinical applications, and human-computer interaction studies.
Apply this skill when working with:
| Scenario | Use Instead |
|---|---|
| "EDA" meaning exploratory data analysis of a dataset, not electrodermal activity | alterlab-eda |
| Training clinical prediction models on EHR or sleep/EEG datasets (MIMIC, SleepEDF) | alterlab-pyhealth |
| Spike sorting and extracellular electrophysiology (Neuropixels, Kilosort) | alterlab-neuropixels |
| Reading or converting DICOM medical images | alterlab-pydicom |
| General time-series classification, clustering, or forecasting models | alterlab-aeon |
Hand-off rule. When the request matches a row above, open your answer by naming that skill by its exact id (for example alterlab-eda) and saying in one line why it fits better, then stop applying this skill's procedure. Name it even when you also need to ask for missing input. If only part of the request is out of scope, name the skill for that part and do only the in-scope part. A brief general pointer is fine; the named skill does the work.
Process electrocardiogram and photoplethysmography signals for cardiovascular analysis. See references/ecg_cardiac.md for detailed workflows.
Primary workflows:
Key functions:
import neurokit2 as nk
# Complete ECG processing pipeline
signals, info = nk.ecg_process(ecg_signal, sampling_rate=1000)
# Analyze ECG data (event-related or interval-related)
analysis = nk.ecg_analyze(signals, sampling_rate=1000)
# Comprehensive HRV analysis
hrv = nk.hrv(peaks, sampling_rate=1000) # Time, frequency, nonlinear domains
Compute comprehensive HRV metrics from cardiac signals. See references/hrv.md for all indices and domain-specific analysis.
Supported domains:
Key functions:
# All HRV indices at once
hrv_indices = nk.hrv(peaks, sampling_rate=1000)
# Domain-specific analysis
hrv_time = nk.hrv_time(peaks)
hrv_freq = nk.hrv_frequency(peaks, sampling_rate=1000)
hrv_nonlinear = nk.hrv_nonlinear(peaks, sampling_rate=1000)
# hrv_rsa takes the *processed* ECG and RSP signal DataFrames (from ecg_process/rsp_process,
# not raw arrays or bare peaks); pass R-peak indices via rpeaks=. See references/hrv.md.
hrv_rsa = nk.hrv_rsa(ecg_signals, rsp_signals=rsp_signals,
rpeaks=info['ECG_R_Peaks'], sampling_rate=1000)
Analyze electroencephalography signals for frequency power, complexity, and microstate patterns. See references/eeg.md for detailed workflows and MNE integration.
Primary capabilities:
Key functions:
# Power analysis across frequency bands (returns power per channel × band).
# Select/subset channels upstream on the MNE Raw or array; eeg_power has no `channels` arg.
power = nk.eeg_power(eeg_data, sampling_rate=250)
# Microstate analysis (sampling_rate is required for the default train='gfp' path)
microstates = nk.microstates_segment(eeg_data, n_microstates=4, method='kmod',
sampling_rate=250)
static = nk.microstates_static(microstates, sampling_rate=250)
dynamic = nk.microstates_dynamic(microstates)
Process skin conductance signals for autonomic nervous system assessment. See references/eda.md for detailed workflows.
Primary workflows:
Key functions:
# Complete EDA processing
signals, info = nk.eda_process(eda_signal, sampling_rate=100)
# Analyze EDA data
analysis = nk.eda_analyze(signals, sampling_rate=100)
# Sympathetic nervous system activity: pass the EDA vector (raw or signals["EDA_Clean"]),
# not the processed DataFrame; the default 'posada' method needs > 64 s of signal
sympathetic = nk.eda_sympathetic(eda_signal, sampling_rate=100)
Analyze breathing patterns and respiratory variability. See references/rsp.md for detailed workflows.
Primary capabilities:
Key functions:
# Complete RSP processing
signals, info = nk.rsp_process(rsp_signal, sampling_rate=100)
# Respiratory rate variability (accepts the processed DataFrame)
rrv = nk.rsp_rrv(signals, sampling_rate=100)
# Respiratory volume per time: rsp_process already adds an "RSP_RVT" column;
# to recompute, pass the 1-D respiration vector (a DataFrame raises ValueError)
rvt = nk.rsp_rvt(rsp_signal, sampling_rate=100)
Process muscle activity signals for activation detection and amplitude analysis. See references/emg.md for workflows.
Key functions:
# Complete EMG processing (adds EMG_Amplitude, EMG_Activity, EMG_Onsets, EMG_Offsets)
signals, info = nk.emg_process(emg_signal, sampling_rate=1000)
# Re-run activation detection with other settings: pass the amplitude vector, not the DataFrame
activity, activation_info = nk.emg_activation(
emg_amplitude=signals["EMG_Amplitude"], sampling_rate=1000, method="threshold"
)
Analyze eye movement and blink patterns. See references/eog.md for workflows.
Key functions:
# Complete EOG processing. Blink detection defaults to method="mne" (needs MNE-Python:
# add `--with mne` to the uv run line); method="neurokit" avoids the MNE dependency
signals, info = nk.eog_process(eog_signal, sampling_rate=500, method="neurokit")
# Extract blink features: needs the cleaned signal and the blink peak indices
features = nk.eog_features(signals["EOG_Clean"], info["EOG_Blinks"], sampling_rate=500)
Apply filtering, decomposition, and transformation operations to any signal. See references/signal_processing.md for comprehensive utilities.
Key operations:
Key functions:
# Filtering
filtered = nk.signal_filter(signal, sampling_rate=1000, lowcut=0.5, highcut=40)
# Peak detection
peaks = nk.signal_findpeaks(signal)
# Power spectral density
psd = nk.signal_psd(signal, sampling_rate=1000)
Compute nonlinear dynamics, fractal dimensions, and information-theoretic measures. See references/complexity.md for all available metrics.
Available measures:
Key functions:
# Multiple complexity metrics at once (note: complexity() takes no sampling_rate)
complexity_indices, info = nk.complexity(signal)
# Specific measures: entropy_*, fractal_*, and complexity_* functions return a
# (value, info) tuple, so unpack them
apen, _ = nk.entropy_approximate(signal)
dfa, _ = nk.fractal_dfa(signal)
lle, _ = nk.complexity_lyapunov(signal, delay=1, dimension=2)
Create epochs around stimulus events and analyze physiological responses. See references/epochs_events.md for workflows.
Primary capabilities:
Key functions:
# Find events in signal
events = nk.events_find(trigger_signal, threshold=0.5)
# Create epochs around events
epochs = nk.epochs_create(signals, events, sampling_rate=1000,
epochs_start=-0.5, epochs_end=2.0)
# Average across epochs
grand_average = nk.epochs_average(epochs)
Process multiple physiological signals simultaneously with unified output. See references/bio_module.md for integration workflows.
Key functions:
# Process multiple signals at once
bio_signals, bio_info = nk.bio_process(
ecg=ecg_signal,
rsp=rsp_signal,
eda=eda_signal,
emg=emg_signal,
sampling_rate=1000
)
# Analyze all processed signals
bio_analysis = nk.bio_analyze(bio_signals, sampling_rate=1000)
NeuroKit2 automatically selects between two analysis modes based on data duration:
Event-related analysis (< 10 seconds):
Interval-related analysis (≥ 10 seconds):
Most *_analyze() functions automatically choose the appropriate mode.
No install step: uv run resolves the package per run.
uv run --python ">=3.11" --with "neurokit2>=0.2.13" python analysis.py
Function signatures in this skill are verified against neurokit2 0.2.13 (current release
as of 2026-09; requires Python >= 3.10). Pin the interpreter: uv's default may be an older
Python on which neurokit2>=0.2.13 cannot be installed. For a reproducible run use
--with "neurokit2==0.2.13". EEG helpers (mne_*, source localization) and the default EOG
blink detector also need MNE-Python (--with mne); method_phasic="cvxeda" needs --with cvxopt.
For the development version:
uv run --python ">=3.11" --with "neurokit2 @ https://github.com/neuropsychology/NeuroKit/zipball/dev" python analysis.py
import neurokit2 as nk
# Load example data
ecg = nk.ecg_simulate(duration=60, sampling_rate=1000)
# Process ECG
signals, info = nk.ecg_process(ecg, sampling_rate=1000)
# Analyze HRV
hrv = nk.hrv(info['ECG_R_Peaks'], sampling_rate=1000)
# Visualize
nk.ecg_plot(signals, info)
# Process multiple signals
bio_signals, bio_info = nk.bio_process(
ecg=ecg_signal,
rsp=rsp_signal,
eda=eda_signal,
sampling_rate=1000
)
# Analyze all signals
results = nk.bio_analyze(bio_signals, sampling_rate=1000)
# Find events
events = nk.events_find(trigger_channel, threshold=0.5)
# Create epochs
epochs = nk.epochs_create(processed_signals, events,
sampling_rate=1000,
epochs_start=-0.5, epochs_end=2.0)
# Event-related analysis for each signal type
ecg_epochs = nk.ecg_eventrelated(epochs)
eda_epochs = nk.eda_eventrelated(epochs)
This skill includes comprehensive reference documentation organized by signal type and analysis method:
Load specific reference files as needed using the Read tool to access detailed function documentation and parameters.
Part of the AlterLab Academic Skills suite.
evals/evals.json (opens in a new tab)evals/fixtures/eda_recording/README.md (opens in a new tab)evals/fixtures/eda_recording/eda_emotion_task.csv (opens in a new tab)references/bio_module.md (opens in a new tab)references/complexity.md (opens in a new tab)references/ecg_cardiac.md (opens in a new tab)references/eda.md (opens in a new tab)references/eeg.md (opens in a new tab)references/emg.md (opens in a new tab)references/eog.md (opens in a new tab)references/epochs_events.md (opens in a new tab)references/hrv.md (opens in a new tab)references/ppg.md (opens in a new tab)references/rsp.md (opens in a new tab)references/signal_processing.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/alterlab-clinical-research:alterlab-neurokit2from alterlab-clinical-research
npx claudepluginhub alterlab-ieu/alterlab-academic-skills --plugin alterlab-clinical-research7 skills in this plugin
/alterlab-clinical-decisionGenerates professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings — biomarker-stratified patient cohort analyses with outcomes and evidence-based treatment recommendation reports with decision algorithms, supporting GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance, output as publication-ready LaTeX/PDF. Use when building a CDS document, cohort analysis, or treatment recommendation report for drug development, clinical research, or evidence synthesis, or when GRADE grading, hazard ratios, survival/waterfall plots, or biomarker stratification are requested. Part of the AlterLab Academic Skills suite./alterlab-clinical-reportsWrites comprehensive clinical reports — case reports (CARE guidelines), diagnostic reports (radiology, pathology, lab), clinical trial reports (ICH-E3, SAE, CSR), and patient documentation (SOAP notes, H&P, discharge summaries) — with templates, regulatory compliance (HIPAA, FDA, ICH-GCP), and validation tools. Use when drafting a case report for journal publication, a radiology/pathology/lab diagnostic report, an ICH-E3 clinical study report (CSR) or SAE narrative, or SOAP/H&P/discharge patient records needing regulatory-compliant formatting. Part of the AlterLab Academic Skills suite./alterlab-iso13485Prepares ISO 13485 certification documentation for medical device Quality Management Systems (QMS) — gap analysis of existing documentation, Quality Manuals, required procedures and work instructions, and Medical Device Files. Use for ISO 13485 QMS documentation, conducting a documentation gap analysis, drafting a Quality Manual or SOP/work instruction, assembling a Medical Device File, identifying missing documentation for medical device certification, or when medical device regulations, QMS certification, FDA QMSR, or EU MDR are mentioned. Part of the AlterLab Academic Skills suite./alterlab-pydicomReads, writes, and manipulates DICOM (Digital Imaging and Communications in Medicine) medical imaging files with the pydicom Python library. Use when reading/writing/modifying DICOM data, extracting pixel data from CT, MRI, X-ray, or ultrasound images, anonymizing DICOM files, working with DICOM metadata and tags, converting DICOM to other formats, handling compressed DICOM, or processing medical imaging datasets for PACS systems, radiology workflows, and healthcare imaging applications. Part of the AlterLab Academic Skills suite./alterlab-pyhealthDevelops, tests, and validates clinical machine learning models with the PyHealth 2.x healthcare AI toolkit. Use when working with electronic health records (EHR), clinical prediction tasks (mortality, readmission, length of stay, drug recommendation), medical coding systems (ICD, NDC, ATC, CCS), physiological signals (EEG, ECG), healthcare datasets (MIMIC-III/IV, eICU, OMOP), or implementing deep learning models for healthcare (RETAIN, SafeDrug, GAMENet, Transformer, GAT/GCN). Part of the AlterLab Academic Skills suite./alterlab-treatment-plansGenerates concise (3-4 page), focused medical treatment plans in LaTeX/PDF format across all clinical specialties — general medical treatment, rehabilitation therapy, mental health care, chronic disease management, perioperative care, and pain management — using SMART goal frameworks, evidence-based interventions with minimal citations, HIPAA compliance, and professional formatting. Use when drafting a brief, actionable patient treatment or care plan with measurable SMART goals and structured follow-up for any specialty. Part of the AlterLab Academic Skills suite.2 plugins in one repository ship this exact skill · first indexed Nov 9, 2026
Other plugins' skills for the same job