From 0dfbd194bef173c2d2ee8657d1900df7b49083eb Mon Sep 17 00:00:00 2001 From: Michiel Cottaar <michiel.cottaar@ndcn.ox.ac.uk> Date: Mon, 26 Feb 2024 13:43:24 +0000 Subject: [PATCH] Keep track of events --- src/plot.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plot.jl b/src/plot.jl index b720d01..67ea626 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -37,13 +37,17 @@ SinglePlotLine(duration::Number) = SinglePlotLine([0., duration], [0., 0.]) function SinglePlotLine(plot_lines::SinglePlotLine...) times = Float64[] amplitudes = Float64[] + event_times = Float64[] + event_amplitudes = Float64[] current_time = 0. for pl in plot_lines append!(times, pl.times .+ current_time) append!(amplitudes, pl.amplitudes) + append!(event_times, pl.event_times .+ current_time) + append!(event_amplitudes, pl.event_amplitudes) current_time += duration(pl) end - return SinglePlotLine(times, amplitudes) + return SinglePlotLine(times, amplitudes, event_times, event_amplitudes) end """ @@ -106,7 +110,7 @@ function SequenceDiagram(bbb::BaseBuildingBlock) end for (symbol, fn) in [(:RFx, cosd), (:RFy, sind)] if event isa InstantPulse - kwargs[symbol] = SinglePlotLine([0., duration(bbb)], [0., 0.], [delay], [flip_angle(event) * fn(phase(evenet))]) + kwargs[symbol] = SinglePlotLine([0., duration(bbb)], [0., 0.], [delay], [flip_angle(event) * fn(phase(event))]) else points = [(t + delay, a * fn(p)) for (t, a, p) in zip(event.time, event.amplitude, event.phase)] kwargs[symbol] = SinglePlotLine(points, duration(bbb)) -- GitLab