Skip to content

Commit

Permalink
Split BlochSimulationMethod::62 into multiple lines to see where it f…
Browse files Browse the repository at this point in the history
…ails
  • Loading branch information
rkierulf committed Jun 18, 2024
1 parent 6cde94b commit c52c9ba
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion KomaMRICore/src/simulation/Bloch/BlochDictSimulationMethod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,15 @@ function run_spin_precession!(
#Mxy precession and relaxation, and Mz relaxation
tp = cumsum(seq.Δt) # t' = t - t0
dur = sum(seq.Δt) # Total length, used for signal relaxation
Mxy = [M.xy M.xy .* exp.(Complex{T}(1im) .* ϕ .- tp' ./ p.T2)] #This assumes Δw and T2 are constant in time
#Mxy = [M.xy M.xy .* exp.(Complex{T}(1im) .* ϕ .- tp' ./ p.T2)] #This assumes Δw and T2 are constant in time
#Temporary: split line above into multiple lines so we can see where it fails for oneAPI
one_im = Complex{T}(0,1)
exp_argument1 = one_im .* ϕ
exp_argument2 = - tp' ./ p.T2
exp_argument = exp_argument1 .+ exp_argument2
exp_result = exp.(exp_argument)
elementwise_multiplication = M.xy .* exp_result
Mxy = [M.xy elementwise_multiplication] #This assumes Δw and T2 are constant in time
M.xy .= Mxy[:, end]
#Acquired signal
sig[:, :, 1] .= transpose(Mxy[:, findall(seq.ADC)])
Expand Down
10 changes: 9 additions & 1 deletion KomaMRICore/src/simulation/Bloch/BlochSimulationMethod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ function run_spin_precession!(
#Mxy precession and relaxation, and Mz relaxation
tp = cumsum(seq.Δt) # t' = t - t0
dur = sum(seq.Δt) # Total length, used for signal relaxation
Mxy = [M.xy M.xy .* exp.(Complex{T}(1im) .* ϕ .- tp' ./ p.T2)] #This assumes Δw and T2 are constant in time
#Mxy = [M.xy M.xy .* exp.(Complex{T}(1im) .* ϕ .- tp' ./ p.T2)] #This assumes Δw and T2 are constant in time
#Temporary: split line above into multiple lines so we can see where it fails for oneAPI
one_im = Complex{T}(0,1)
exp_argument1 = one_im .* ϕ
exp_argument2 = - tp' ./ p.T2
exp_argument = exp_argument1 .+ exp_argument2
exp_result = exp.(exp_argument)
elementwise_multiplication = M.xy .* exp_result
Mxy = [M.xy elementwise_multiplication]
M.xy .= Mxy[:, end]
M.z .= M.z .* exp.(-dur ./ p.T1) .+ p.ρ .* (1 .- exp.(-dur ./ p.T1))
#Acquired signal
Expand Down

0 comments on commit c52c9ba

Please sign in to comment.