From 9357b54a5b63e93ba86ec9233d2118765710ed0d Mon Sep 17 00:00:00 2001 From: Michiel Cottaar <michiel.cottaar@ndcn.ox.ac.uk> Date: Tue, 9 Apr 2024 14:44:29 +0100 Subject: [PATCH] Add more tests to plot sequences --- test/test_plot.jl | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/test/test_plot.jl b/test/test_plot.jl index 16f1008..4b15d64 100644 --- a/test/test_plot.jl +++ b/test/test_plot.jl @@ -17,4 +17,50 @@ using Gtk @visualtest plot_press "$dir/plots/pulseq_press.png" !isCI end + @testset "Instantaneous gradients & pulses" begin + function plot_perfect_dwi(fname) + sequence = DWI(TE=80., bval=2., Δ=40., gradient=(type=:instant, )) + f = plot_sequence(sequence) + CairoMakie.save(fname, f) + end + + @visualtest plot_perfect_dwi "$dir/plots/perfect_dwi.png" !isCI + end + + @testset "Finite RF pulses" begin + function plot_finite_rf(fname) + times = -2:0.1:2 + raw_amp = sinc.(times) + sequence = build_sequence() do + Sequence( + GenericPulse(times .+ 2, raw_amp), + InstantPulse(flip_angle=60., phase=0.), + GenericPulse(times .+ 2, raw_amp .* 2), + InstantPulse(flip_angle=120., phase=0.), + ) + end + f = Figure() + Axis(f[1, 1]) + plot_sequence(sequence) + CairoMakie.save(fname, f) + end + + @visualtest plot_finite_rf "$dir/plots/finite_rf.png" !isCI + end + + @testset "Finite gradients" begin + function plot_finite_dwi(fname, single_gradient=false) + sequence = DWI(bval=2., TE=80, TR=100, orientation=[0, -1, 1], scanner=Siemens_Prisma) + f = Figure() + Axis(f[1, 1]) + plot!(sequence; single_gradient=single_gradient) + CairoMakie.save(fname, f) + end + + @visualtest fn->plot_finite_dwi(fn, true) "$dir/single_grad_dwi.png" !isCI + @visualtest fn->plot_finite_dwi(fn, false) "$dir/multi_grad_dwi.png" !isCI + end + + + end \ No newline at end of file -- GitLab