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

Always return events as tuples

parent b881bb4a
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,7 @@ Main interface: ...@@ -24,7 +24,7 @@ Main interface:
Sub-types need to implement: Sub-types need to implement:
- `Base.keys`: returns sequence of keys to all the components. - `Base.keys`: returns sequence of keys to all the components.
- `Base.getindex`: returns the actual component for each key. - `Base.getindex`: returns the actual component for each key. For `events` (readout/pulses) this should return a tuple with `(time delay till start, event)`.
""" """
abstract type BaseBuildingBlock <: ContainerBlock end abstract type BaseBuildingBlock <: ContainerBlock end
...@@ -42,7 +42,7 @@ Base.getindex(bb::BaseBuildingBlock, s::Symbol) = bb[Val(s)] ...@@ -42,7 +42,7 @@ Base.getindex(bb::BaseBuildingBlock, s::Symbol) = bb[Val(s)]
Returns just the non-gradient (i.e., RF pulses/readouts) events as a sequence of [`EventComponent`](@ref) objects (with their keys). Returns just the non-gradient (i.e., RF pulses/readouts) events as a sequence of [`EventComponent`](@ref) objects (with their keys).
""" """
function events(bb::BaseBuildingBlock) function events(bb::BaseBuildingBlock)
return [(key, bb[key]) for key in keys(bb) if bb[key] isa EventComponent] return [(key, bb[key][2]) for key in keys(bb) if bb[key] isa Tuple{<:Number, <:EventComponent}]
end end
""" """
......
...@@ -144,7 +144,7 @@ function SliceSelect(pulse::RFPulseComponent; orientation=nothing, rise_time=not ...@@ -144,7 +144,7 @@ function SliceSelect(pulse::RFPulseComponent; orientation=nothing, rise_time=not
end end
Base.keys(::SliceSelect) = (Val(:rise), Val(:flat), Val(:pulse), Val(:fall)) Base.keys(::SliceSelect) = (Val(:rise), Val(:flat), Val(:pulse), Val(:fall))
Base.getindex(pg::SliceSelect, ::Val{:pulse}) = pg.pulse Base.getindex(pg::SliceSelect, ::Val{:pulse}) = (0., pg.pulse)
inverse_slice_thickness(ss::SliceSelect) = 1e3 * gradient_strength(ss.trapezoid) .* inverse_bandwidth(ss.pulse) inverse_slice_thickness(ss::SliceSelect) = 1e3 * gradient_strength(ss.trapezoid) .* inverse_bandwidth(ss.pulse)
...@@ -189,7 +189,7 @@ function LineReadout(adc::ADC; ramp_overlap=nothing, orientation=nothing, group= ...@@ -189,7 +189,7 @@ function LineReadout(adc::ADC; ramp_overlap=nothing, orientation=nothing, group=
end end
Base.keys(::LineReadout) = (Val(:rise), Val(:adc), Val(:flat), Val(:fall)) Base.keys(::LineReadout) = (Val(:rise), Val(:adc), Val(:flat), Val(:fall))
Base.getindex(lr::LineReadout, ::Val{:adc}) = (ramp_overlap(lr) * rise_time(lr), lr.adc) Base.getindex(lr::LineReadout, ::Val{:adc}) = ((1 - ramp_overlap(lr)) * rise_time(lr), lr.adc)
ramp_overlap(lr::LineReadout) = lr.ramp_overlap ramp_overlap(lr::LineReadout) = lr.ramp_overlap
inverse_fov(lr::LineReadout) = 1e3 * dwell_time(lr.adc) * gradient_strength(lr.trapezoid) * lr.adc.oversample inverse_fov(lr::LineReadout) = 1e3 * dwell_time(lr.adc) * gradient_strength(lr.trapezoid) * lr.adc.oversample
......
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