# Tutorial Q-20: Find the lag between two signals

Find how many minutes a glucose sensor trails its reference by cross-correlation, then measure its error after aligning the clocks, on a synthetic record with a known answer.

Address: https://apopt.com/data/tutorials/q20-signal-lag/  
License: CC BY 4.0  
Prepared: 2026-12-03

## Description

Files for the tutorial *Find the lag between two signals* (https://apopt.com/course/tutorials/q20-signal-lag/). `raw/` holds the inputs as the device or app wrote them; `clean/` holds the cleaned copies the tutorial writes; `expected/` holds what a correct run prints and saves, so you can check your own run.

## Files

| file | size | rows | description |
|---|---|---|---|
| [expected/printed-output.txt](https://apopt.com/data/tutorials/q20-signal-lag/expected/printed-output.txt) | 314 B |  | Everything the tutorial prints, cell by cell |
| [raw/glucose_pair_synthetic.csv](https://apopt.com/data/tutorials/q20-signal-lag/raw/glucose_pair_synthetic.csv) | 3.6 KB | 271 rows | SYNTHETIC record, one row a minute: a reference blood glucose and a sensor built from it 7 minutes late, 0.4 mmol/L high, with noise (minute, reference_mmol, sensor_mmol) |

Large files are stated with their size. A `preview.md` in this folder shows the first rows of each table.

## Provenance

- Source: Data-Driven Athletics tutorials (IRSRI, 2027)
- Removed: nothing; inputs are synthetic, published course data, or the instructor's own
- Permission basis: Published with the course under CC BY 4.0
- Prepared with: dda/tutorials/build.py

## Used in

- Book: [Chapter 7: Glucose, Lactate and Emerging Sensors](https://apopt.com/book/ch07-emerging/)
- Course: [Week 7 lesson](https://apopt.com/course/week/7/)

## How to cite

Tutorial Q-20: Find the lag between two signals. IRSRI Sports Research Institute, 2026. Data-Driven Athletics data repository. https://apopt.com/data/tutorials/q20-signal-lag/

## Load it

```python
import pandas as pd
df = pd.read_csv("https://apopt.com/data/tutorials/q20-signal-lag/raw/glucose_pair_synthetic.csv")
```
