EPG implementation that mimics the regular implementation from Julien Lamy in Sycomore
Short description
EPG implementation that mimics the regular implementation from Julien Lamy in Sycomore
Short description
Regular implementation use a constant positive or negative gradient dephasing. We use a vector Fp, Fn and Z to store the states.
Initialization
EPG states are stored as a structure :
mutable struct EPGStates{T <: Real}
Fp::Vector{Complex{T}}
Fn::Vector{Complex{T}}
Z::Vector{Complex{T}}
endwhich can be initialized with default parameters Fp = 0, Fn = 0 and Z = 1 states using :
using EPGsim
E = EPGStates()EPGStates struct with fields : Fp, Fn, Z
or by :
E = EPGStates(0,0,1)EPGStates struct with fields : Fp, Fn, Z
which convert any numbers of the same types in Vector{ComplexF64}
or directly by passing Vector{Complex{T}} where {T <: Real} which means it can accept a complex{dual} type :
T = ComplexF32
E = EPGStates(T.([0.5+0.5im,1]),T.([0.5-0.5im,0]),T.([1,0]))EPGStates struct with fields : Fp, Fn, Z
!!! Note Julia is a one based indexing language. Fp[1]/Fn[1]/Z[1] store the echo and correspond to the states commonly named $F_0^+$ / $F_0^-$ $Z_0$
EPG simulation
3 functions are used to simulate a sequence :
- epgDephasing
- epgRelaxation
- epgRotation
They take an EPGStates struct as first parameter.
E = EPGStates()
E = epgRotation!(E,deg2rad(60),0)
E = epgDephasing!(E,1)
E = epgRotation!(E,deg2rad(60),deg2rad(117))EPGStates struct with fields : Fp, Fn, Z
Currently, all the EPGstates are stored and used for calculation. The states equal or really close to zero are not deleted
Accessing states
States can seen directly as a vector :
E.Fp2-element Vector{ComplexF64}:
0.38581714244240034 + 0.19658365292562008im
0.0 - 0.649519052838329imor by elements :
E.Fp[2]0.0 - 0.649519052838329imgetStates is also available to create a 3xN matrix where 3 corresponds to Fp,Fn,Z and N is the number of states.
getStates(E)3×2 Matrix{ComplexF64}:
0.385817+0.196584im 0.0-0.649519im
0.385817-0.196584im 0.175157+0.127259im
0.25+0.0im 0.170246+0.334127imSignal
The function epgSignal(E, phase=0.0) returns the complex signal corresponding to the echo stored in E.Fp[1].
- Arguments:
E:EPGStatesinstancephase: optional phase correction in radians (default0.0). The returned value is multiplied byexp(-im*phase).
Example:
E = EPGStates()
epgRotation!(E, deg2rad(90), 0.0)
# raw signal from Fp[1]
s = epgSignal(E)
# phase-corrected signal (phase in radians)
ph = 0.3
s_ph = epgSignal(E, ph)
println("signal: ", s)
println("phase-corrected: ", s_ph)signal: 0.0 - 1.0im
phase-corrected: -0.29552020666133955 - 0.955336489125606im