Skip to content
Snippets Groups Projects
Unverified Commit 8c257228 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Use `base.length` rather than N to determine length

Allows for sequences with unknown length
parent 1fd03c0f
No related branches found
No related tags found
1 merge request!10Add Magnetisation transfer sequence
...@@ -55,7 +55,8 @@ Base.length(bs::BaseSequence{N}) where {N} = iszero(nrepeat(bs)) ? N : (nrepeat( ...@@ -55,7 +55,8 @@ Base.length(bs::BaseSequence{N}) where {N} = iszero(nrepeat(bs)) ? N : (nrepeat(
Base.eltype(::Type{<:BaseSequence}) = ContainerBlock Base.eltype(::Type{<:BaseSequence}) = ContainerBlock
Base.keys(seq::BaseSequence{N}) where {N} = 1:N Base.keys(seq::BaseSequence{N}) where {N} = 1:N
function start_time(bs::BaseSequence{N}, index::Integer) where {N} function start_time(bs::BaseSequence, index::Integer)
N = length(bs)
nTR = div(index-1, N, RoundDown) nTR = div(index-1, N, RoundDown)
if 0 < nrepeat(bs) <= nTR if 0 < nrepeat(bs) <= nTR
throw(BoundsError(bs, index)) throw(BoundsError(bs, index))
...@@ -208,7 +209,7 @@ Converst object into something that can be included in the sequence: ...@@ -208,7 +209,7 @@ Converst object into something that can be included in the sequence:
to_block(cb::ContainerBlock) = cb to_block(cb::ContainerBlock) = cb
to_block(s::Symbol) = to_block(Val(s)) to_block(s::Symbol) = to_block(Val(s))
to_block(s::Union{VariableType, Nothing, Val{:min}, Val{:max}}) = Wait(s) to_block(s::Union{VariableType, Nothing, Val{:min}, Val{:max}}) = Wait(s)
to_block(ec::EventComponent) = BuildingBlock([NoGradient(variables.duration(ec)), (0., ec)]) to_block(ec::EventComponent) = BuildingBlock(ec)
function make_generic(seq::BaseSequence) function make_generic(seq::BaseSequence)
......
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