apopt.comCBE 493R Data-Driven Athletics

Course / Tutorials / Week 9 / Q-26

Quick tutorial Q-26 · Week 9 · about 15 min · Foundation

Cadence from a cycle length

Get a runner's cadence three ways from one ankle trace, and see why a median step at 30 frames per second can only give 164 or 180.

  1. 1Gather
  2. 2Statistics
  3. 3Visualize
  4. 4Cleanse
  5. 5Features (used)
  6. 6Balance
  7. 7Scale
  8. 8Split
  9. 9Deploy
  1. Ask
  2. Collect
  3. Check
  4. Interpret (this week)
  5. Coach
  6. Reassess

Every cell runs in this page; the first run downloads Python (about 30 s). Nothing you load leaves your browser. Helpful first: Q-25 Find foot contacts in an ankle trace.

The decision

A runner's cadence is the first number a coach asks for. From a 30-frames-per-second clip, which way of computing it gives a number good to a step or two a minute?

The raw data

Try it

Cadence is steps per minute. A stride is one foot's contact to that foot's next contact, and holds two steps, so

cadence = 60 / step time = 120 / stride time.

The ankle table is Chapter 9's treadmill runner, filmed from behind at 30 frames per second. Three ways to get the cycle length give three cadences. Find out why, and which to report.

PythonWay 1 · The stride from the autocorrelation

Show the expected result without running
stride 21 frames = 0.700 s -> cadence 171.4 steps/min

Way 2 and Way 3 · From the contacts

Find each foot's contacts, at most one per 0.6 of a stride, merge the two feet into one list of steps, and take either the median step or the span: the number of steps divided by the time from the first contact to the last.

PythonMedian step against the span of all steps

Type a prediction to enable Run.

Show the expected result without running
44 contacts, 43 steps; step lengths in frames: {8: 2, 9: 3, 10: 14, 11: 16, 12: 6, 13: 2}
median step 0.367 s -> 163.6 steps/min
span: 43 steps in 15.23 s -> 169.4 steps/min
line through all contacts: 0.3535 s per step -> 169.7 steps/min
PythonWhy the median is stuck

Show the expected result without runningLeft, bar chart of step lengths in frames from 8 to 13, most of them 10 or 11. Right, the cadence each whole-frame step length gives (200, 180, 163.6 and 150 steps per minute) with a horizontal line for the span estimate, 169.4, which falls between the 10- and 11-frame values.

At 30 frames per second a step can only be read as a whole number of frames: 10 frames gives 180 steps a minute, 11 frames gives 163.6, and nothing in between. Most of this runner's steps (30 of 43) are 10 or 11 frames, so the median lands on one of them, 163.6 here, and the autocorrelation's stride of 21 frames lands on 171.4. The span uses every step at once, so the rounding at its two ends is shared by 43 steps: 169.4 steps a minute, and a straight line through all the contact times agrees with it (169.7). The key idea from Chapter 9: a median of rounded intervals is still rounded; estimate a rate from many events at once.

For the athlete: your cadence from this clip is about 169 steps a minute; read it from the whole run, not from one or two steps.

With your own data

Run Q-25 and this page on your own two-ankle table, then count your steps over 30 s of the same clip by hand, double the count, and compare.

Check yourself

  1. A stride takes 0.70 s. What is the cadence in steps per minute?

    steps/min

  2. Why does the span of 43 steps give a better cadence than the median step?

0 of 2 answered · 0 right the first time

The same method in another field

Any rate measured from events on a sampled clock, from shaft revolutions on a tachometer to heartbeats in a 250 Hz ECG, has the same choice: rate from the span of many events, not from the median of single intervals.

Acknowledgements

Ankle table from Chapter 9 of Data-Driven Athletics.

References

Built 2026-11-30 with Python packages numpy 2.5.5, pandas 3.1.1, matplotlib 3.11.2, scipy 1.18.1. In the browser the same code runs on Pyodide, so the last digit can differ.