compose_spinor#
- torchsim.compose_spinor(drive, turn_z)[source]#
The Cayley-Klein pair a shaped pulse leaves, sample by sample.
One SU(2) element per raster sample, composed in the order the scanner plays them. Each is the rotation about the effective field a spin sees while that sample lasts: the RF in the transverse plane, the gradient along z.
- Parameters:
drive – The transverse field per sample, radians turned per sample. A tensor with the sample axis first, or any iterable of per-sample tensors – which is how a per-voxel field is composed without ever holding one for every sample at once.
turn_z – The longitudinal turn per sample, radians, one per spin. A tensor is the turn every sample makes – a gradient the scanner holds – and an iterable of per-sample tensors is one it moves, in the same form
drivetakes.
- Returns:
a, b – Complex128, shaped like the turn. Each sample turns the magnetisation right-handedly about
(drive.real, drive.imag, turn_z)by that vector’s length, so a spin starting along+zends withMxy = -2 conj(a b)andMz = |a|^2 - |b|^2. A real drive of areaton resonance gives(cos(t/2), -i sin(t/2)).- Return type:
torch.Tensor
- Raises:
ValueError – If a moving gradient runs out before the pulse does, or the other way about.