Skip to content

PD trains from an explicit target signal (Buonincontri), on blochsim's bounded inverse EPG - #234

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

Ports the target-signal PD design of #227 onto main as an option alongside the existing pd design. It runs on blochsim's inverse EPG with exact derivatives and no finite differences.

What it adds

  • make_pd_target_schedule(length, echo_spacing, ...) designs a PD train by inverse EPG of an eight-parameter target signal: an initial decay from the second echo, a sloped plateau and a late tail. Every pulse is bounded by maximum_flip_angle. The inversion is blochsim.trains.prescribed_flips(..., maximum_flip=...) (blochsim Render Attributes sections as a field list, as Parameters are #59).
  • PD_CENTRE and PD_PERIPHERY are fitted to the trains read off Fig. 1 of Buonincontri et al. (ISMRM 2025, 566-05-007). The digitised trains are in tests/fixtures/buonincontri_figure1.json.
  • benchmarks/pd_buonincontri_fit.py refits them with least_squares(jac=...), the Jacobian being the exact derivative of the angles from blochsim's forward-mode tangents. It reproduces the published parameters to the third decimal (RMS 1.0° centre, 2.4° periphery).
  • In fse3d, flip_modulation="pd_target" comes with pd_target_* parameters (centre) and pd_target_*_periphery parameters (None inherits the centre), plus pd_target_maximum_angle_deg (150°).
    • In a centre/periphery transition, every shot is designed from its own cubically interpolated target, at its own ETL, in one batched pass.
    • pd_effective_te and the centre-echo selection work as under pd.
    • pd_optimize is refused, since it fits the angle-controlled pd design.
    • PDControlColumns names the target parameters.
  • pd (first/maximum/final angles) is unchanged.

Tests (tests/test_pd_target_schedule.py)

  • the fitted targets reproduce the published centre and periphery trains;
  • no pulse passes the bound;
  • echoes meet the target wherever the bound isn't reached;
  • a batch designs each train as it would alone;
  • the 8-parameter angle Jacobian matches central differences, both on a train held at the bound and on one that isn't;
  • out-of-range parameters are refused;
  • each shot of an fse3d transition plays its own target's train, under both buonincontri and buonincontri_golden;
  • definitions and the refusal of pd_optimize.

Full suite locally against blochsim #59: 5445 passed, 41 skipped. CI needs blochsim 0.0.21 on PyPI (the design extra now asks for blochsim>=0.0.21).


Generated by Claude Code

…se EPG

make_pd_target_schedule and fse3d's flip_modulation "pd_target" design a PD
train by inverse EPG of an eight-parameter target signal (initial decay from
the second echo, a sloped plateau, a late tail), every pulse bounded by a
largest angle. The defaults PD_CENTRE and PD_PERIPHERY reproduce the trains
read off Fig. 1 of Buonincontri et al. (ISMRM 2025); the fit in
benchmarks/pd_buonincontri_fit.py takes its Jacobian from the exact
derivatives blochsim carries through the inversion. A transition designs
every shot from its own interpolated target in one batched pass. Requires
blochsim 0.0.21 for maximum_flip.

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

Copy link
Copy Markdown
Contributor Author

The red test jobs are failing at install: blochsim>=0.0.21 isn't on PyPI yet ("No matching distribution found"). That release carries the maximum_flip bound from pulserver/blochsim#59. Once #59 is merged and 0.0.21 is published, I'll re-run these jobs.


Generated by Claude Code

@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.02985% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pypulseqpp/_pd.py 94.02% 2 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@mcencini
mcencini merged commit e3bb951 into main Nov 12, 2026
16 of 23 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.

2 participants