mrphy.slowsims
Simulation codes with implicit Jacobian operations.
- mrphy.slowsims.blochsim(M: Tensor, Beff: Tensor, *, T1: Tensor | None = None, T2: Tensor | None = None, γ: Tensor = tensor(4257.6000, dtype=torch.float64), dt: Tensor = tensor(4.0000e-06, dtype=torch.float64)) Tensor
Bloch simulator with implicit Jacobian operations.
- Usage:
Mo = blochsim(Mi, Beff, *, T1, T2, γ, dt)Mo = blochsim(Mi, Beff, *, T1=None, T2=None, γ, dt)- Inputs:
M: (N, *Nd, xyz), Magnetic spins, assumed equilibrium [[[0 0 1]]].Beff: (N, *Nd, nT, xyz), “Gauss”, B-effective, magnetic field.
- OPTIONALS:
T1: () ⊻ (N ⊻ 1, *Nd ⊻ 1,), “Sec”, T1 relaxation.T2: () ⊻ (N ⊻ 1, *Nd ⊻ 1,), “Sec”, T2 relaxation.γ: () ⊻ (N ⊻ 1, *Nd ⊻ 1,), “Hz/Gauss”, gyro ratio.dt: () ⊻ (N ⊻ 1,), “Sec”, dwell time.
- Outputs:
M: (N, *Nd, xyz), Magetic spins after simulation.
Note
spin history during simulations is not provided.
- mrphy.slowsims.blochsim_1step(M: Tensor, M1: Tensor, b: Tensor, E1: Tensor, E1_1: Tensor, E2: Tensor, γ2πdt: Tensor) Tuple[Tensor, Tensor]
Single step bloch simulation
- Usage:
M = blochsim_1step(M, M1, b, E1, E1_1, E2, γ2πdt)- Inputs:
M: (N, *Nd, xyz), Magnetic spins, assumed equilibrium [[[0 0 1]]].M1: (N, *Nd, xyz), pre-allocated variable for uϕrot output.b: (N, *Nd, xyz), “Gauss”, B-effective, magnetic field applied.E1: () ⊻ (N ⊻ 1, *Nd ⊻ 1,), a.u., T1 reciprocal exponential.E1_1: () ⊻ (N ⊻ 1, *Nd ⊻ 1,), a.u., T1 reciprocal exponential subtracted by1.E2: () ⊻ (N ⊻ 1, *Nd ⊻ 1,), a.u., T2 reciprocal exponential.γ2πdt: () ⊻ (N ⊻ 1, *Nd ⊻ 1,), “rad/Gauss”, gyro ratio in radiance mutiplied by dt.
- Outputs:
M: (N, *Nd, xyz), Magetic spins after simulation.
- mrphy.slowsims.blochsim_ab(M: Tensor, A: Tensor, B: Tensor) Tensor
Bloch simulation via Hargreave’s mat/vec representation
- Usage:
M = blochsim_ab(M, A, B)- Inputs:
M: (N, *Nd, xyz), Magnetic spins, assumed equilibrium magnitude [0 0 1]A: (N, *Nd, xyz, 3),A[:,iM,:,:]is the iM-th 𝐴.B: (N, *Nd, xyz),B[:,iM,:]is the iM-th 𝐵.
- Outputs:
M: (N, *Nd, xyz), Result magnetic spins
- mrphy.slowsims.freeprec(M: Tensor, dur: Tensor, *, T1: Tensor | None = None, T2: Tensor | None = None, Δf: Tensor | None = None) Tensor
Isochromats free precession with given relaxation and off-resonance
- Usage:
M = freeprec(M, dur, *, T1, T2, Δf)- Inputs:
M: (N, *Nd, xyz), Magnetic spins, assumed equilibrium magnitude [0 0 1]dur: () ⊻ (N ⊻ 1,), “Sec”, duration of free-precession.
- OPTIONALS:
T1: () ⊻ (N ⊻ 1, *Nd ⊻ 1,), “Sec”, T1 relaxation.T2: () ⊻ (N ⊻ 1, *Nd ⊻ 1,), “Sec”, T2 relaxation.Δf: (N ⊻ 1, *Nd ⊻ 1,), “Hz”, off-resonance.
- Outputs:
M: (N, *Nd, xyz), Result magnetic spins