Skip to content

Commit fa7dd0c

Browse files
committed
Test simulation waveform event types
1 parent 9d52e62 commit fa7dd0c

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

KomaMRICore/test/runtests.jl

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,45 @@ end
247247
end
248248
end
249249

250+
@testitem "Bloch waveform event types" tags=[:core, :nomotion] begin
251+
include("initialize_backend.jl")
252+
253+
sys = Scanner()
254+
obj = Phantom(x=[0.0], ρ=[1.0], T1=[1.0], T2=[1.0])
255+
adc = ADC(4, 1e-3)
256+
sim_params = Dict{String, Any}(
257+
"gpu" => USE_GPU,
258+
"return_type" => "mat",
259+
"Δt" => 1e-4,
260+
"Δt_rf" => 1e-4,
261+
)
262+
263+
grad_events = (
264+
Grad(1e-3, 1e-3),
265+
Grad([0.0, 1e-3, 0.0], 1e-3),
266+
Grad([0.0, 1e-3, 0.0], [0.5e-3, 0.5e-3]),
267+
)
268+
rf_events = (
269+
RF(1e-7, 1e-3),
270+
RF([0.0, 1e-7, 0.0], 1e-3),
271+
RF([0.0, 1e-7, 0.0], [0.5e-3, 0.5e-3]),
272+
)
273+
274+
for grad in grad_events
275+
seq = Sequence([grad;;], [RF(0.0, 0.0);;], [adc])
276+
sig = simulate(obj, seq, sys; sim_params, verbose=false)
277+
@test size(sig) == (adc.N, 1, 1)
278+
@test all(isfinite, sig)
279+
end
280+
281+
for rf in rf_events
282+
seq = Sequence([Grad(0.0, 0.0);;], [rf;;], [adc])
283+
sig = simulate(obj, seq, sys; sim_params, verbose=false)
284+
@test size(sig) == (adc.N, 1, 1)
285+
@test all(isfinite, sig)
286+
end
287+
end
288+
250289
@testitem "Bloch_RF_accuracy" tags=[:important, :core, :nomotion] begin
251290
using OrdinaryDiffEqTsit5
252291
include("initialize_backend.jl")

0 commit comments

Comments
 (0)