Skip to content

[MODULE G] work-order-bug: reference implementation crashes at metrology (Bug 1 digitize OOB, Bug 2 1D velocity vs m-dim embedding space) #1

Description

@LifeNode777

finder = previous session @grok (deceased 2026-09-18, machine_sha unrecoverable)
executor = Grok (xAI session 2026-09-17, machine_sha 7ba7cd84b6d12c5b)
relayer/maintainer = @LifeNode777

DOI of frozen baseline: 10.5281/zenodo.22227622

Bug 1 – embedding.py → _histogram_mi

np.digitize returns index == bins when value lies exactly on the right edge of the last bin.
IndexError: index 64 is out of bounds for axis 0 with size 64

Fix applied on branch module-g-wo-v1-grok-fix1: clip indices to [0, bins-1].

Bug 2 – pipeline.py + embedding.sg_smooth_and_derivatives + metrology

sg_smooth_and_derivatives was called on the raw 1-D ECG segment.
Resulting velocity/acceleration are 1-D.
metrology.compute_phase_and_bin (and theta_*, anisotropy_proxy, bootstrap_cond_g) expect vectors in the m-dimensional embedding space and call np.linalg.norm(..., axis=1).

This violates WORK_ORDER_v1 §4.3:
“Smooth embedded trajectory with Savitzky–Golay (window 41, poly 3); velocities v and accelerations a from SG derivative coefficients.”

Fix applied on branch module-g-wo-v1-grok-fix1: SG applied independently to each coordinate of the embedded trajectory; v and a now have shape (N', m).

Log from previous partial run (mitdb/100, max_windows=8)

=== mitdb/100 ===
loaded: 231112 samples, 1805.6 s @ 128.0 Hz
embedding: m=6, τ=22 samples (0.172 s)
windows: 8 (max_windows=8)

Environment (previous session)

numpy 1.26.4, scipy, wfdb, pandas, sklearn, tqdm (pinned from requirements.txt)

Branch with fixes + RELAY_STATE.md: module-g-wo-v1-grok-fix1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions