From f729bdac0bf49942aab85bfb748ad4cfd8667cdc Mon Sep 17 00:00:00 2001
From: Michiel Cottaar <michiel.cottaar@ndcn.ox.ac.uk>
Date: Tue, 30 Jan 2024 21:52:57 +0000
Subject: [PATCH] Fix maximum gradient calculation for changing

---
 src/gradients/changing_gradient_blocks.jl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gradients/changing_gradient_blocks.jl b/src/gradients/changing_gradient_blocks.jl
index c47b160..f631d09 100644
--- a/src/gradients/changing_gradient_blocks.jl
+++ b/src/gradients/changing_gradient_blocks.jl
@@ -36,8 +36,8 @@ duration(cgb::AbstractChangingGradientBlock) = cgb.duration
 
 grad_start(cgb::AbstractChangingGradientBlock) = cgb.gradient_strength_start
 slew_rate(cgb::AbstractChangingGradientBlock) = cgb.slew_rate
-grad_end(cgb::AbstractChangingGradientBlock) = gradient_strength(cgb) .+ slew_rate(cgb) .* duration(cgb)
-gradient_strength(cgb::AbstractChangingGradientBlock) = max.(cgb.gradient_strength_start, cgb.gradient_strength_start)
+grad_end(cgb::AbstractChangingGradientBlock) = grad_start(cgb) .+ slew_rate(cgb) .* duration(cgb)
+gradient_strength(cgb::AbstractChangingGradientBlock) = max.(grad_start(cgb), grad_end(cgb))
 qvec(cgb::AbstractChangingGradientBlock) = (grad_start(cgb) .+ grad_end(cgb)) .* (duration(cgb)/2)
 
 function bmat_gradient(cgb::AbstractChangingGradientBlock, qstart)
-- 
GitLab