-
Notifications
You must be signed in to change notification settings - Fork 0
Calibration
Cortex detects cognitive overwhelm by comparing real-time signals against your personal baselines. Heart rate, HRV, blink rate, and posture vary widely between individuals. Without calibration, Cortex uses population-level defaults that may trigger false positives for some people and miss real overwhelm for others.
Calibration is optional but recommended. Without it, the system still works — it just uses generic thresholds.
Sit relaxed in your normal work position for 2 minutes:
cortex-calibrate --duration 120- Look at the screen naturally
- Avoid talking or large movements
- Don't think about work — let your physiology settle to baseline
cortex-calibrate --simulateGenerates synthetic calibration data using population averages with realistic variance. Useful for development without a webcam attached.
cortex-calibrate [OPTIONS]
--simulate Use simulated data instead of webcam
--duration SECONDS Calibration duration (default: 120)
--output PATH Output path (default: storage/baselines/<timestamp>.json)
| Metric | Description | Typical Range |
|---|---|---|
resting_hr |
Resting heart rate (BPM) | 55–85 BPM |
resting_hrv |
RMSSD at rest (ms) | 20–80 ms |
baseline_blink_rate |
Normal blink rate (blinks/min) | 12–20/min |
baseline_mouse_velocity |
Typical mouse speed (px/s) | 200–600 px/s |
shoulder_neutral_y |
Neutral shoulder Y-coordinate (normalized) | Varies |
Calibration saves a UserBaselines JSON file to storage/baselines/:
{
"resting_hr": 72.0,
"resting_hrv": 50.0,
"baseline_blink_rate": 17.0,
"baseline_mouse_velocity": 500.0,
"shoulder_neutral_y": 0.5,
"calibrated_at": "2025-01-15T10:00:00"
}| Signal | Trigger |
|---|---|
| Pulse elevation | Current HR > resting_hr + 15 BPM
|
| HRV drop | Current RMSSD < resting_hrv × 0.60
|
| Blink suppression | Blink rate < baseline_blink_rate × 0.50
|
| Mouse thrashing | Velocity variance > baseline_mouse_velocity × 3
|
| Posture collapse | Shoulder drop > 15% + forward lean > 20° |
- First use or new device
- New desk, chair, or monitor setup
- Consistently too many false alarms or too few detections
- After a long break (>2 weeks)
The script:
- Collects samples at ~2 Hz for the full duration
- Computes
statistics.mean()for each metric - Computes
statistics.stdev()for variance tracking - Discards outliers (>3 stdev from mean)
- Saves a validated
UserBaselinesPydantic model
The seed config script creates a default baseline from population averages if you skip calibration:
python -m cortex.scripts.seed_config --root .
# Creates storage/baselines/default.json