From 46fa2c08dd2e8c13215c95f0143dafbb9703568e Mon Sep 17 00:00:00 2001
From: Michiel Cottaar <michiel.cottaar@ndcn.ox.ac.uk>
Date: Thu, 8 Feb 2024 14:57:05 +0000
Subject: [PATCH] Fix timings with ramp overlap

---
 src/overlapping/gradient_readouts/single_lines.jl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/overlapping/gradient_readouts/single_lines.jl b/src/overlapping/gradient_readouts/single_lines.jl
index 1de414b..64ed469 100644
--- a/src/overlapping/gradient_readouts/single_lines.jl
+++ b/src/overlapping/gradient_readouts/single_lines.jl
@@ -43,7 +43,7 @@ function SingleLine(; rotate=:FOV, orientation=[1, 0, 0], ramp_overlap=1., resol
         TrapezoidGradient(orientation=orientation, duration=:min, rotate=rotate),
         get_free_variable(ramp_overlap),
     )
-    @constraint global_model() (res.ramp_overlap * rise_time(res.grad) + flat_time(res.grad)) == duration(res.adc)
+    @constraint global_model() (res.ramp_overlap * rise_time(res.grad) * 2 + flat_time(res.grad)) == duration(res.adc)
     set_simple_constraints!(res, kwargs)
     return res
 end
@@ -52,7 +52,7 @@ waveform(sl::SingleLine) = waveform(sl.grad)
 interruptions(sl::SingleLine) = [(index=2, time=effective_time(sl.adc), object=sl.adc)]
 
 ramp_overlap(sl::SingleLine) = sl.ramp_overlap
-effective_time(sl::SingleLine) = rise_time(sl.grad) + effective_time(sl.adc)
+effective_time(sl::SingleLine) = (1. - ramp_overlap(sl)) * rise_time(sl.grad) + effective_time(sl.adc)
 dwell_time(sl::SingleLine) = dwell_time(sl.adc)
 slew_rate(sl::SingleLine) = slew_rate(sl.grad)[1]
 gradient_strenth(sl::SingleLine) = slew_rate(sl) * rise_time(sl.grad)
-- 
GitLab