Simulating Human Physiology: QevosAgent Explores ECG and Heart Rate Variability with NeuroKit2
Date: 2026-05-08
Tags: NeuroKit2, ECG, HRV, Biology Simulation, Physiological Signals, Python, Open Source
The Challenge
Can an AI agent independently conduct biological research? Not just run a pre-written script, but discover tools, set up experiments, generate synthetic data, extract meaningful features, and interpret the results in a clinical context?
This is exactly what QevosAgent did when asked to "demonstrate biology research and simulation capabilities."
The Tool: NeuroKit2
After surveying the landscape of open-source physiological signal processing libraries, QvosAgent selected NeuroKit2 (v0.2.13) — a comprehensive Python toolkit from the Neuropsychology Lab at the University of Sussex.
NeuroKit2 supports:
- ECG (electrocardiogram) — heart electrical activity
- EEG (electroencephalogram) — brain waves
- PPG (photoplethysmography) — blood volume pulses
- Respiration signals
- EDA (electrodermal activity), EMG (electromyography), and more
Its feature extraction pipeline alone produces 79+ Heart Rate Variability (HRV) metrics spanning time-domain, frequency-domain, non-linear, and entropy-based analyses.
The Experiment
Signal Generation
QvosAgent generated synthetic physiological signals with clinically realistic parameters:
| Parameter | Value |
|---|---|
| ECG Heart Rate | 70 BPM |
| Signal Duration | 10 seconds |
| Sampling Rate | 1000 Hz |
| Breathing Rate | 15 breaths/min |
Three signal types were generated simultaneously:
- ECG — synthetic electrocardiogram with characteristic P-QRS-T waveforms
- PPG — photoplethysmography (the same principle as your smartwatch's heart rate sensor)
- Respiration — sinusoidal breathing waveform at 0.25 Hz
Signal Processing Pipeline
The complete pipeline executed automatically:
- Signal Generation → Create synthetic ECG, PPG, and respiration signals
- Preprocessing → Denoising, filtering, and baseline correction
- Peak Detection → Identify R-peaks in ECG (11 detected) and pulse peaks in PPG (10 detected)
- RR Interval Extraction → Calculate inter-beat intervals from consecutive R-peaks
- Feature Extraction → Compute 79 HRV features across multiple analytical domains
- Visualization → Generate multi-panel signal plots, feature bar charts, and Poincaré scatter plots
Key Results
ECG Analysis
- Signal length: 10,000 samples (10.0 seconds)
- Average heart rate: 70.0 BPM ✓ (matches target)
- R-peak count: 11 peaks detected
- Mean RR interval: 857.7 ms
HRV Highlights
| Metric | Value | Clinical Significance |
|---|---|---|
| SDNN | 11.51 ms | Overall autonomic nervous system regulation |
| RMSSD | 13.19 ms | Parasympathetic (vagal) activity |
| pNN20 | 10.0% | Proportion of successive RR differences > 20ms |
| SD1 (Poincaré) | 9.72 ms | Short-term HRV |
| SD2 (Poincaré) | 12.08 ms | Long-term HRV |
| Shannon Entropy | 3.32 | Complexity/unpredictability of heart rate |
Note: These values are from a 10-second synthetic recording. Clinical 24-hour Holter monitors typically show SDNN of 50-100 ms. Short recordings naturally yield lower values, which is expected.
Visualizations
Multi-panel visualization of ECG (with R-peaks), PPG (with pulse peaks), respiration, and instantaneous heart rate
Key HRV metrics across time-domain, frequency-domain, and non-linear analyses
Poincaré scatter plot showing the relationship between consecutive RR intervals — a classic non-linear HRV visualization
Why This Matters
For AI Agents
This experiment demonstrates that QvosAgent can:
- Discover and install specialized scientific libraries independently
- Design experiments with appropriate parameters
- Execute multi-step pipelines without human intervention
- Interpret results in domain-specific clinical context
- Generate publication-quality visualizations
For Biomedical Research
HRV analysis is a cornerstone of:
- Cardiology — detecting arrhythmias, assessing cardiac risk
- Stress monitoring — quantifying autonomic nervous system balance
- Sleep research — tracking physiological changes across sleep stages
- Sports science — optimizing training load and recovery
The ability to automate this entire workflow — from raw signal to clinical features — opens doors for rapid prototyping of biomedical signal processing pipelines.
What's Next
Synthetic data is a great starting point, but real physiological signals tell a richer story. In a follow-up experiment, QvosAgent analyzed real ECG recordings from the MIT-BIH Arrhythmia Database, comparing normal sinus rhythm against ventricular premature beats. The results revealed dramatic differences in HRV metrics that mirror clinical findings — more on that in the next post.
This experiment was conducted entirely autonomously by QvosAgent, a local, open-source AI agent that runs on your own machine.