dmipy-design
Hardware-constrained diffusion-MRI gradient-waveform design — part of the dmipy ecosystem (see dmipy-sim for the forward Monte-Carlo engine and dmipy-fit for the analytical inverse).
Design deliverable diffusion gradient waveforms under real scanner limits, in the
instant-pulse approximation (ideal hard RF). Given a b-tensor shape, a target echo time, and a
scanner's hardware limits, it returns the constraint-optimal gradient and can export it to a
scanner-runnable Pulseq .seq.
What's here
- NOW — the design oracle (
design_waveform_now). A NumPy + SciPy port of the NOW recipe (Sjölund et al. 2015; jsjol/NOW): maximiseb = gᵀQgwith active-set SQP, constraints expressed exactly (per-axis slew and amplitude, refocusq(TE)=0, moments M1/M2, b-tensor shape, Maxwell, OGSE spectral, PNS (SAFE model), heat∫g²), analytic objective + constraint Jacobians. One solver, all shapes — LTE / PTE / STE, and OGSE via a spectral-frequency constraint. - PGSTE (
design_stimulated_echo). Stimulated-echo diffusion encoding through the same NOW core: matched transverse periodsτ₁ = τ₃around a long, T1-limited mixing time TM. - Timing & asymmetric windows (
SequenceTiming). The physical encoding-window budget. The pre/post-180 window asymmetry is a derived consequence of the scanner timing (lead-in ≠ readout-pre-echo, partial Fourier), never a free knob;symmetric=Truegives the conventional (dead-timed) waveform for comparison. - Pulseq I/O (
dmipy_design.pulseq_export). Export a design to a scanner-runnable spin-echo.seqon real vendor limits, and run the offline acceptance checks (timing, realized Gmax/slew, b-tensor round-trip, PNS via the SAFE model). - Scanner constraints (
HardwareConstraints,TimeConstraints, and the SAFE PNS model in the NOW solver); the full vendor catalogue (PULSEQ_SYSTEMS) comes from dmipy-sim.
Scope (instant-pulse): RF pulses are ideal and instantaneous. Finite-RF-pulse optimization and CRLB/Fisher-information experiment design are not part of this package.
Install
pip install dmipy-design # NOW + timing + PGSTE (NumPy/SciPy only)
pip install "dmipy-design[sim]" # + dmipy-sim bridge (to_sim_waveform, from_pulseq)
pip install "dmipy-design[pulseq]" # + scanner-runnable .seq export (pypulseq)
Quickstart
from dmipy_design import design_waveform_now, SequenceTiming
# a real timing budget from a readout (partial Fourier shortens the post-180 window)
timing = SequenceTiming.from_readout(t_excite=2e-3, t_refocus=6e-3,
readout_duration=30e-3, partial_fourier=0.75)
# max-b LTE waveform under Prisma-class limits, with M1/M2 nulled (default)
d = design_waveform_now(b_delta=1.0, G_max=0.08, slew_rate_max=200.0,
TE=0.08, timing=timing)
print(d.b_value, d.feasible, d.max_slew, d.refocus_residual)
# STE (isotropic) and an OGSE-like waveform at ~80 Hz
ste = design_waveform_now(b_delta=0.0, TE=0.08)
ogse = design_waveform_now(b_delta=1.0, TE=0.08, spectral_freq=80.0)
# PGSTE with a long mixing time
from dmipy_design import design_stimulated_echo
pgste = design_stimulated_echo(b_delta=1.0, TM=50e-3, TE=0.12)
Two modes: max-b at a fixed TE, or min-TE for a target b (SNR-optimal)
design_waveform_now maximises b at a fixed TE. The mirror image — given a required
b-value, find the shortest TE that still reaches it — is the SNR-optimal design (shorter TE
⇒ less T2 decay before the echo). Because achievable b is monotonic in TE, min_te_for_b
bisects TE around the same max-b primitive:
from dmipy_design import min_te_for_b, SequenceTiming
timing = SequenceTiming(t_excite=3e-3, t_refocus=6e-3, t_readout_pre_echo=14e-3)
design, te = min_te_for_b(b_target=1e9, b_delta=1.0, timing=timing) # 1000 s/mm²
print(f"shortest TE = {te*1e3:.1f} ms, b = {design.b_value:.2e}")
Export to a scanner-runnable .seq (needs [pulseq]):
from dmipy_design.pulseq_export import design_to_pulseq, pulseq_delivery_report
seq = design_to_pulseq(d, scanner="siemens_prisma", filename="design.seq")
print(pulseq_delivery_report(d, seq, scanner="siemens_prisma"))
Tests
pip install -e ".[dev]"
pytest -q # NOW / timing / PGSTE (NumPy+SciPy)
pip install -e ".[pulseq,dev]"
pytest -q tests/test_pulseq_export.py # the Pulseq round-trip
License
See LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dmipy_design-2.0.1.tar.gz.
File metadata
- Download URL: dmipy_design-2.0.1.tar.gz
- Upload date:
- Size: 38.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3db92043ed6cbc1e56e470cef7534df14e1b389e1f8af2dee76ac67cfd2045de
|
|
| MD5 |
7c8355b014f553a693defcac9e5dd764
|
|
| BLAKE2b-256 |
a2ddb9a64c1d0f5ad3f7949e24a56d37f7e23d5a8a43565f42fd6e2cadf811af
|
Provenance
The following attestation bundles were made for dmipy_design-2.0.1.tar.gz:
Publisher:
publish.yml on dmrai-lab/dmipy-design
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dmipy_design-2.0.1.tar.gz -
Subject digest:
3db92043ed6cbc1e56e470cef7534df14e1b389e1f8af2dee76ac67cfd2045de - Sigstore transparency entry: 2202493928
- Sigstore integration time:
-
Permalink:
dmrai-lab/dmipy-design@60da37c4913ed291d941779763dfdff30fdf2c18 -
Branch / Tag:
refs/tags/v2.0.1 - Owner: https://github.com/dmrai-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@60da37c4913ed291d941779763dfdff30fdf2c18 -
Trigger Event:
release
-
Statement type:
File details
Details for the file dmipy_design-2.0.1-py3-none-any.whl.
File metadata
- Download URL: dmipy_design-2.0.1-py3-none-any.whl
- Upload date:
- Size: 36.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1ce248de59253f965d8f1ebc2b448841b26266690fd6201e9d62e4965aa2278
|
|
| MD5 |
d8d898e13e70ab79ec63c80432947afc
|
|
| BLAKE2b-256 |
fc0bc383e7be6d679a4c70475b2c756f5c83c2364f1980669349ee5e726906e0
|
Provenance
The following attestation bundles were made for dmipy_design-2.0.1-py3-none-any.whl:
Publisher:
publish.yml on dmrai-lab/dmipy-design
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dmipy_design-2.0.1-py3-none-any.whl -
Subject digest:
d1ce248de59253f965d8f1ebc2b448841b26266690fd6201e9d62e4965aa2278 - Sigstore transparency entry: 2202494011
- Sigstore integration time:
-
Permalink:
dmrai-lab/dmipy-design@60da37c4913ed291d941779763dfdff30fdf2c18 -
Branch / Tag:
refs/tags/v2.0.1 - Owner: https://github.com/dmrai-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@60da37c4913ed291d941779763dfdff30fdf2c18 -
Trigger Event:
release
-
Statement type: