Skip to content

trains: a largest refocusing angle for prescribed trains - #59

Merged
mcencini merged 1 commit into
mainfrom
claude/project-thread-tbach0
Nov 12, 2026
Merged

mcencini merged 1 commit into
mainfrom
claude/project-thread-tbach0

Conversation

@mcencini

Copy link
Copy Markdown
Contributor

Requested by Matteo · project thread

prescribed_flips takes maximum_flip (degrees, one per train, in (0, 180]). Each solved pulse takes the angle in [0, maximum_flip] whose echo comes nearest the prescription: the bound replaces 180 degrees as the upper end of the interval in the kernel's candidate search. A pulse held at the bound is an end of the interval, so its derivative is zero, and the tangent recursion carries that through the rest of the train. first_flip is not bounded.

This is what pypulseqpp's target-signal PD trains (Buonincontri et al., ISMRM 2025) need. Their fitted targets ask for 180 degrees past about 60 echoes without a bound. On those targets the bounded kernel agrees with the earlier NumPy solver of pypulseqpp #227 to 1e-13 degrees.

Tests (tests/trains/test_prescribed_flips.py):

  • a 180-degree maximum changes nothing;
  • unit echoes under a 150-degree bound play 150 degrees, and their echoes match isochromat summation;
  • each train of a batch keeps its own bound;
  • the chosen angle comes nearest the target among a fine grid within the bound;
  • the bounded tangents match central differences, with and without relaxation;
  • invalid bounds are refused.

pytest tests/trains: 128 passed.


Generated by Claude Code

prescribed_flips(maximum_flip=...) bounds every solved angle per train: the
kernel takes the angle in [0, maximum] whose echo comes nearest the
prescription, and a pulse held at the bound has zero derivative.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MFB6QPbxDLE71AUX5ieZ7n
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.

2 participants