diff --git a/src/all_building_blocks/base_building_blocks.jl b/src/all_building_blocks/base_building_blocks.jl index bf59784940f63be052b28a8075687261e212ad24..cb8c762b79bde53fa0d555d767521620ed104367 100644 --- a/src/all_building_blocks/base_building_blocks.jl +++ b/src/all_building_blocks/base_building_blocks.jl @@ -119,20 +119,27 @@ function waveform_sequence(bb::BaseBuildingBlock, first, last) current_grad_key = key current_start = nothing end - if key == first + if key == first || key == Val(first) @assert !started started = true current_start = effective_time(bb[key]) end - if key == last + if key == last || key == Val(last) @assert started if isnothing(current_start) push!(parts, (current_grad_key, split_gradient(bb[current_grad_key], effective_time(bb[key]))[1])) else push!(parts, (current_grad_key, split_gradient(bb[current_grad_key], current_start, effective_time(bb[key]))[2])) end + return parts end end + if !started + error("Starting index of $first not recognised.") + end + if !isnothing(last) + error("Final index of $last not recognised.") + end return parts end diff --git a/src/all_building_blocks/spoilt_slice_selects.jl b/src/all_building_blocks/spoilt_slice_selects.jl index 5c88491b4ea1b6d8183e1d10035832d530114e02..7345b8d172c1a71e6e234928b1b3b88affdbde63 100644 --- a/src/all_building_blocks/spoilt_slice_selects.jl +++ b/src/all_building_blocks/spoilt_slice_selects.jl @@ -38,7 +38,7 @@ end function SpoiltSliceSelect(pulse::RFPulseComponent; orientation=[0, 0, 1], group=nothing, spoiler_scale=nothing, slice_thickness=nothing, kwargs...) model = global_model() res = nothing - if isinf(slice_thickness) + if slice_thickness isa Number && isinf(slice_thickness) rise_time_var = get_free_variable(nothing) flat_time_var = get_free_variable(nothing) res = SpoiltSliceSelect( @@ -70,9 +70,9 @@ function SpoiltSliceSelect(pulse::RFPulseComponent; orientation=[0, 0, 1], group for time_var in (res.rise_time1, res.flat_time1, res.diff_time, res.flat_time2, res.fall_time2) @constraint model time_var >= 0 end - @constraint model res.diff_time <= res.rise_time1 - @constraint model res.diff_time <= res.fall_time2 - @constraint model qval(res, nothing, 1) == qval(res, 1, nothing) + #@constraint model res.diff_time <= res.rise_time1 + #@constraint model res.diff_time <= res.fall_time2 + #@constraint model qval(res, nothing, 1) == qval(res, 1, nothing) end if !isnothing(spoiler_scale)