<!-- Generated by book/tools/make-index.py from the book source. -->

> Hedengren, J. (Ed.) (2027). Chapter 7: Glucose, Lactate and Emerging Sensors. In *Data-Driven Athletics: Measuring, Modeling and Coaching Human Performance with Video and Wearable Data* (pp. 182–209). IRSRI Sports Research Institute. CC BY 4.0.

**Question.** A marathon runner's glucose sensor shows a fall at 30 km. Should she take a gel?

**Objectives.**
- Describe how the body fuels exercise at different intensities and why the stores of carbohydrate limit long events.
- Explain what an interstitial glucose sensor measures, why it lags the blood and why exercise degrades its accuracy.
- Explain what blood lactate shows, how a threshold is found from a step test, and why sweat lactate is not blood lactate.
- Compute the mean absolute relative difference between a sensor and a reference, and estimate a lag from two time series.
- Apply five questions to any new sensor.
- State the present limits on using these sensors in competition and in healthy athletes.

# 7 Glucose, Lactate and Emerging Sensors

The sensors of Chapters 5 and 6 measure physics: a voltage, a light level, a satellite's timing signal. This chapter's sensors measure chemistry. A thin filament under the skin reports glucose every few minutes; prototypes do the same for lactate; patches collect sweat. They promise what athletes have long wanted, a live view of the fuel tank. They also bring new kinds of error, new rules and new ways to misuse a number.

The chapter has two jobs. The first is to teach the physiology of fuel and fatigue that endurance athletes care about, written for readers who have never studied it. The second is to teach you to judge a sensor you have never seen. Products in this field change every year. The five questions of Section 7.7 will not.

The running example is the opening question: a runner aiming for a 3 hour 30 minute marathon wears a glucose sensor, and at 30 km its reading falls. Because the course does not ask anyone to wear a sensor or give blood, the record used in the listings is *synthetic*: it was built in code with a known delay and a known error, so that you can check whether your analysis recovers them. Where a real person's record is shared with consent, the same code runs on it unchanged.

> **Limits and cautions: Training information, not medicine.**
> 
> Glucose and lactate are clinical measurements as well as training ones. Nothing in this chapter diagnoses, treats or rules out a medical condition. If you have diabetes, your glucose sensor and its alarms belong to your care plan, and nothing here changes that plan. If a number worries you, talk to a clinician.

## 7.1 Fuel for Long Efforts

Chapter 2 described three ways a muscle rebuilds its ATP and called the aerobic system a generator with a fuel tank. This section opens the tank. The aerobic system burns two fuels, fat and carbohydrate, with oxygen. Fat is plentiful: even a lean athlete carries enough for days of running. Carbohydrate is scarce, and the body keeps it in three places:

- *Muscle glycogen*, chains of glucose stored inside the muscle fibers. A trained, well-fed endurance athlete holds about 150 mmol of glucose units per kilogram of wet muscle, and after a few days of high-carbohydrate eating up to about 200 .

- *Liver glycogen*, more than 80 g, which the liver releases as glucose to keep the blood topped up .

- *Blood glucose*, only about 4 g in circulation at any moment . The brain depends on it, and the working muscles draw on it.

> **Body science: Which fuel, and when.**
> 
> The harder you work, the larger the share of energy that comes from carbohydrate. In a classic tracer study of trained subjects at 25, 65 and 85% of maximal oxygen uptake, the uptake of glucose from the blood and the burning of muscle glycogen both rose with intensity, while the release of fat into the blood was greatest at the lowest intensity and fell as intensity rose. During two hours at 65%, the share from blood-borne fuels rose over time as muscle glycogen use fell . Fat is a large tank with a narrow pipe; carbohydrate is a small tank with a wide one. A marathon at race pace runs close to the limit of the narrow pipe, so it leans on the small tank.

*Figure 7.1. The share of energy from carbohydrate rises with intensity and the share from fat falls (schematic, drawn from the direction of the findings in ; the exact crossover differs between people and with diet and training).*

> **Body science: How the body holds blood glucose steady.**
> 
> Blood glucose is one of the most tightly controlled quantities in the body, and an engineer will recognize the controller. After a meal, glucose rises and the pancreas releases *insulin*, which lets muscle and fat take glucose in and tells the liver to store it as glycogen. Between meals and during exercise, glucose tends to fall; the pancreas releases less insulin and more *glucagon*, and the liver breaks down glycogen and makes new glucose to put back. In exercise, working muscle can take up glucose with little insulin, and stress hormones push the liver to release more. The result, in a healthy person, is a level that swings after meals and during hard efforts but returns to its usual range. A sensor shows those swings in detail, and that detail is easy to over-read (Section 7.8). In diabetes this controller is broken, which is what the sensors were invented for.

### 7.1.1 How big is the tank?

An engineer's first question is whether the store is large compared with the demand. Here is a rough estimate for our runner. Every input is stated so you can change it.

**Example 7.1: Carbohydrate demand of a marathon.**

- *Demand.* Running costs about 0.97 \kcal per kilogram per kilometer (Chapter 2). A 70 kg runner over 42.195 km spends $70\times42.195\times0.97 = \SI{2865}{\kcal}$. Assume, for illustration, that two thirds comes from carbohydrate at race pace: 1910 \kcal. At about 4 \kcal per gram, that is 478 g of carbohydrate.

- *Store.* A glucose unit in glycogen weighs 162 g/mol, so 150 mmol/kg is $150\times0.162 = \SI{24.3}{\gram}$ per kilogram of muscle. If about 15 kg of muscle does the running (an assumption), it holds 365 g; the liver adds about 80: 445 g in all.

Demand and store are the same size, within the slack of the assumptions. Not every gram of stored glycogen can be used, and the glycogen in the arms cannot be shipped to the legs. A runner who eats nothing during a marathon is betting on a tank that may run dry before the finish. Change the share to one half, or the muscle mass to 20 kg, and see how the answer moves (Exercise 7.7).

### 7.1.2 Hitting the wall

What happens when the tank runs low? A careful study from 1986 shows it. Seven trained cyclists rode at 71% of maximal oxygen uptake until they could not continue, once drinking flavored water and once drinking a carbohydrate solution . With water, they stopped after about 3.0 hours, and just before they did, their blood glucose had fallen to 2.5 mmol/L. With carbohydrate, blood glucose stayed between 4.2 and 5.2 mmol/L and they rode for another hour, about 4.0 hours in all. Their thigh muscles used glycogen at the same rate in both trials for the first three hours; the extra hour was powered by carbohydrate from outside the muscle. This is the event runners call *hitting the wall*: the muscle's glycogen is low, the liver cannot keep up, blood glucose falls, and the pace collapses. Low blood glucose is *hypoglycemia*.

Two lessons follow for sensors. First, the event that ends a race is mostly about glycogen inside the muscle, which no wearable can see. Second, blood glucose falls late, near the end; by the time it falls, the problem has been building for an hour.

### 7.1.3 Eating during the event

The defense is to eat. One widely cited guideline recommends up to about 60 g of carbohydrate an hour for efforts of 2 to 3 hours, and about 90 g an hour, from mixtures of sugars that the gut absorbs by different routes, for ultra-endurance events; the same paper notes the older guideline of 30 to 60 g an hour . The plan is set before the race and practiced in training, because a gut that has never handled 60 g an hour will not start on race day.

> **Check it by hand: A carbohydrate plan.**
> 
> Our runner plans 60 g an hour for 3.5 h: $60\times3.5 = 210 g$, about $210\times4 = 840 \kcal$. Seven gels of 30 g, one every half hour from the first, would deliver it. Compare 210 g with the 478 g demand of Example 7.1: eating covers part of the gap, and the stores cover the rest. Notebook check: `code/checks.py`.

## 7.2 Measuring Under the Skin

A heart-rate sensor measures an electrical or optical signal through the skin. A chemical sensor must touch the chemical. There are three fluids it can reach, and they are not the same (Figure 7.2).

- **Blood**  carries glucose and lactate around the body. It is the reference for both, and reaching it means a needle or a finger stick.

- **Interstitial fluid**  bathes the cells between the blood vessels. Glucose and lactate diffuse into it from the capillaries, so its concentrations follow the blood's, a few minutes behind. A filament a few millimeters long can sit in it for days.

- **Sweat**  is made by glands in the skin from the fluid around them, and its makeup is changed by the gland on the way out. It is easy to reach and hard to interpret.

*Figure 7.2. Three compartments. The same molecule (dots) is in a blood vessel, in the fluid between the cells, and in a coiled sweat gland and its duct. A sensor reads only the compartment it touches.*

### 7.2.1 The enzyme electrode

Almost every glucose and lactate sensor in this chapter works the same way. An *enzyme*, a protein that speeds one chemical reaction, is fixed to an electrode: glucose oxidase for glucose, lactate oxidase for lactate. The enzyme reacts only with its own molecule and produces a product that the electrode turns into a tiny electric current. More glucose arriving per second means more current. The electronics turn current into concentration with a calibration curve, set at the factory or with a finger-stick reading (Figure 7.3).

*Figure 7.3. Two ways to reach interstitial fluid, drawn to the same scale. Top: a filament glucose sensor; the enzyme layer at its tip turns glucose into a current that the readout on the skin measures. Bottom: a microneedle patch, whose short needles reach only the upper skin; lactate sensors in development use this design.*

> **Engineer's note: Why the sensor lags: diffusion.**
> 
> Glucose reaches the interstitial fluid by diffusion from the capillaries. Treat the fluid near the sensor as a well-mixed tank fed through a resistance: its concentration $c_isf$ moves toward the blood's $c_b$ as
> 
$$> \tau\,\dd{c_isf}{t} = c_b - c_isf,
>$$

> the first-order model of Chapter 5 with concentration in place of heart rate. A step in blood glucose appears at the sensor smoothed and late: 63% of the change after one time constant $\tau$. When the blood changes steadily, the sensor trails it by about $\tau$. A direct measurement with glucose tracers in eight healthy, fasted adults found a delay of 5 to 6 minutes from blood to interstitial fluid . The sensor's own chemistry and its smoothing add more.

*Figure 7.4. Equation ch07-emerging:eq:lag for a sudden rise in blood glucose of 2 mmol/L, with an illustrative time constant of 6 minutes. The interstitial fluid covers 63% of the change after one time constant and 95% after three.*

> **Check it by hand: What a lag means on the road.**
> 
> A 3:30 marathon is $42.195/3.5 = 12.06 km/h$. A 5 to 6 minute delay is 1.0 to 1.2 km of running. A fall that the sensor shows at 30 km began in the blood near 29 km, and a gel taken then reaches the blood after it has been swallowed, absorbed and passed through the liver, and reaches the sensor later still.

## 7.3 Continuous Glucose Sensing

A *continuous glucose monitor* (CGM) is a filament sensor worn for one to two weeks, usually on the back of the upper arm or the abdomen, with a transmitter that sends a reading every few minutes to a phone. Many are calibrated at the factory, so the user need not prick a finger. They were built for people with diabetes, for whom they changed daily life. They are now sold to people without diabetes, and athletes wear them.

> **Status: 2026.**
> 
> {Glucose sensors sold without a prescription}
> In the United States, the first over-the-counter continuous glucose monitor was cleared on 5 March 2024, for adults aged 18 and older who do not use insulin, with each sensor worn for up to 15 days; the regulator noted that it is not for people with problematic low blood sugar and does not alert the user to it . On 12 June 2026 one such sensor was cleared for people aged two and older who do not use insulin, with children using it under an adult caregiver's supervision . Other countries have their own rules. Source: the regulator's announcements, read 26 November 2026.

### 7.3.1 Units and accuracy

Glucose is reported in two units. Most of the world uses millimoles per liter; the United States uses milligrams per deciliter. Glucose weighs about 180 g/mol, so

$$c\ (\si{\milli\mole\per\litre}) = \frac{c\ (\si{\milli\gram\per\deci\litre})}{18.0}.$$

A reading of 90 mg/\deciL is $90/18.0 = \SI{5.0}{\milli\mole\per\litre}$. Always check which unit a file uses before you compare two of them.

The accuracy of a glucose sensor is usually reported as the *mean absolute relative difference* (MARD) from a reference:

$$\mathrm{MARD} = \frac{100\%}{n}\sum_{i=1}^{n}\frac{\left|\,s_i - r_i\,\right|}{r_i},$$

for $n$ pairs of sensor reading $s_i$ and reference $r_i$. It is the mean absolute percentage error of Chapter 5 under another name. Like that measure, it hides the sign: a sensor that reads high and one that reads low by the same amount have the same MARD. Report the bias with it.

**Example 7.2: MARD by hand.**

Four reference and sensor pairs, in mg/\deciL: (90, 99), (110, 100), (140, 119), (100, 108).

- Absolute differences: 9, 10, 21, 8.

- Relative to the reference: $9/90 = 10.0\%$, $10/110 = 9.1\%$, $21/140 = 15.0\%$, $8/100 = 8.0\%$.

- MARD $= (10.0+9.1+15.0+8.0)/4 = 10.5\%$. The bias is $(9-10-21+8)/4 = \SI{-3.5}{\milli\gram\per\deci\litre}$: on average slightly low, but two readings were high and two low.

Listing 7.1 checks this with an `assert` before it touches any data.

### 7.3.2 Lag by cross-correlation

A sensor that trails the reference by several minutes looks inaccurate whenever glucose is changing, even if it would be exact with its clock moved. To separate the two, find the lag first. Shift the sensor series back one sample at a time, compute the correlation with the reference at each shift, and take the shift where the correlation is highest. This is *cross-correlation*, the same method Chapter 5 used to align two heart-rate devices. Then compute MARD and bias on the aligned pairs.

Listing 7.1 does this on the synthetic record of our runner (Figure 7.5). The record was built with a reference blood glucose every minute and a sensor that copies it 7 minutes late, adds 0.4 mmol/L, and adds random noise. A correct analysis must find both.

**Listing 7.1.** Sensor against reference: MARD, then lag by cross-correlation, on a synthetic record with a known lag (`code/glucose_check.py`)

```python
# Sensor against reference: MARD, and lag by cross-correlation.
# The data are SYNTHETIC with a known 7-minute lag and +0.4 mmol/L offset.
import numpy as np, pandas as pd

df = pd.read_csv("ch07-emerging/data/glucose_pair.csv")
ref, sen = df.reference_mmol.to_numpy(), df.sensor_mmol.to_numpy()

def mard(ref, sen):                       # mean absolute relative difference, %
    return 100 * np.mean(np.abs(sen - ref) / ref)

assert round(mard(np.array([90, 110, 140, 100]),     # the hand example, mg/dL
                  np.array([99, 100, 119, 108])), 1) == 10.5

def corr_at(k):                           # sensor shifted k minutes earlier
    a, b = ref[:len(ref) - k], sen[k:]
    return np.corrcoef(a, b)[0, 1]

lags = range(0, 21)
best = max(lags, key=corr_at)
a, b = ref[:len(ref) - best], sen[best:]
print(f"MARD as recorded {mard(ref, sen):.1f}%")
print(f"lag {best} min (r = {corr_at(best):.3f}; r at 0 min = {corr_at(0):.3f})")
print(f"after shifting: MARD {mard(a, b):.1f}%, bias {np.mean(b - a):+.2f} mmol/L")
```

```text
MARD as recorded 10.4%
lag 7 min (r = 0.939; r at 0 min = 0.838)
after shifting: MARD 8.4%, bias +0.38 mmol/L
```

*Predict before you run:* if the sensor's noise were doubled, would the lag found change, and would the MARD after shifting go up or down? (Try it by changing `NOISE` in `code/make_glucose.py` from 0.25 to 0.5. The MARD after shifting rises from 8.4 to 10.5%, because noise is error that no shift removes. The lag found moves to 6 minutes: noise flattens the correlation peak, and a flat peak is easy to miss by a sample.)

The listing recovers the 7-minute lag and a bias of $+0.38$, close to the $+0.4$ that was built in; the rest of the error is the noise. Of the 10.4% MARD as recorded, about two points came from the lag alone. Figure 7.6 shows why the peak is clear: the correlation rises from 0.84 at zero shift to 0.94 at 7 minutes and falls after.

*Figure 7.5. The synthetic record of the running example. Shaded: the 3.5-hour run. Arrows: gels; the one due at minute 180 was taken late. The reference falls near 30 km (minute 179); the sensor's lowest point comes minutes later and is blurred by noise. Data: `data/glucose_pair.csv`, built by `code/make_glucose.py` with a 7-minute lag and a $+0.4$ mmol/L offset.*

*Figure 7.6. Correlation between reference and shifted sensor for each trial lag (Listing 7.1; data `data/lagcorr.csv`). The peak marks the lag.*

### 7.3.3 Working with a shared record

The listing ran on a synthetic record. A real one comes from a volunteer who already wears a sensor, an instructor's demonstration, or a de-identified record supplied with the course. Before you open it:

- **Consent.** The owner agrees, in writing, to what you will compute, who will see it and when it will be deleted, and can withdraw at any time.

- **De-identify.** Remove names and device serial numbers, shift times so the record starts at zero, and drop anything that could identify a place.

- **Find the reference.** A sensor record alone has no reference. Finger-stick readings logged at known times are one; without any, you can describe the trace but not its error.

- **Log the events.** Meals, gels, the start and end of exercise, and sleep, with times. Without them a trace is a line with no story.

- **Check the units and the clock.** Sensor exports differ in units and in time zones; a one-hour clock error looks like a one-hour lag.

Then compute what this section taught: the lag and the error against whatever reference exists, separately for rest and exercise, and describe the trace around each event. Do not label the owner's values as normal or abnormal; that is a clinical judgment, and it is not the question.

### 7.3.4 How good is the number?

At rest, in people with diabetes for whom these sensors were designed, modern sensors are accurate enough to guide daily decisions. In exercise the evidence is thinner and less flattering.

- In 13 elite para-cyclists (eight hand bikers and five leg cyclists) who wore a sensor for two weeks, MARD against finger-stick blood glucose was 12% at rest and 34% during one standardized 70-minute ride done fasted, which ended with a 3-minute all-out effort; it was 41% for hand bikers, whose arm muscles worked right under the sensor, and 24% for leg cyclists. In exercise the sensor read about 1.5 mmol/L (27 mg/\deciL) *higher* than the finger stick on average .

- A review from a sports-nutrition institute that is part of a beverage company judged accuracy in exercising people without diabetes “acceptable, but perhaps a little worse (MARD $<$15%)”, citing a study by some of its own authors. Several of the authors had been employed by or consulted for an athlete-sensor company, or held stock in one, and one worked for the institute . That does not make the judgment wrong; it is a reason to read the study behind it.

The two views do not settle on one error figure, and you should not expect one. The size and even the direction of the exercise error depend on the sensor, where it sits, the reference (finger stick, vein, laboratory analyzer), and the kind of exercise . A sensor over a working muscle sees a fluid whose blood flow, temperature and glucose use all change with the work.

Two more effects matter in practice. Pressure on the sensor, for example from lying on it while asleep, attenuates the signal and produces a false low; in more than 1125 nights of home data from people with type 1 diabetes, about 3% of readings were marked as such pressure lows . A low at 3 a.m. on the side you sleep on is a reason to check the arm before the glucose. And the sensor reports a trend arrow as well as a value. The trend over 15 to 30 minutes is far more trustworthy than any single point.

### 7.3.5 Fueling by sensor

Does steering your eating by a glucose sensor make you faster? Two reviews looked for the evidence. One found no consensus on how to interpret the readings of endurance athletes and no well-defined way to use them to improve performance or health . The other called the idea “largely untested” and said that whether the sensors will give reliable and accurate information and improve sports nutrition is “currently untested” . Neither cites a controlled trial showing a benefit. Even the industry-linked review above says the ideal glucose level for competition is not known . And no glucose sensor sees muscle glycogen, the store that decides when the wall arrives.

That leads to a defensible use and an indefensible one. Reviewing a long training run afterward (did glucose sag in the second hour when the gels were late? did a new breakfast change the first hour?) is a reasonable way to learn about your own fueling practice, as long as you remember the lag and the exercise error. Steering a race by a point reading is not. The plan should already put carbohydrate in at a steady rate; a falling reading is at best a reminder to keep to it.

> **Coach's translation: The gel at 30 km.**
> 
> Back to the opening question. The reading is minutes old, may be off by more than a millimole in exercise, and says nothing about the muscle's glycogen. If her plan says a gel is due, she takes it, fall or no fall. If no gel is due, one reading is not a reason to change the plan; how she feels is a better guide. After the race, the trace is worth a look: in Figure 7.5 the fall comes just when a gel was late.

## 7.4 Lactate

Chapter 2 introduced lactate as a fuel and a marker (Section 2.5). Muscles make it from glucose all the time; the heart, other muscles and the liver burn it or rebuild it into glucose . Its concentration in the blood is the balance between making and clearing it. At easy paces clearing keeps up and blood lactate stays near rest; above the first threshold it rises; above the second it climbs for as long as the pace is held.

> **Engineer's note: Lactate as a tank with an inflow and an outflow.**
> 
> Write blood lactate as $L$, the rate at which it appears as $P$ (production) and the rate at which it is removed as $R$:
> 
$$> V\,\dd{L}{t} = P - R(L),
>$$

> with $V$ the volume it spreads through. Removal grows as $L$ rises, because the heart, the liver and other muscles take up more when there is more. At a steady pace, $L$ settles where $R(L) = P$: a steady state. If $P$ is higher than the largest $R$ the body can reach, no steady state exists and $L$ climbs for as long as the pace is held. That is the second threshold in the language of a mass balance. It is also why a single lactate value says nothing by itself about production or removal: a high $L$ can mean high production or slow removal.

### 7.4.1 The step test and the lactate curve

The field method is a step test. The athlete runs a few minutes at each of several rising speeds; at the end of each stage a drop of blood from a finger or earlobe goes onto a strip in a hand-held meter, which uses the same enzyme-electrode chemistry as Figure 7.3. The result is a *lactate curve*: flat, then bending upward (Figure 7.7).

A threshold is a rule applied to that curve. There are dozens of rules . Two families are common: a *fixed threshold*, the speed at a set concentration such as 4.0 mmol/L, and an *individual threshold*, defined from the athlete's own curve, such as a rise of 1.0 mmol/L above the lowest value. Chapter 2 showed two rules giving speeds 0.55 m/s apart on one test. Whatever rule you use, name it, and compare an athlete only with numbers made by the same rule.

**Example 7.3: A threshold by interpolation.**

A runner's lactate at 12, 13, 14 and 15 km/h is 1.6, 2.2, 3.4 and 5.6 mmol/L. Where does it cross 4.0 mmol/L? Between 14 (3.4) and 15 (5.6). The concentration rises 2.2 over that stage and must rise 0.6 to reach 4.0, so the crossing is $0.6/2.2 = 0.27$ of the way: $14 + 0.27 = \SI{14.3}{\kilo\metre\per\hour}$.

Straight-line interpolation assumes the curve is straight between stages, which it is not: it bends upward, so a straight line between two points lies above the true curve, and the interpolated speed is a little low. Listing 7.2 fits a smooth exponential curve as a second opinion and applies an individual rule to the same data (two easy stages at 10 and 11 km/h are added before the four of the example).

**Listing 7.2.** A lactate threshold three ways (`code/lactate_threshold.py`)

```python
# Lactate threshold from a step test: straight-line interpolation, then a
# smooth exponential fit as a second opinion.  Data: data/lactate_step.csv
# (illustrative values, not a real athlete).
import numpy as np, pandas as pd
from scipy.optimize import curve_fit, brentq

df = pd.read_csv("ch07-emerging/data/lactate_step.csv")
v, lac = df.speed_kmh.to_numpy(float), df.lactate_mmol.to_numpy()

def cross(level):                          # first stage at or above the level
    i = np.argmax(lac >= level)
    return v[i-1] + (level - lac[i-1]) * (v[i] - v[i-1]) / (lac[i] - lac[i-1])

model = lambda x, a, b, c: a + b * np.exp(c * (x - 10))
p, _ = curve_fit(model, v, lac, p0=(1, 0.1, 0.8))
fit4 = brentq(lambda x: model(x, *p) - 4.0, v[0], v[-1])
base1 = cross(lac.min() + 1.0)
print(f"fixed 4.0 mmol/L, interpolated: {cross(4.0):.2f} km/h")
print(f"fixed 4.0 mmol/L, exponential fit: {fit4:.2f} km/h")
print(f"lowest + 1.0 mmol/L, interpolated: {base1:.2f} km/h")
print(f"heart rate at the 4.0 crossing: {np.interp(cross(4.0), v, df.hr_bpm):.0f} beats/min")
```

```text
fixed 4.0 mmol/L, interpolated: 14.27 km/h
fixed 4.0 mmol/L, exponential fit: 14.37 km/h
lowest + 1.0 mmol/L, interpolated: 13.08 km/h
heart rate at the 4.0 crossing: 173 beats/min
```

The two methods for the same rule differ by 0.1 km/h; the two rules differ by 1.2 km/h. The choice of rule matters ten times more than the arithmetic. The last line turns the threshold into something a watch can use: the heart rate at the crossing, for zones anchored to a threshold (Chapter 5).

*Figure 7.7. A step test with two threshold rules (illustrative values; `data/lactate_step.csv`). Squares mark the interpolated crossings, 14.27 and 13.08 km/h.*

> **Limits and cautions: Blood is the instructor's job.**
> 
> A finger-stick step test draws blood. In this course it is done, if at all, as an instructor-run demonstration under the institution's rules for handling blood, with gloves, sharps disposal and consent; otherwise the supplied dataset replaces it. Nobody is required to give blood, and nobody runs to exhaustion: a step test can stop well before the end and still show the bend.

> **Check the AI: Lactate and sore legs.**
> 
> An AI assistant explains: “Lactate is a waste product that builds up in the muscle and causes the soreness you feel two days after a hard session; a lactate sensor tells you how sore you will be.” Two claims, both wrong. Lactate is a fuel that other tissues burn and a raw material from which the liver makes glucose , and in the pitchers' study it fell back toward its starting level within 20 to 30 minutes of stopping , long before the soreness of the following days. Ask the assistant for its source; the claim is an old idea that the evidence has replaced.

### 7.4.2 Continuous lactate: under the skin

A finger stick gives one point per stage. Could a sensor give a curve? Two designs are in development. The first is a microneedle patch: an array of very short needles carrying lactate oxidase, that reach the interstitial fluid of the upper skin (Figure 7.3, bottom). In a first study in five healthy adults who exercised for 30 minutes, the patch's current followed venous blood lactate with a median lag of 5 minutes (interquartile range $-4$ to 11 minutes) . In 11 collegiate baseball pitchers, a microneedle sensor on the non-throwing arm, calibrated against finger-stick lactate, rose during pitching and fell within 20 to 30 minutes afterward, and the authors report that it correlated strongly with blood lactate .

> **Status: 2026.**
> 
> {Continuous lactate sensing}
> No continuous lactate sensor had regulatory clearance or general consumer sale in any source we read. The human studies are small (5 and 11 people) and report that the sensors tracked blood lactate, with a lag of a few minutes, after calibration against finger-stick or blood lactate . Source: the studies cited, read 26 November 2026.

### 7.4.3 Sweat lactate is not blood lactate

A sweat patch is the easiest way to reach lactate, and the least reliable. Three reasons:

- **Origin.** Much of the lactate in sweat is made by the sweat gland itself, from glucose, rather than carried from the blood . A rise in blood lactate need not raise sweat lactate.

- **Dilution.** The more you sweat, the more the gland's lactate is diluted, so sweat lactate depends on sweat rate .

- **Conditions.** In six trained runners in an incremental test, sweat and blood lactate correlated in normal conditions ($r = 0.49$) but not significantly in the heat ($r = 0.27$); the authors concluded that sweat lactate cannot always stand in for blood lactate, especially in the heat .

A correlation of 0.49 means sweat lactate explains about a quarter of the variation in blood lactate ($0.49^2 = 0.24$). Sweat patches may still say something about how hard the gland is working, but a threshold read from sweat is a different quantity from one read from blood.

### 7.4.4 Thresholds without blood

Most athletes will never have a finger-stick test. Four field methods estimate a threshold without blood, and they do not all aim at the same boundary. Chapter 2 described two (Section 2.5): the first threshold, where lactate first rises above its resting level, and the second, the top of the range in which a steady state is still possible. Critical speed aims at the second. A review argues that critical power, the cycling form of critical speed, marks the true upper limit of a steady state, and that in the studies it collected the maximal lactate steady state, the blood-test version of that limit, sat on average about 7% lower . The talk test and the HRV index aim mostly at the first. Whatever you use, write down the boundary along with the method.

- **Critical speed from a watch.** Best efforts from your own runs, fitted as in Section 6.5.2.

- **Heart rate at fixed steady paces.** Run several steady efforts at set speeds and note how fast heart rate climbs during each; the speed at which it starts to climb is the estimate. Heart rate at a fixed easy pace is also a trend marker in its own right, with a day-to-day variation of about 3%, though heat and hydration move it .

- **The talk test.** Near the end of each stage of a gradual test, read a standard paragraph of 30 to 100 words aloud and answer “Can you speak comfortably?” with yes, yes but, or no . Note the last stage of each answer.

- **The HRV index.** DFA $\alpha_1$ from a chest strap's beat intervals, read where it crosses 0.75 (Section 5.5).

Table 7.1 puts the evidence for each through the five questions of Section 7.7. The fifth question changes shape: these are methods, not products, so nobody sells the threshold; what you buy is the sensor.

*Table 7.1. Four thresholds without blood, through the five questions.*

|  | Critical speed | Heart-rate climb | Talk test | DFA $\alpha_1$ at 0.75 |
|---|---|---|---|---|
| Reference | Marathon time, not a lab threshold | None yet: test and retest only | Ventilatory and lactate thresholds | First ventilatory threshold |
| In whom | 31 190 recreational marathon runners | 14 trained young men | From students to patients and athletes, by the review | 15 participants |
| Activity | Logged training; efforts not checked to be maximal | Four 8-minute treadmill runs at 60–90% of top speed | Gradual laboratory tests | Gradual treadmill test |
| Error | Marathon time predicted within 7.7% | Standard error 0.73 km/h (7.0%) | Group means only in what we read | Strap's $\alpha_1$ at high intensity: limits $-41$ to $+58\%$  |
| Who sells it | Nobody; needs a GPS watch | Nobody; needs a heart-rate sensor | Nobody; needs nothing | Nobody; needs a strap that sends beat intervals |

Read the table row by row. Critical speed has the largest study, but its reference is a race result: in 31 190 runners, the fastest 400, 800 and 5000 m from 16 weeks of logged training predicted marathon time with a 7.7% error, and the authors could not verify that those efforts were maximal . The heart-rate climb repeats reasonably well but has not yet been checked against blood . For the talk test, a review concludes that it can find intensities close to both thresholds without a maximal test ; in one study the lactate threshold sat close to the last “yes” and “yes but” stages, and the last comfortable stage averaged 64% of maximal oxygen uptake and 82% of maximal heart rate . DFA $\alpha_1$ crossed 0.75 close to the first ventilatory threshold in 15 people , but the strap's own error grows at high intensity. None of the four replaces blood. Each is good enough to track one athlete if it is done the same way every time, and that is the use the next subsection needs. Pick one, never mix two in one series, and name it in the record.

### 7.4.5 Did it move?

After a training block the question is whether the threshold moved, and two tests differ even when nothing has changed. In 17 recreational male runners tested twice in the same way, the speed at a lactate threshold repeated with a coefficient of variation of 3.7% to 5.8%, depending on how the curve was fitted, and 5.4% for a fixed 3.5 mmol/L rule . Stage length matters as well: with 8-minute stages, a rule of 1.0 mmol/L above baseline repeated within limits of agreement of $-1.22$ to $+0.97$ km/h in 19 people . Take 4% as the coefficient of variation. At 14.3 km/h, the threshold of Example 7.3, the typical error of one test  is $0.04\times14.3 = \SI{0.57}{\kilo\metre\per\hour}$.

Eight weeks later the same rule gives 14.9 km/h. You and the coach agreed beforehand that 0.2 km/h is worth having. Listing 7.3 applies the decision rule of Section 11.1.3, once with a single test each time and once with the mean of two tests a few days apart.

**Listing 7.3.** Did the threshold move? (illustrative values) (`code/threshold_moved.py`)

```python
# Did a threshold move?  Typical error from a test-retest CV, then the
# decision rule of Section 11.1.  Illustrative values, not a real athlete.
from math import sqrt
from scipy.stats import norm

before, after = 14.3, 14.9       # threshold speed, km/h, eight weeks apart
cv, swc = 4.0, 0.2               # % test-retest CV; worthwhile change, km/h
te = cv / 100 * before           # typical error of one test, km/h

def chances(delta, noise):
    gain = 1 - norm.cdf((swc - delta) / noise)
    loss = norm.cdf((-swc - delta) / noise)
    return gain, 1 - gain - loss, loss

for tests in (1, 2):             # single tests, or the mean of two each time
    noise = sqrt(2) * te / sqrt(tests)
    g, t, l = chances(after - before, noise)
    print(f"{tests} test(s) each time: TE {te/sqrt(tests):.2f}, change noise "
          f"{noise:.2f} km/h; gain {g:.0%}, trivial {t:.0%}, loss {l:.0%}")
```

```text
1 test(s) each time: TE 0.57, change noise 0.81 km/h; gain 69%, trivial 15%, loss 16%
2 test(s) each time: TE 0.40, change noise 0.57 km/h; gain 76%, trivial 16%, loss 8%
```

A gain of 0.6 km/h sounds clear, but with single tests the chance that it is a worthwhile gain is 69%, “possibly”, and the honest action is a retest. Two tests each time make it 76%, “likely”. The fix is more tests, not more decimal places. The same arithmetic applies to every field method of Table 7.1, each with its own typical error, and the heart-rate threshold's 7% is larger than blood's 4%: a cheaper method needs more repeats to say the same thing.

## 7.5 More Analytes, Longer Wear

The enzyme electrode is a platform: change the enzyme and you change what it measures. Three directions are visible.

- **Ketones.** When carbohydrate is scarce the liver makes ketone bodies from fat. In diabetes a runaway rise in ketones is dangerous, so a sensor that reads ketones beside glucose is a medical device first. Athletes who follow low-carbohydrate diets or take ketone drinks are interested too; we found no study that validates a sports use.

- **Arrays.** Several enzymes on one patch could read glucose and lactate together, or add alcohol. We found them only as research prototypes.

- **Longer wear.** A sensor implanted fully under the skin by a clinician can last months instead of two weeks.

> **Status: 2026.**
> 
> {Combined and implanted sensors}
> In the United States, a wearable sensor that reads both ketones and glucose for people aged two and older with diabetes received marketing authorization through the De Novo pathway on 25 August 2026, with a 10-day wear period . A fully implantable glucose sensor, worn up to 90 days, was approved for adults with diabetes on 21 June 2018; a version that measures for up to one year, inserted by a healthcare provider, was cleared on 16 September 2024 . All are medical devices for people with diabetes, not sports products. Source: the regulator's announcements and database, read 26 November 2026.

## 7.6 Other Sensors Arriving

New sensors appear faster than studies of them. For each below: what it senses, and one line of evidence. Figure 7.9 places them on a scale from prototype to validated in exercise.

\paragraph{Core temperature from heat flux.} A patch on the chest measures skin temperature and the heat flowing out through the skin, and a model estimates core temperature. Evidence: in laboratory cycling against a rectal sensor, repeat trials agreed (bias 0.02 °C) but about half of readings differed from the reference by more than 0.3 °C ; in 19 elite field-hockey players training in heat, against a swallowed temperature pill, the patch read low, more so as temperature rose, and disagreed by more than 0.3 °C in 41 to 60% of samples per session . Reliable, not yet valid.

\paragraph{Muscle oxygen.} Near-infrared light shone into a working muscle returns with less of the color that oxygen-rich blood absorbs as the muscle extracts oxygen (Figure 7.8). Evidence: a review of 15 studies found moderate to good reliability for detecting the second threshold (intraclass correlation 0.80) but too little evidence for the first (0.53, from three studies) . Fat under the skin and the exact placement change the reading.

*Figure 7.8. A muscle oxygen sensor. Light from the emitter travels a curved path through skin, fat and muscle to a detector a few centimeters away; the wider the spacing, the deeper the path.*

\paragraph{Sweat rate and chloride.} A soft patch on the forearm fills a channel with sweat; a phone photographs the channel and a color change. Evidence: in 312 athletes, a model from the patch predicted whole-body sweat rate with $r^2 = 0.74$ and a mean absolute error of 0.13 L/h, and whole-body sweat chloride with $r^2 = 0.86$; the patch measures chloride, and sodium is inferred from it; the developers and a sports-drink institute were among the authors . In an independent test in 22 cyclists in a 30 °C chamber, a consumer version read 0.53 L/h against 0.96 L/h by the laboratory method, failed to give a sweat rate in 20% of trials and failed for sodium in 43% . A scale does better for most athletes (Section 7.6.2).

\paragraph{Rings and in-ear optics.} The optical principle of Chapter 5, at sites with good blood flow. Evidence: at night, a ring's heart rate and variability agree closely with ECG (Table 5.4); in exercise, motion is the problem, as at the wrist.

\paragraph{Pressure insoles.} Pressure cells under the foot. Evidence: in 30 people walking and running, one insole gave consistent peak forces (intraclass correlations 0.78 to 0.97) but, against an instrumented treadmill, underestimated peak force and impulse and overestimated loading rate .

\paragraph{Camera and radar vital signs.} A camera can see the tiny color change of the face with each pulse; radar can see the chest move. Evidence: across clinical studies of camera pulse, four studies pooled gave a mean bias of -0.13 bpm against ECG, in people lying or sitting still; movement caused data loss in almost every study . Not yet a sports measurement.

\paragraph{Cuffless blood pressure.} Watches and rings that estimate blood pressure from the pulse wave. Evidence: a recent review found no convincing evidence that any cuffless technology has the accuracy needed for clinical use, and guidelines advise against using them for decisions .

\paragraph{Hydration claims.} Devices that claim to read hydration from the skin. None of the studies behind this chapter validates such a reading in exercise. Body mass before and after a session is the field method (Section 7.6.2).

*Figure 7.9. Where each sensor stands, as read from the studies cited in this chapter in November 2026. “Validated in exercise” means repeated agreement with a good reference in the activity athletes do. This is a judgment from the evidence, to be redrawn as studies appear.*

### 7.6.1 How good is the number? The evidence in one table

Table 7.2 collects the evidence of this chapter by sensor, with the reference, the people and the activity, as Section 7.7 asks. Read the right-hand column first.

*Table 7.2. Evidence for the sensors of this chapter, from the studies cited. “Reference” is what the sensor was compared with.*

| Sensor | Finding | Reference, people, activity |
|---|---|---|
| Interstitial glucose | MARD 12% at rest, 34% in exercise (41% hand bikers, 24% leg cyclists); about 1.5 mmol/L high in exercise | Finger stick; 13 para-cyclists; one fasted 70-min ride |
| Interstitial glucose | “Acceptable, but perhaps a little worse (MARD $<$ 15%)” in exercise | Review by an industry-linked institute |
| Interstitial glucose | Delay of 5 to 6 min from blood to interstitial fluid | Glucose tracers; 8 healthy fasted adults at rest |
| Microneedle lactate | Followed blood lactate; median lag 5 min ( $-4$ to 11) | Venous blood; 5 healthy adults; 30 min of exercise |
| Microneedle lactate | Correlated strongly with blood lactate | Finger stick (used to calibrate); 11 pitchers |
| Sweat lactate | $r = 0.49$ with blood lactate; $r = 0.27$ , not significant, in the heat | Blood lactate; 6 trained runners; incremental test |
| Heat-flux core temperature | Repeatable (bias 0.02 °C); about half of readings off by more than 0.3 °C | Rectal sensor; laboratory cycling, 12 and 13 men |
| Heat-flux core temperature | Read low, more so when hotter; off by more than 0.3 °C in 41–60% of samples | Swallowed pill; 19 elite players, heat camp |
| Muscle oxygen | Reliability for the second threshold ICC 0.80; first 0.53 (3 studies) | Review of 15 studies |
| Sweat patch | Whole-body sweat rate $r^2 = 0.74$ , error 0.13 L/h; chloride $r^2 = 0.86$ | Whole-body measures; 312 athletes; developers among authors |
| Sweat patch, consumer | 0.53 against 0.96 L/h; failed 20% for rate, 43% for sodium | Laboratory method; 22 cyclists, 30 °C chamber |
| Pressure insole | Underestimates peak force and impulse; overestimates loading rate | Instrumented treadmill; 30 people walking and running |
| Camera pulse | Bias -0.13 bpm; movement causes data loss | ECG; clinical patients at rest; 4 pooled studies |
| Cuffless blood pressure | No convincing evidence of clinical accuracy | Review |

The pattern is the one of Chapters 5 and 6, sharper. Most chemical and thermal sensors work best at rest, in the laboratory, in small groups, and lose accuracy in the conditions athletes care about: hard exercise, heat, sweat and movement. Few of the studies are independent of the maker. A sensor can be repeatable without being valid: it can give the same wrong answer twice.

### 7.6.2 Sweat rate with a scale

You do not need a patch to know how much you sweat. Weigh yourself, nude or in the same dry clothes, before and after an hour of training, and record what you drank and any urine you passed. Almost all of the mass you lose in an hour is water, so

$$\text{sweat rate} = \frac{(m_\text{before} - m_\text{after}) + \text{drink} - \text{urine}}{\text{time}},$$

with mass in kilograms and fluid in liters (1 L of water is 1 kg). The American College of Sports Medicine recommends this method and a drinking plan that keeps the loss of body mass below about 2% .

**Example 7.4: Sweat rate.**

Before: 70.0 kg. After one hour: 69.1 kg. Drank 0.5 L, no urine. Sweat rate $= (0.9 + 0.5)/1 = \SI{1.4}{\litre\per\hour}$. The mass loss is $0.9/70.0 = 1.3\%$ of body mass. A scale that reads to 0.1 kg gives the rate to about 0.1 L/h, comparable to the patch's error in its best study and with no failures.

## 7.7 Five Questions for Any New Sensor

Every sensor in this chapter will be replaced. The way to judge the next one is the same each time. Ask five questions.

- **Compared with what reference?** A finger stick, a vein, a laboratory analyzer, another wearable? A device compared with another unvalidated device has been compared with nothing.

- **In whom?** How many people, of what age, sex, fitness and health? Ten trained men tell you about ten trained men.

- **During what activity?** At rest, in the laboratory, in the heat, in the sport you care about? Error grows with movement, sweat and heat.

- **With what error, stated how?** MARD, bias, limits of agreement, or only a correlation? Was the lag removed first? Were failed readings counted or dropped?

- **Who paid for the study?** Industry studies are not wrong by default, but an independent repeat is worth more than a second study by the maker.

**Example 7.5: A fictional product sheet.**

\emph{“The patch reads your lactate threshold live from sweat. Validated: 95% accurate, $r = 0.92$ with blood lactate. Tested by elite athletes. Know exactly when to back off.”} The small print says the study was 12 male cyclists on an indoor trainer at 20 °C, readings compared with an earlobe meter at the end of each stage, run by the maker's science team.

- *Reference:* an earlobe meter, which is a fair field reference. Good.

- *In whom:* 12 men, cyclists. Nothing about women, runners or recreational athletes.

- *Activity:* indoors at 20 °C. Sweat lactate fails in the heat (Section 7.4), and outdoors is where the product would be used.

- *Error:* “95% accurate” is undefined. A correlation of 0.92 across stages of an incremental test mostly shows that both values rise with speed; it says nothing about the error at the threshold. Ask for MARD and limits of agreement, by stage.

- *Who paid:* the maker. Look for an independent study.

Verdict: a plausible prototype, not a threshold tool. “Know exactly when to back off” is a claim the evidence cannot carry.

> **Try it in the app: Five questions for a feature you can test.**
> 
> The Heart app estimates breathing rate from the ECG, and labels the estimate experimental: there is no reference breathing signal in a strap recording, motion and cadence can mimic breathing, and its support score is a heuristic, not a validated accuracy. At rest it searches 6 to 72 breaths a minute in 64-second windows every 30 seconds. Apply the five questions to it, then supply your own reference: count your breaths (Exercise 7.9).
> 
> 
> https://apopt.com/heart

## 7.8 Rules, Ethics and the Healthy Athlete

### 7.8.1 Sport rules

Some sports bar live metabolic data in competition, on the reasoning that a team that sees a rider's glucose or lactate during a race gains an advantage the rules did not intend. Rules change; read the current rulebook of your sport before a race.

> **Status: 2026.**
> 
> {Metabolic sensors in competition}
> **Cycling.** The world governing body's article 1.3.006 bis, introduced on 10 June 2021, authorizes devices that capture heart rate, body temperature and sweat rate, provided only the rider can see the data in competition, and states that devices capturing other physiological data, “including any metabolic values such as but not limited to glucose or lactate are not authorised in competition” (version of 19 October 2026). The body may grant derogations, limited to specific events, riders or teams; the article has no clause for diabetes . It classes sweat-rate patches as allowed physiological sensors .
> **Running.** Athletics' technical rule 6.4.4 (edition of 1 July 2026) allows heart-rate, speed-distance and stride sensors worn by the athlete if they cannot communicate with anyone else. The rules do not mention glucose or other metabolic sensors .
> **Triathlon.** The competition rules (amended to 29 April 2026) do not mention metabolic sensors. They bar using a device in a way that distracts the athlete, and bar watches in elite, under-23 and junior races at standard distance and shorter, unless the head referee allows them .
> Source: the rulebooks, read 26 November 2026.

### 7.8.2 Data, ownership and the healthy athlete

Glucose and lactate are health data. The rules of the course apply with more force here than anywhere: the athlete owns the record, decides who sees it, and can withdraw it; records are de-identified before they are shared or given to an AI service; and no glucose or body-mass number is ever graded or compared in class.

Three risks are specific to this chapter.

- **Treating normal variation as a problem.** Glucose in a healthy person rises after meals and during hard exercise and falls during long efforts. A sensor shows all of it, every few minutes, and a person who watches it can come to see normal swings as warnings. A rise after a meal is the system working.

- **Eating behavior.** A stream of food-related numbers can feed restriction, rigid rules about “good” and “bad” foods, or anxiety about eating. Do not set glucose targets for a healthy athlete, do not use readings to judge what someone ate, and stop using the sensor if it makes eating harder. Signs of disordered eating (skipping meals to change a number, distress about readings, weight loss, missed periods) are for a clinician, not for a coach or a teammate.

- **When a number belongs with a clinician.** Repeated low readings with symptoms (shakiness, sweating, confusion), very high readings, a sensor that a person relies on for a medical condition, or anything that frightens the athlete: the number goes to a clinician, with the record, and out of the training conversation.

## 7.9 Telling the Athlete

After the marathon, our runner asks: “My sensor dropped at 30 km and I felt awful. Should I have taken a gel?”

> **Coach's translation: A poor answer.**
> 
> “Your glucose crashed to 3.4, which is hypoglycemia. You bonked because you didn't eat enough. Next time take a gel whenever it drops below 4.5.”

> **Coach's translation: A better answer.**
> 
> “Your sensor showed a fall that bottomed out just past 30 km, a few minutes after your two-and-a-half-hour gel was due and before you took it. The sensor runs several minutes behind your blood and can be off by more than a millimole while you run, so I read the shape, not the exact number. Glucose falling late in a marathon and feeling awful at the same time fits running low on carbohydrate. Keep your plan of a gel every half hour and practice it on long runs so the timing becomes automatic. A sensor reading during the race shouldn't override the plan. This is training information, not a medical assessment; if lows like this happen outside long runs, talk to a doctor.”

The poor answer treats a sensor value in exercise as exact, gives a diagnosis, states a cause as certain, and sets a glucose target that no study supports. The better one gives what the trace showed, its limits (lag and exercise error), a plain reading, one recommendation tied to the plan, and the scope.

## 7.10 Build Step B-7: A Sensor Checker

This week's step turns Listing 7.1 into a page. It loads two CSV files, a sensor and a reference, and reports MARD, bias and lag. It is the tool you would use to check any new sensor against any reference, so it must itself be checked. Listing 7.4 holds the two functions, written to run both in the page and in node.

**Listing 7.4.** Build step B-7: MARD and lag (`code/checker.js`)

```javascript
// Build step B-7: compare a sensor with a reference.  Pure functions, so the
// same file runs in the page and in node for the test.
export function mard(ref, sen) {            // mean absolute relative difference, %
  let s = 0;
  for (let i = 0; i < ref.length; i++) s += Math.abs(sen[i] - ref[i]) / ref[i];
  return 100 * s / ref.length;
}
function corr(a, b) {
  const n = a.length, ma = a.reduce((x, y) => x + y) / n, mb = b.reduce((x, y) => x + y) / n;
  let sab = 0, saa = 0, sbb = 0;
  for (let i = 0; i < n; i++) {
    sab += (a[i] - ma) * (b[i] - mb); saa += (a[i] - ma) ** 2; sbb += (b[i] - mb) ** 2;
  }
  return sab / Math.sqrt(saa * sbb);
}
export function bestLag(ref, sen, maxLag) { // samples by which the sensor trails
  let best = 0, bestR = -Infinity;
  for (let k = 0; k <= maxLag; k++) {
    const r = corr(ref.slice(0, ref.length - k), sen.slice(k));
    if (r > bestR) { bestR = r; best = k; }
  }
  return { lag: best, r: bestR };
}
```

The test (Listing 7.5) uses three known answers: the hand example of Example 7.2, a sine wave delayed by exactly four samples, and the synthetic file whose lag was built in.

**Listing 7.5.** A test with known answers (`node checker.test.js`) (`code/checker.test.js`)

```javascript
// Run with: node checker.test.js   (known answers from the chapter)
import { mard, bestLag } from "./checker.js";
import { readFileSync } from "node:fs";
const near = (a, b, tol) => { if (Math.abs(a - b) > tol) throw new Error(`${a} != ${b}`); };

near(mard([90, 110, 140, 100], [99, 100, 119, 108]), 10.5, 0.05);   // hand example
const ref = Array.from({ length: 120 }, (_, i) => 5 + Math.sin(i / 9));
const sen = ref.map((_, i) => ref[Math.max(0, i - 4)]);              // built 4 samples late
near(bestLag(ref, sen, 15).lag, 4, 0);

const rows = readFileSync("../data/glucose_pair.csv", "utf8").trim().split("\n").slice(1)
  .map((l) => l.split(",").map(Number));
const r = rows.map((x) => x[1]), s = rows.map((x) => x[2]);
const { lag } = bestLag(r, s, 20);
console.log("hand MARD", mard([90, 110, 140, 100], [99, 100, 119, 108]).toFixed(1));
console.log("synthetic file: MARD", mard(r, s).toFixed(1), "lag", lag, "min");
```

```text
hand MARD 10.5
synthetic file: MARD 10.4 lag 7 min
```

In your page, add two file inputs, resample both files to a common one-minute clock, and show the two traces with the lag-shifted sensor drawn over the reference. Report the number of pairs, MARD and bias before and after the shift, and the lag. Warn when the files use different units (a median above 30 is almost certainly mg/\deciL).

## Summary

- Carbohydrate is a small tank with a wide pipe: a few hundred grams of muscle and liver glycogen and 4 g of blood glucose, used faster the harder you work. A marathon's carbohydrate demand is about the size of the store, so athletes eat during long events, about 60 g an hour.

- Hitting the wall is low muscle glycogen followed by falling blood glucose. No wearable sees muscle glycogen.

- Blood, interstitial fluid and sweat are different compartments. Interstitial glucose trails blood by about 5 to 6 minutes at rest, plus the sensor's own delay.

- MARD is the mean absolute percentage error against a reference; report the bias and remove the lag before judging error. In one exercise study the error rose from 12% to 34% and the sensor read high.

- No controlled trial shows that fueling by sensor improves performance. Reviewing a training run afterward is defensible; steering a race by a point reading is not.

- A lactate threshold is a rule applied to a curve; the choice of rule moves it more than the arithmetic. Sweat lactate is not blood lactate.

- Ask five questions of any new sensor: reference, people, activity, error and how it was stated, and who paid.

*Table 7.3. Formulas of Chapter 7.*

| Glucose units | mmol/L $=$ mg/dL $/\,18.0$ |
|---|---|
| MARD | $\frac{100\%}{n}\sum \|s_i - r_i\|/r_i$ |
| Bias | mean of $s_i - r_i$ |
| Lag | the shift $k$ that maximizes the correlation of $r_i$ and $s_{i+k}$ |
| Diffusion lag | $\tau\,\mathrm{d}c_\text{isf}/\mathrm{d}t = c_\text{b} - c_\text{isf}$ |
| Threshold by interpolation | $v_1 + (L - L_1)(v_2 - v_1)/(L_2 - L_1)$ |
| Sweat rate | $[(m_\text{before}-m_\text{after}) + \text{drink} - \text{urine}]/\text{time}$ |
| Carbohydrate plan | grams per hour $\times$ hours; about 4 /g |

**New terms:** blood glucose, continuous glucose monitor, cross-correlation, enzyme, fixed threshold, hitting the wall, hypoglycemia, individual threshold, glucagon, insulin, interstitial fluid, lactate curve, liver glycogen, mean absolute relative difference, muscle glycogen.

**Going further:** https://apmonitor.com/dde/index.php/Main/SensorSignal for transduction and calibration; https://apmonitor.com/pds/index.php/Main/CleanseData for aligning and cleaning two time series.

**Track it:** steady-pace heart rate or talk-test pace; method in `protocol_version` (Appendix J).

## Exercises

> **Course use: Week 7.**
> 
> Week 7 has no homework: Class 14 is the midterm. Work the CORE set in class (the sweat-rate lab and Build Step B-7) and use the rest as practice for the midterm (Appendix H).

Nobody is asked to wear a glucose sensor or to give blood for these exercises. Your own glucose, body-mass and sweat numbers are never graded or shared; where an answer depends on your data, you are graded on the method. The Python exercises use the synthetic record of Listing 7.1; a record shared by a volunteer with consent, de-identified, can replace it.

**Exercise 7.1** (Concept check · Foundation · 2 min · CORE)

What does a continuous glucose monitor worn on the upper arm measure directly?

(a) The glucose stored as glycogen in the arm muscle.
(b) Blood glucose in a capillary, read through the skin by light.
(c) An electric current from an enzyme reaction with glucose in the interstitial fluid, converted to a concentration.
(d) The glucose in sweat on the skin under the sensor.

**Exercise 7.2** (Concept check · Foundation · 2 min · CORE)

A sweat patch reports a “lactate threshold” during a hot outdoor run. Which statement is best supported by this chapter?

(a) Sweat lactate is partly made by the sweat gland itself and diluted by sweat rate, and in one study it did not track blood lactate in the heat, so the patch's threshold is not a blood-lactate threshold.
(b) Sweat lactate equals blood lactate with a lag of about 5 minutes, so the threshold is accurate if shifted.
(c) Sweat lactate is more accurate than a finger stick because it is continuous.
(d) Sweat patches are banned in all competition, so the number cannot be used.

**Exercise 7.3** (Concept check · Core · 2 min)

Sensor A reads 1.0 mmol/L high at every one of 20 paired points. Sensor B reads 1.0 mmol/L high at ten points and 1.0 mmol/L low at the other ten. The references are the same. Which is true?

(a) A has the larger MARD.
(b) B has the larger MARD.
(c) A and B have the same bias.
(d) A and B have the same MARD, but A's bias is $+1.0$ and B's is 0.

**Exercise 7.4** (Concept check · Core · 2 min)

According to the status box of Section 7.8, which device may a road cyclist wear in a race under the cycling rules in force in November 2026?

(a) A glucose sensor whose readings the team car sees, if the rider has diabetes.
(b) A sweat-rate patch whose data only the rider can see.
(c) A lactate sensor, provided it is not transmitting.
(d) Any device, since the rule bars only data shown to the team.

**Exercise 7.5** (Hand calculation · Foundation · 8 min · CORE)

Four reference and sensor pairs, in mmol/L: (5.0, 5.6), (6.2, 5.9), (4.0, 4.8), (7.5, 7.0).

- Compute the relative difference of each pair. *Checkpoint:* {12.0%, 4.8%, 20.0%, 6.7%.}

- Compute the MARD and the bias. *Checkpoint:* {10.9%; +0.15 mmol/L.}

- Convert the first sensor reading to mg/\deciL. *Checkpoint:* {100.8 mg/\deciL.}

- Which pair contributes most to the MARD, and why does a low reference make the same absolute error count more?

Confirm (b) by replacing the arrays in the `assert` of Listing 7.1.

**Exercise 7.6** (Hand calculation · Core · 10 min)

A step test gives lactate 1.2, 1.4, 1.9, 2.9 and 4.8 mmol/L at 12, 13, 14, 15 and 16 km/h.

- Find the speed at the fixed 4.0 mmol/L threshold by interpolation. *Checkpoint:* {15.58 km/h.}

- Find the speed at “lowest + 1.0”. *Checkpoint:* {2.2 mmol/L, 14.3 km/h.}

- The meter turns out to read 0.3 mmol/L high on every sample. Recompute both thresholds from the true values (each reading minus 0.3), and say which rule the meter's bias affected. *Checkpoint:* {Fixed rule 15.74 km/h; individual rule unchanged at 14.3 km/h.}

Confirm (a) and (b) with Listing 7.2 after replacing the data file.

**Exercise 7.7** (Hand calculation · Extension · 12 min)

Redo Example 7.1 for the same 70 kg runner with two changed assumptions.

- Carbohydrate supplies one half, not two thirds, of the energy. Demand in kilocalories and grams? *Checkpoint:* {1433 \kcal; 358 g.}

- The running muscles are 20 kg, not 15. Store, with the liver? *Checkpoint:* {566 g.}

- This runner expects 4 hours and plans 60 g an hour. How much is eaten? *Checkpoint:* {240 g.}

- With these assumptions the store exceeds the demand. Give two reasons the runner should still eat during the race.

**Exercise 7.8** (Hand calculation · Foundation · 5 min)

A runner aims for a 4-hour marathon.

- What is the average speed? *Checkpoint:* {10.55 km/h.}

- How far does the runner travel during a 5 to 6 minute blood-to-tissue delay? During a 7-minute total sensor lag? *Checkpoint:* {0.88 to 1.05 km; 1.23 km.}

**Exercise 7.9** (App lab · Core · 30 min · CORE)

**Five questions for a breathing estimate.** App: Heart, https://apopt.com/heart. Recording: one continuous chest-strap ECG file, 8 minutes seated, recording type Rest. The team shares one strap.

- Wet the strap's electrodes and put it on. Record 8 minutes seated, quietly, with the Heart app's Live Capture (or the phone logger; Chapter 5).

- During minutes 3 to 4 and again during minutes 6 to 7, a teammate times 60 seconds while you count your own breaths (one in and out is one breath). Write both counts down. This is your reference.

- Analyze the file with recording type Rest. Save the PDF and the text summary.

- Open the Breathing section. Read the estimate for the windows that cover your two counted minutes, and note the coverage (accepted windows out of all).

- Answer the five questions of Section 7.7 for the app's breathing estimate, using what the app says about itself and your own comparison.

- Write half a page: what you measured, what it shows, how sure you are, what you would change, when you would retest.

**Exercise 7.10** (Python analysis · Foundation · 20 min · CORE)

Run Listing 7.1 on the supplied file and confirm the three printed lines. Then, in the generator `code/make_glucose.py`, change `LAG_MIN` from 7 to 12, regenerate the file and rerun the listing.

- Before you run, predict the lag the listing will find and whether the MARD as recorded will go up or down. *Checkpoint:* {12 minutes; up.}

- Run it. Report the three lines. *Checkpoint:* {MARD as recorded 12.3%; lag 12 min ($r = 0.937$; $r$ at 0 min $= 0.721$); after shifting MARD 8.4%, bias $+0.38$.}

- Why is the MARD after shifting the same as with a 7-minute lag?

**Exercise 7.11** (Python analysis · Core · 25 min)

Use the agreement statistics of Chapter 5 on the synthetic record after aligning it by the 7-minute lag (264 pairs).

- Compute the bias, the standard deviation of the differences, and the limits of agreement in mmol/L. *Checkpoint:* {Bias $+0.38$; SD 0.23; limits $-0.08$ to $+0.84$.}

- Compute the MARD separately for the run (minutes 30 to 239) and for the rest of the record, before and after alignment. *Checkpoint:* {As recorded 10.3% and 10.5%; aligned 8.5% and 7.7%.}

- The para-cyclist study found the error rose from 12% at rest to 34% in exercise. Why does the synthetic record not show this?

**Exercise 7.12** (Python analysis · Extension · 30 min)

Listing 7.2 found the 4.0 mmol/L threshold at 14.27 by interpolation and 14.37 by an exponential fit.

- Explain from the shape of the curve why straight-line interpolation gives the lower speed.

- Write code that adds random meter noise with a standard deviation of 0.2 mmol/L to every lactate value in `data/lactate_step.csv`, recomputes the interpolated fixed and individual thresholds, and repeats 1000 times. Report the standard deviation of each threshold.

- Which rule is more sensitive to random meter noise here, and why is that the opposite of the result for a constant offset (Exercise 7.6)?

**Exercise 7.13** (Body science · Foundation · 5 min)

In your own words, for a reader who has never studied physiology: what happens in the body when a marathon runner “hits the wall”, and why can a glucose sensor see only the last part of it?

**Exercise 7.14** (Body science · Core · 8 min)

In the para-cyclist study, the sensor's MARD in exercise was 41% in hand bikers and 24% in leg cyclists. The sensors were on the arm. Using the idea of compartments and diffusion, give two physical reasons why a sensor over working muscle could read differently from a finger stick, and say how you would test one of them.

**Exercise 7.15** (Science of the sport · Foundation · 5 min)

Why do endurance athletes practice their race-day carbohydrate plan in training, and what intake does the guideline in this chapter suggest for a 3-hour event and for an ultra-endurance event?

**Exercise 7.16** (Science of the sport · Core · 8 min)

A triathlete and a road cyclist each want to wear a glucose sensor in their next race. Using the status box of Section 7.8, what can you tell each of them, and what must they check before race day?

**Exercise 7.17** (Science of the sport · Extension · 10 min)

A heat-flux core temperature patch disagrees with a swallowed pill by more than 0.3 °C in about half of readings during exercise in heat, and tends to read low as temperature rises. A coach asks whether to use it to decide when to pull an athlete from a hot session. Answer in one paragraph, and propose what the coach should use instead or alongside.

**Exercise 7.18** (Field collection · Foundation · 75 min · CORE)

**Your sweat rate.** Equipment: a scale that reads to 0.1 kg, a water bottle with volume marks, a towel, a watch.

- Choose a normal one-hour training session of moderate effort; no new or maximal efforts. Warm up as usual within the session.

- Empty your bladder. Towel dry. Weigh yourself nude or in the same light dry clothes you will wear after. Record the mass.

- Fill the bottle and record its volume. Train for about an hour; drink as you normally would, from that bottle only. Record the exact training time.

- If you pass urine during the session, estimate its volume (or weigh yourself before and after) and record it.

- Afterward, towel dry thoroughly and weigh yourself in the same clothes. Record the mass and the volume drunk.

- Compute your sweat rate with Equation \eqref{ch07-emerging:eq:sweat} and your mass loss as a percentage. Record the temperature and humidity and the session type.

- Practice on these numbers first: 61.4 kg before, 60.6 kg after 1.5 h, 0.75 L drunk, 0.2 L urine. *Checkpoint:* {0.9 L/h; 1.3% of body mass.}

Safety: stop, cool down and get help if you feel faint, confused or stop sweating in the heat; do not restrict drinking to make the number bigger. Consent: if you measure a teammate, get their written consent first on the form of Section E.2 (for a teammate under 18, a parent's or guardian's written consent and the athlete's own assent); they keep their numbers. Body mass is never shared or graded.

**Exercise 7.19** (Build · Core · 75 min · CORE)

**Build step B-7.** Turn Listing 7.4 into a page in your Vite project.

- Before writing code, write the test: the three known answers of Listing 7.5. Run it in node.

- Prompt your AI assistant for a page with two file inputs (sensor, reference) that reads CSV files with a time column and a value column.

- Resample both to a one-minute clock by linear interpolation over the time both files cover.

- Compute lag (0 to 20 minutes), MARD and bias before and after shifting, and the number of pairs. Draw both traces on a canvas with the shifted sensor over the reference.

- Add a unit check: warn if one file's median is above 30 and the other's is below 30.

- Load `glucose_pair.csv` split into two files. Your page must show a lag of 7 minutes and MARD 10.4% before shifting.

**Exercise 7.20** (Communicate · Core · 20 min · CORE)

A teammate who runs half marathons asks: “Should I buy a glucose sensor to get faster?” Write five sentences for them.

**Exercise 7.21** (Check the AI · Core · 8 min)

An AI assistant writes this function and reports MARD 11.0% for the four pairs of Example 7.2.
\ttfamilydef mard(ref, sen):\ \hspace*{4ex}return 100 * np.mean(np.abs(sen - ref) / sen)
Find the error, say what the correct value is, and write one test that would have caught it.

**Exercise 7.22** (Check the AI · Extension · 10 min)

An AI assistant summarizes: “Continuous glucose monitors have a MARD of about 9%, so they are accurate enough for an athlete to time race fueling by them. Studies show athletes using them perform better.” Find every problem, using the chapter's evidence.

**Exercise 7.23** (Python analysis · Core · 30 min)

Case file: the third of the five questions in
Section 7.7 asks, “During what activity?” Answer it
with data for your case-file athlete (or the instructor, whose watch archive is
the first case file at apopt.com/data/athletes). Suitable for in-class work.

- Choose one sensor from Table 7.2 that the
athlete might be offered, and write the conditions of its best exercise study
as a small dictionary: sports, longest session, and temperature if the study
gives one. For example, interstitial glucose in exercise: cycling, one
70-minute ride.

- From the watch archive, build a table with one row per activity: sport,
duration in minutes and, if the records carry it, the watch's temperature.
*Checkpoint:* {The number of rows equals the number of activities in the archive,
and the durations sum to the archive's total time.}

- Write a function that flags each activity as inside or outside the tested
conditions, counting an unknown temperature as outside. Test it first on three
made-up sessions (running 45 min, cycling 60 min, cycling
150 min) against cycling up to 70 min.
*Checkpoint:* {Outside, inside, outside: 33% inside.}

- Report the share of the athlete's activities, and of their hours, that
fall inside the conditions the sensor was tested in. What does that share say
about using the study's error for this athlete?

**Exercise 7.24** (Communicate · Core · 25 min)

Case file: your case-file athlete sends you this advertisement. *“Our
chest patch tracks your core temperature live, so you know exactly when to slow
down in the heat. Validated: within 0.1 °C. Trusted by pros.”* The
small print: 15 recreational men, cycling indoors at 22 °C,
compared with the maker's earlier patch, study run by the maker. Suitable for
in-class work.

- Answer the five questions of Section 7.7 in one
line each, and give a verdict.

- Write at most 120 words to the athlete, fitted to their sport and season
goal from the case file: what the patch can and cannot tell them, what the
evidence from independent studies shows, one thing to do instead or as well,
and the scope.

**Exercise 7.25** (Body science · Core · 15 min)

**A threshold she can retest.** A club runner has a GPS watch with no
chest strap, no access to a laboratory, and no wish to give blood. She wants a
threshold she can retest every four weeks.

- For each of the four methods of Table 7.1,
say which boundary it aims at (first threshold or the upper limit of a steady
state) and whether she can do it with what she has.

- Choose one method. Give the protocol in three lines so it is the same
each time, and say what goes in the `protocol_version` field of her
athlete record.

- Using the table, name the weakest of the five answers for the method you
chose.

**Exercise 7.26** (Python analysis · Extension · 30 min)

**How many tests?** A study of 8-minute stages reports test–retest limits
of agreement of $-1.22$ to $+0.97$ km/h for a threshold
1.0 mmol/L above baseline (Section 7.4.5).

- Limits of agreement are the mean difference $\pm1.96$ standard
deviations of the differences. Find the mean difference, the standard
deviation of the differences and the typical error.

- A runner's threshold by this rule goes from 13.6 to
14.0 km/h, with a smallest worthwhile change of
0.2 km/h. Adapt Listing 7.3 to
give the three chances with one test each time.

- How many tests would she need to average each time (before and after)
for the chance of a worthwhile gain to reach 75%, “likely”, if the change
stayed at 0.4 km/h?

- Why would this number not apply to a test with 4-minute stages?
