From 7e18e7c68cb067236e5f024a345b4f285a60d38f Mon Sep 17 00:00:00 2001 From: Michiel Cottaar <MichielCottaar@protonmail.com> Date: Fri, 31 May 2024 11:33:55 +0100 Subject: [PATCH] Fix adding events at edge of BuildingBlock --- src/containers/building_blocks.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/containers/building_blocks.jl b/src/containers/building_blocks.jl index c0316bf..0f9c07f 100644 --- a/src/containers/building_blocks.jl +++ b/src/containers/building_blocks.jl @@ -328,12 +328,21 @@ function BuildingBlock(waveform::AbstractVector, events::AbstractVector; orienta else push!(components, ChangingGradient(prev_grad, (grad .- prev_grad) ./ duration, orientation, duration, group)) end + if prev_time == time + continue + end for (t_event, event) in events if prev_time <= t_event < time push!(components, (t_event - prev_time, event)) end end end + for (t_event, event) in events + if t_event == waveform[end][1] + push!(components, (t_event - waveform[end-1][1], event)) + end + end + return BuildingBlock(components) end -- GitLab