Skip to content

Scanner 13 Nov: hot-fixes from the 7 T session - #235

Merged
mcencini merged 3 commits into
mainfrom
scanner-1113-hotfixes
Nov 13, 2026
Merged

mcencini merged 3 commits into
mainfrom
scanner-1113-hotfixes

Conversation

@mcencini

@mcencini mcencini commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Hot-fixes from the 13 Nov 7 T session, collected here and merged after the scanner confirms them.

Fix How it is hot-fixed Confirmed on the scanner
EPI odd/even phase reference (exam 5195 series 2: the navigator measured +52 mrad/px of odd/even slope, the train +35 mrad/px, leaving a 10 % N/2 ghost). epi2D/epi3D take phase_reference (default False) and navigator_lines (None: NAVIGATOR_LINES without the reference, none with it). With the reference, the last dummy shot of each slice (2D), of the volume (3D) and the FLEET calibration's dummy shot play the shot's own train with every phase/partition-encode prewinder, blip and rewinder scaled to zero, ADC on, PHASECORR; every train line carries its position in the train in USER0 (ECHO_COUNTER). A scan without dummies plays one dummy cycle for it. Same events as an imaging shot, so no new segment. gain_calibration_readouts counts PHASECORR readouts with the dummies. pypulseqpp/sequences/sequence/epi{2D,3D}_sequence.py and sequences/_prescan.py replaced in the scanner's EnvPulserver site-packages; the zoo plugins (pulserver #382) turn the reference on (bundle build/scanner-2026-11-13/hotfix-epi-ref/) [x] series 3: N/2 ghost 12.8 % → 0.9 %
Busse optimizer derivatives (3384aed): #231's torch.func.vmap(jvp) on the flips failed under torch 2.7.1 (the deployed pin) with blochsim's native packing — every fse3d Busse protocol refused at generation (exam 5195 run 3499, "Cannot access data pointer of Tensor that doesn't have storage"). _ForwardSignal.slopes now uses exact reverse mode through blochsim's native backward (J^T u, then J d per direction). CI's Python 3.10 job now also runs torch 2.7.1. In the deployed environment test_fse_busse.py + test_fse_effective_te.py: 40/40 (4 failed before). pypulseqpp/_busse_opt.py replaced in the scanner's EnvPulserver site-packages, design server restarted (bundle build/scanner-2026-11-13/hotfix-busse-reverse/, d4ce7219 → e08f7eb3; the committed file differs only in ruff wrapping) [ ] CUBE-matched fse3d protocol re-validated

Checks: tests/test_zoo_epi.py, tests/test_prescan.py: 222 passed (9 new tests: the reference is the imaging train with every encode at zero, same read lobe/ADC/duration/polarity per echo, in 2D, segmented, multiband, 3D and skipped-CAIPI; it replaces the navigator and shortens TE and TR; one dummy cycle without dummies; FLEET takes its reference from its dummy shot; the gain prescan does not count it as imaging). Run against the released 0.0.67 with these files overlaid, as deployed.

To do before merge: the default phase_reference=True once the scanner confirms; the EPI tour (gallery/02-tours/03_epi.py) and the sequence pages.

🤖 Generated with Claude Code

epi2D/epi3D take phase_reference (default False) and navigator_lines (None:
NAVIGATOR_LINES without the reference, none with it). With the reference,
the last dummy shot of each slice (2D), of the volume (3D) and the FLEET
calibration's dummy shot plays the shot's own train with every phase- and
partition-encode prewinder, blip and rewinder scaled to zero, its lines
acquired and labelled PHASECORR; every train line carries its position in
the train in USER0 (ECHO_COUNTER). A scan without dummies plays one dummy
cycle for it. The reference reuses the imaging shot's events, so it adds no
segment. gain_calibration_readouts counts PHASECORR readouts with the
dummies, as it does navigators.

Scanner hot-fix, 13 Nov 7 T session (exam 5195 series 2: the navigator's
odd/even slope, +52 mrad/px, is not the train's, +35 mrad/px).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codecov

codecov Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

mcencini and others added 2 commits November 13, 2026 14:53
…ve kernel

#231 took the optimizer's flip derivatives with torch.func.vmap(jvp(...)).
blochsim differentiates a sequence argument by reverse mode ("build a cost
and call backward()"), and its native packing reads the train's structure
with .tolist(), which a torch.func wrapper does not allow under the
PyTorch the deployed environments pin (2.7.1): every fse3d Busse protocol
failed at generation with "Cannot access data pointer of Tensor that
doesn't have storage" on the 7 T (exam 5195). CI passed because it only
ran the latest PyTorch.

_ForwardSignal.slopes now takes one backward pass, J^T u with create_graph,
and its derivative along each direction, J d: exact, plain autograd,
blochsim's native backward. In the deployed environment
tests/test_fse_busse.py and tests/test_fse_effective_te.py pass 40/40 (4
failed before, with the 7 T error); native reverse-mode gradients match
float32-safe central differences to 4-5 digits.

CI's Python 3.10 job now also installs torch 2.7.1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…igator

The EPI tour says what the shipped EPI sequences acquire for the odd/even
correction: navigator lines, or with phase_reference the blip-free
reference train. The te default of epi2D/epi3D no longer assumes a
navigator.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mcencini

Copy link
Copy Markdown
Contributor Author

/build-docs

@github-actions

Copy link
Copy Markdown
Contributor

Documentation build: success (https://github.com/pulserver/pypulseqpp/actions/runs/43441491161)

@mcencini
mcencini marked this pull request as ready for review November 13, 2026 18:47
@mcencini
mcencini merged commit abc15f1 into main Nov 13, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant