CaltechExperimentalGravity / CaltechExperimentalGravity/system_ident
H_err and coherence are structurally blind: a 200%-wrong FRF reports coherence 1.00000
- Dominant language
- Python
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
**Stage B3 (spec §3.3).** This is the finding worth losing sleep over.
`var_H` ([`src/system_ident/loop.py:438`](https://github.com/CaltechExperimentalGravity/system_ident/blob/feat/cds-hardware-backend/src/system_ident/loop.py#L438)) is the **period-to-period residual scatter**. A constant
time offset between drive and response is common-mode across every period, so `Y_p - H*X_p == 0` for all
`p` and the scatter is *exactly zero* — regardless of how wrong `H` is.
Measured (Q=20 @ 1 Hz plant, fs 256, nperseg 1024, P=8, settled):
| case | max rel FRF error | median `H_err/\|H\|` | median coherence |
|---|---|---|---|
| correct (X = real readback) | 7.4e-12 | 1.0e-9 | 1.00000 |
| **X = stashed drive, rolled 37 samples** | **2.00e+0** | **1.0e-9** | **1.00000** |
Indistinguishable. And [`src/system_ident/loop.py:460`](https://github.com/CaltechExperimentalGravity/system_ident/blob/feat/cds-hardware-backend/src/system_ident/loop.py#L460)'s `1e-9` floor then hands the poisoned pass
weight ≈4.6e+19 in `_accumulate`, so it dominates the rest of the campaign.
Neither existing guard helps: `_choose_transient` ([`src/system_ident/loop.py:370`](https://github.com/CaltechExperimentalGravity/system_ident/blob/feat/cds-hardware-backend/src/system_ident/loop.py#L370)) also keys on
scatter, and the energy test ([`src/system_ident/loop.py:419`](https://github.com/CaltechExperimentalGravity/system_ident/blob/feat/cds-hardware-backend/src/system_ident/loop.py#L419)) only sums `xr**2`, which a pure time
shift leaves unchanged.
### Fix
Add an **independent** check that does not use period-to-period scatter: compare the measured `Xbar`
phase against the **known injected** multisine phase and require the residual to be at most a small
fraction of a sample of pure delay. Backends expose the injected waveform so `read()` can assert this
before returning.
Where no injected reference is available, the honest move is to stop flooring `H_err` at `1e-9*|H|` and
instead raise when `P_eff < 2`.
---
**Campaign:** CDS hardware backend · branch [`feat/cds-hardware-backend`](https://github.com/CaltechExperimentalGravity/system_ident/tree/feat/cds-hardware-backend)
· [spec](https://github.com/CaltechExperimentalGravity/system_ident/blob/feat/cds-hardware-backend/docs/superpowers/specs/2026-08-03-cds-hardware-backend-design.md) · [plan](https://github.com/CaltechExperimentalGravity/system_ident/blob/feat/cds-hardware-backend/docs/superpowers/plans/2026-08-03-cds-hardware-backend.md) · [handoff](https://github.com/CaltechExperimentalGravity/system_ident/blob/feat/cds-hardware-backend/notes/cds-hardware-bringup-2026-08.md)
*Code is deferred until the plan and issues have been reviewed.*
Contributor guide
No contributing guide indexed for this repository
Research direction
Read the Stage B3 specification and plan first, then inspect src/system_ident/loop.py at _choose_transient, the energy test, var_H, the H_err floor, and _accumulate. Trace the backend read() path and how injected waveforms are exposed. Done means an independent phase check catches the rolled-drive case, while missing references avoid the misleading floor and raise when P_eff < 2.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100