Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
They run in a new double-precision C++ extension (`_trains_cpu`) on the
host, take and return NumPy arrays, and solve a batch of trains across
threads.
- **Exact derivatives of designed trains.** `prescribed_flips` takes
`signal_tangents` (and `first_flip_tangents`) and returns the derivatives of
the flip angles and echoes along them; `effective_te` takes `flip_tangents`;
`busse_flips(jacobian=True)` returns the derivatives of the train with
respect to its lowest, centre and highest angle. They are carried through
the kernel's echo-by-echo recursion in forward mode, at the cost of one more
state vector per direction, and the shooting that pins a Busse train's three
angles takes its Newton Jacobian from them.
- **Coarse-to-fine dictionary search.** `DictionaryMatcher(coarse=k)` places
the atoms on the lattice their parameters were simulated on, scores every
k-th value along each parameter, then the `2k + 1` values around the winner
Expand All @@ -28,6 +36,9 @@

### Fixed

- **Forward mode is quiet on every PyTorch.** The `torch.jit.script`
deprecation PyTorch prints when forward mode first loads is silenced
whatever warning class it is raised as (a `FutureWarning` on PyTorch 2.15).
- **`Subspace` round-trips complex signals.** `project` is `signals @ basis.conj()`
and `expand` is `coefficients @ basis.mT`, so a signal in the span comes back
unchanged; `modes` is `basis.mH`, which mri-nufft's `MRISubspace` expands
Expand Down
7 changes: 7 additions & 0 deletions docs/api/trains.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ on it the variable-flip-angle trains of long 3D fast spin echo readouts, and
echo time, which {func}`effective_te` computes for any train. A batch of
trains is solved in one call, across threads.

Each of them also gives exact derivatives, for designing a train against a
cost: {func}`prescribed_flips` along changes of the prescribed signal and of
the first angle, {func}`effective_te` along changes of the flip angles, and
{func}`busse_flips` with respect to its three angles. They are carried through
the same echo-by-echo recursion in forward mode, one extra set of states per
direction, so a few directions cost a few inversions.

| Object | Description |
| --- | --- |
| {obj}`~blochsim.trains.prescribed_flips` | Flip angles whose echoes take prescribed amplitudes, and the echoes they give. |
Expand Down
4 changes: 1 addition & 3 deletions src/blochsim/_derivative.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ def forward_mode() -> None:
if os.environ.get("PYTORCH_JIT", "1") != "1" or not __debug__:
return
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore", message=r"`torch\.jit\.script`", category=DeprecationWarning
)
warnings.filterwarnings("ignore", message=r"`torch\.jit\.script`")
try:
importlib.import_module("torch._decomp.decompositions_for_jvp")
except ImportError:
Expand Down
Loading
Loading