Skip to content
Snippets Groups Projects
Verified Commit 12615788 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Add start time to events

parent 2a2fb5a9
No related branches found
No related tags found
No related merge requests found
......@@ -160,7 +160,7 @@ Converst object into something that can be included in the sequence:
to_block(cb::ContainerBlock) = cb
to_block(s::Symbol) = to_block(Val(s))
to_block(s::Union{VariableType, Nothing, Val{:min}, Val{:max}}) = Wait(s)
to_block(ec::EventComponent) = BuildingBlock([(0., 0.), (duration(ec), 0.)], [(1, ec)])
to_block(ec::EventComponent) = BuildingBlock([(0., 0.), (duration(ec), 0.)], [(1, (0., ec))])
function make_generic(seq::BaseSequence)
......
......@@ -265,7 +265,7 @@ Scanner constraints are automatically applied.
- `group`: group of the gradient waveform
"""
struct BuildingBlock <: BaseBuildingBlock
parts :: Vector{<:BaseComponent}
parts :: Vector{Union{GradientWaveform, Tuple{Number, EventComponent}}}
end
function BuildingBlock(waveform::AbstractVector, events::AbstractVector; orientation=nothing, group=nothing)
......@@ -278,7 +278,7 @@ function BuildingBlock(waveform::AbstractVector, events::AbstractVector; orienta
events = [(i+1, e) for (i, e) in events]
end
components = BaseComponent[]
components = Union{GradientWaveform, Tuple{Number, EventComponent}}[]
for (index_grad, ((prev_time, prev_grad), (time, grad))) in enumerate(zip(waveform[1:end-1], waveform[2:end]))
duration = time - prev_time
if norm(prev_grad) <= 1e-12 && norm(grad) <= 1e-12
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment