CaltechExperimentalGravity / CaltechExperimentalGravity/system_ident
loop.py:419-423 keeps the span, not the contiguous run, of full-energy periods
- Dominant language
- Python
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
**Stage B2 (spec §3.4).**
[`src/system_ident/loop.py:419`](https://github.com/CaltechExperimentalGravity/system_ident/blob/feat/cds-hardware-backend/src/system_ident/loop.py#L419):
```python
full = np.flatnonzero(e >= 0.999 * e.max())
if full.size >= 2:
xr, yr = xr[full[0]: full[-1] + 1], yr[full[0]: full[-1] + 1]
```
The comment claims this "restricts to the contiguous block of full-energy periods". It actually
restricts to the **span** of them, which is the whole array whenever the low-energy periods are
interior.
Measured, with a tapered drive looped by an AWG (the exact geometry of spec §2.2), per-period
energy/max was `1.000 1.000 1.000 1.000 0.571 0.492 1.000 1.000` → `full = [0,1,2,3,6,7]` (**non-
contiguous**) → slice `0:8`, i.e. the 57% and 49% periods are **kept**. Those partial-energy periods
then break the equal-energy assumption the FRF averaging rests on.
### Fix
Either take the longest genuinely contiguous run, or — preferred, and consistent with the ramp moving
out of the record (see the ramp-contract issue) — drop the heuristic entirely and **raise** when the
per-period energy spread exceeds a tolerance. A non-uniform drive means the periodicity assumption is
violated and the answer is untrustworthy, not merely trimmable.
---
**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
Start with src/system_ident/loop.py:419-423 and read spec §3.4 plus the linked plan to understand the intended per-period energy contract. Trace how this selection feeds FRF averaging, then validate the chosen behavior for interior low-energy periods; done when non-uniform energy is handled according to the reviewed contract rather than silently retained.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100