Detect motion in synthetic Wi-Fi CSI
Generate calibrated synthetic CSI windows, choose an uncertain band, and score a held-out room without making a field claim.

Radio Remi: I want you to predict the result, inspect each intermediate value, and keep the final claim inside the evidence.
Predict the reading, then compare it with the measurement.
Python 3 in your browser (JupyterLite)
Python · no installGenerate calibrated synthetic CSI windows, choose an uncertain band, and score a held-out room without making a field claim.
Open the notebook in your browser and run each Python cell; no install or account is needed.
Three ways to run: use JupyterLite here with no install; run main.py locally from the downloadable lab folder; or open the same notebook in Google Colab.
Steps
Step 1
- Do
- Freeze the CSI simulation contract.
- You will see
- The notebook prints 24 subcarriers, two rooms, four activities, and seed 437.
- Why it matters
- CSI is conditional measurement evidence, not a direct body outline.

Step 1 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 2
- Do
- Generate calibrated CSI windows.
- You will see
- Baseline and motion windows show different mean magnitude changes.
- Why it matters
- Start with a baseline recorded under named conditions.

Step 2 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 3
- Do
- Calculate window features.
- You will see
- A table reports magnitude variance and motion energy for labelled windows.
- Why it matters
- Split later samples into equal time windows, then calculate features such as mean magnitude change, variance, and motion energy.

Step 3 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 4
- Do
- Fit two thresholds on room A.
- You will see
- The training table prints occupied, uncertain, and empty boundaries.
- Why it matters
- A threshold should include an uncertain band so borderline windows can be reviewed instead of forced into occupied or empty.

Step 4 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 5
- Do
- Score the held-out room B.
- You will see
- The confusion counts and precision and recall are printed for unseen windows.
- Why it matters
- A confusion matrix keeps false alarms and missed presence visible.

Step 5 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 6
- Do
- Stress a shifted baseline.
- You will see
- The shifted-room result shows more uncertain or wrong decisions.
- Why it matters
- Calibration removes part of the static room and radio offset; it does not remove furniture changes, people outside the target zone, or radio drift.

Step 6 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab) Step 7
- Do
- Write a bounded result card.
- You will see
- The final card states the metric, abstention rate, and missing RF evidence.
- Why it matters
- A synthetic held-out room checks the calculation, not real radio performance or generalisation.

Step 7 · Python 3 in your browser (JupyterLite); numbered callout added to a real capture. Enlarge screenshot (new tab)
Chapter checks
These questions refer to the chapter’s examples. Use the return links to review their answers.
Why should CSI data be split by room or time before evaluation?
Return to the chapter’s knowledge checkWhat is the safest action for a CSI window inside the uncertain threshold band?
Return to the chapter’s knowledge check
Return to Wi-Fi Channel-State Information for Presence and Motion Sensing · Browse Labs