Skip to content

Opt-in fibre types by motor unit, surface EMG from Muscle fibres, FDI fibre diameter - #45

Merged
RaulSimpetru merged 9 commits into
mainfrom
feat/fdi-fibre-typing
Nov 7, 2026
Merged

RaulSimpetru merged 9 commits into
mainfrom
feat/fdi-fibre-typing

Conversation

@DRohlf

@DRohlf DRohlf commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Fourth of four stacked PRs that replace #41: #40 → #43 → #44 → this. Base is feat/dd-optimiser-tooling; retarget to main once #44 merges.

Closes #30, closes #35, closes #36, closes #37.

Breaking: default surface-EMG amplitudes rise 34 % through the FDI fibre diameter (#30).

Evidence. FDI benchmark (same muscle, NEURON spike trains at 25 % MVC, Delsys 5-pin sensors, corner minus centre, median [IQR]): v0.13.0 28 mV / 455 Hz; defaults on this branch 0.253 mV [0.157–0.263] / 235 Hz (0.189 mV at the old 50 µm); typed Muscle fibres with dispersion and λ 0.63: 0.194 mV [0.129–0.209] / 168 Hz. Botelho et al. 2019: 0.21 mV [~0.19–0.26], ~165 Hz.

Cross-platform fibres. Innervation-centre placement had exact ties in the fast-marching argmax, which platforms broke differently, so fibre-to-unit assignment differed between machines. Ties now go to the lowest index (what argmax returned on exact ties, so layouts here are unchanged); tested with last-bit noise on the field.

Tests. Full suite at a34bb2244: 555 passed, 2 skipped; the later merge of #44 changes comments and the register only.

Upgrade notes. See CHANGELOG.md (Unreleased): Breaking changes and the typed fibre model.

The default, fiber_model="independent", keeps one log-normal diameter
per fibre and the CV line plus 0.2 m/s. The typed model sets fibre types
and diameters per unit (Polgar FDI type means, Martin within-unit
spread) and CVs over unit means or per unit; its arguments raise under
the default. Reference fibres are stored as values, not byte hashes.
SurfaceFiberDispersion(fiber_properties="muscle") takes every fibre's CV
and diameter from Muscle (either fibre model). Per-unit CVs, a source
scaled by d^2 normalised over the muscle, and SurfaceEMG
fiber_diameter__um 50 -> 57.9 um (FDI RMS, Polgar 1973).
Arms use the typed fibre model. All inputs live under spikes/ and
unit_cv/ and resolve relative to the benchmark directory.
…oint

The fast-marching field has exact ties (the mirror pair at the second centre,
and 12 more within the first 300 centres). np.argmax took whichever cell a
platform's floating point put a last bit higher; on macOS arm64 the layout came
out different and the stored typed fibre diameters failed. Ties within 1e-12
relative now go to the lowest index, which is what argmax returns on exact
ties, so layouts on this machine are unchanged (stored values still pass).
Distinct values differ by at least 2.6e-9 relative over 300 centres. Tested
with 1e-13 relative noise on the field.
@RaulSimpetru
RaulSimpetru changed the base branch from feat/dd-optimiser-tooling to main November 7, 2026 18:04
@RaulSimpetru
RaulSimpetru merged commit b308ad2 into main Nov 7, 2026
6 checks passed
@RaulSimpetru
RaulSimpetru deleted the feat/fdi-fibre-typing branch November 7, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants