Every number below is worked out on your phone from raw heart rate, beat-to-beat (R-R) intervals and motion. The app's code is the source of truth; this page follows formula version ALGO 9. Gallen is independent: where a formula is shaped to match a device maker's app, it is fitted to published descriptions and one person's data, not copied.
1. Before you read
- z is a robust z-score against your own last 30 days: z = (x − median) ÷ spread, where spread = 1.4826 × the median absolute deviation, never below a floor per metric.
- Scores need 4 nights of history before they appear. Until then the app shows "calibrating".
- The night of a day is the longest sleep between 18:00 the evening before and 18:00 that ends on that day. Strain, steps and stress count over the cycle, from waking up to the next main sleep.
2. Sleep
With the strap, asleep or not comes from the strap's own state flag. Without one, from wrist-angle stillness (after van Hees 2015). Asleep runs merge across gaps of 20 minutes or less, and periods under 30 minutes are dropped. Gallen then checks each minute itself:
act = seconds in the minute with dynamic acceleration > 0.05 g
steps = on-chip step counter increments in the minute
rise = HR − 20th percentile of HR over the previous 30 min
awake inside the night if steps > 0 or act ≥ 15 s
or (act ≥ 8 s and rise ≥ 8 bpm)
a single quiet minute between two awake minutes is awake tooAsleep is the minutes asleep and not awake. In bed runs from onset to wake-up, and efficiency = asleep ÷ in bed. In the last 90 minutes, a heart-rate plateau ends the night: the 5-minute median at least 6 bpm over the night's sleeping floor for at least 12 minutes. A doze under 45 minutes followed by at least 30 steps is not counted as the start of the night.
Sleep stages (an estimate)
deep the top 55 + 0.088 × asleep minutes (at most 40 %),
ranked by a deep score (low HR, low HR spread, high HRV,
little movement, earlier in the night)
REM the top 22 % of asleep minutes among the rest, not in the
first 60 min, ranked by a REM score
light the rest; deep or REM runs under 3 min become lightThe amounts were fitted to 309 nights of 3 hours or more: mean error 14.7 minutes for deep and 15 for REM. The ranking decides when the stages happen, not how much of each there is. No wrist device measures stages exactly; four-stage agreement with a sleep lab is roughly 60–80 % for consumer wearables.
3. Sleep need and score
need = 440 min + 4.2 min × yesterday's strain
+ mean shortfall of the previous 3 nights (at most 125 min)
− naps in yesterday's cycle
ratio = min(100, 100 × asleep ÷ need)
sleep score = −42.9 + 0.80 × ratio + 0.43 × efficiency
+ 0.34 × consistency, clamped to 0–100
(no consistency yet: −30.3 + 0.81 × ratio + 0.53 × efficiency)
consistency = 100 × max(0, 1 − mean over the previous 4 nights
of (|Δ bedtime| + |Δ wake time|) ÷ 2 ÷ 300 min)Fitted over 314 nights of one person's data from the strap maker's app. The sleep score followed that app's sleep performance with a mean error of 3.7 points over 310 nights; on Gallen's own 12 nights the mean error was 6.1. Consistency is a light version of the Sleep Regularity Index (Phillips 2017).
4. Recovery
zHRV = z(ln RMSSD) spread floor 0.12 clamped to ±3
zRHR = −z(resting HR) spread floor 2 bpm clamped to ±3
sleep = clamp((sleep score − 76.7) ÷ 23.3, −2.5, 2)
Z = (0.40 × zHRV + 0.04 × zRHR + 0.56 × sleep) ÷ sum of weights present
− 0.5 × min(zResp − 1.5, 3) if zResp > 1.5 and zHRV < 0
recovery = 100 ÷ (1 + e^−(0.57 + 1.48 × Z))HRV is RMSSD per 5-minute window across the night, with windows that are mostly deep sleep counting double. Resting heart rate is the lowest 30-minute rolling mean of minute heart rate in the main sleep. Breathing rate comes from the rhythm of the beats. Skin temperature is shown but does not change the score. Colours: 67 and above green, 34 to 66 yellow, under 34 red.
| Fitted on the strap maker's own inputs, 304 days | Mean error | Correlation |
|---|---|---|
| Before ALGO 9 | 11.7 | 0.85 |
| ALGO 9 | 5.9 | 0.92 |
| On Gallen's own inputs, 8 nights | 8.5 |
5. Strain (0 to 21)
zone starts 56 / 69 / 82 / 95 % of max HR
load / minute zone 1: 0.43 zone 2: 0.75 zone 3: 1.23 zone 4: 1.85
45–56 % of max: a ramp from 0 up to 0.116
below 45 %: 0
strength +0.46 per minute of logged Strength or HIIT work
L sum over the cycle's waking minutes (+ strength minutes)
strain 5.06 × ln(1 + L ÷ 7.02), at most 21Max heart rate comes from your profile, or else 208 − 0.7 × age (Tanaka 2001). The zone weights were fitted on 334 workouts (mean error 0.8 strain) and the full-day form on 10 days with complete heart-rate data (mean error 0.75). Strain is Gallen's own 0 to 21 scale, not any device maker's.
6. Steps
steps = 0.5 × the strap counter's increments over the cycleIncrements between consecutive seconds count as steps; a wrap at 65,536 is unwrapped, and a reboot or a gap of more than 120 seconds is skipped. The 0.5 scale is empirical: on four days the reference app's steps were 0.46 to 0.55 of Gallen's raw count. It matches that reference; it does not claim to know what the sensor counts.
7. Healthspan trend
Not a biological age. Seven habits are each scored 0 to 100 over the last 30 days:
| Habit | Scored against |
|---|---|
| Sleep time | 100 at 7 to 9 h, 0 at 5 h and at 11 h |
| Sleep regularity | The consistency score above |
| Resting heart rate | 100 at 55 bpm, 0 at 85 bpm |
| HRV | 30-day median ln RMSSD against your own earlier 90 days |
| Steps | 100 at 9,000 a day, over days with 10 h of data |
| Active minutes | Zones 1–2 count once, zones 3–4 twice, against 150 min a week |
| Strength days | Against 2 a week |
score = mean of the habits that can be judged
(at least 4 habits, after 14 days)
trend = score − the previous 30 days' score, on habits both can score
+3 or more: improving −3 or less: slipping8. What it is fitted to
The shapes come from published research (see Sources). Several constants are fitted to one person's data: the developer's own export from the strap maker's app, December 2025 to October 2026 (321 days, 323 sleeps, 334 workouts), joined with 15 days of Gallen's own samples. Each refit is checked leave-one-day-out, so it is not tuned to the days it is judged on. The fitting scripts are not published.
9. Limits
- The scores have not been validated clinically, or on anyone other than the developer.
- Sleep stages are an estimate. Night-to-night variation in deep and REM sleep is not predicted.
- Gallen's own inputs differ from the reference app's (HRV about 3 to 10 % lower, resting heart rate 2 to 4 bpm lower), and its baseline is short, so recovery on Gallen's own data (mean error 8.5) is less accurate than the fit (5.9).
- Lifting barely raises heart rate, so strength work only counts when you log it.
- The smart alarm uses a heart-rate rule, not sleep stages, and is not validated against a reference.
10. Not a medical device
Not medical advice
Gallen is not a medical device. It does not diagnose, treat or prevent anything, and its numbers are estimates for personal interest. Do not use them for any medical decision; if something worries you, talk to a doctor.
11. Sources
- Tanaka H et al. Age-predicted maximal heart rate revisited. JACC 2001.
- van Hees VT et al. Sleep duration from a wrist-worn accelerometer. PLoS One 2015.
- Webster JB et al. An activity-based sleep monitor system. Sleep 1982.
- Walch O et al. Sleep stage prediction from a consumer wearable. Sleep 2019.
- Phillips AJK et al. Irregular sleep/wake patterns. Sci Rep 2017.
- Task Force of the ESC and NASPE. Heart rate variability standards. Circulation 1996.
- Malik M et al. HRV and prognosis after myocardial infarction. Am J Cardiol 1989.
- Plews DJ et al. Heart rate variability in elite triathletes. Eur J Appl Physiol 2012.
- Herzig D et al. Reproducibility of HRV by sleep stage. Front Physiol 2018.
- Natarajan A et al. Respiratory rate from wearable devices. NPJ Digit Med 2021.
- Miller DJ et al. Respiratory rate changes and COVID-19 risk. PLoS One 2020.
- The full list, with every constant, is in the app's published formulas document.