compose_spinor#
- blochsim.compose_spinor()[source]#
Return the Cayley-Klein pair of a shaped pulse, composed over its samples.
One SU(2) rotation per sample, composed in play order, about the effective field
(drive.real, drive.imag, turn_z).- Parameters:
drive (torch.Tensor or iterable of torch.Tensor) – Transverse field per sample, in radians per sample: a tensor with the sample axis first, or an iterable of per-sample tensors.
turn_z (torch.Tensor or iterable of torch.Tensor) – Longitudinal turn per sample, in radians, one per spin. A tensor holds for every sample (a static gradient); an iterable gives one tensor per sample.
- Returns:
a, b – Complex128, shaped like the turn. Each sample rotates right-handedly by the length of the effective-field vector, so a spin 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 an iterable
turn_zanddrivediffer in length.