Skip to content

Commit

Permalink
Change reduce(vcat, itr) to reduce(vcar, [itr])
Browse files Browse the repository at this point in the history
  • Loading branch information
cncastillo committed Jul 12, 2024
1 parent a2837ae commit 61cad11
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions KomaMRIBase/src/datatypes/Sequence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -314,23 +314,23 @@ function get_samples(seq::Sequence, range; events=[:rf, :gr, :adc], freq_in_phas
fill_if_empty(x) = isempty(x.t) && length(range) == length(seq) ? merge(x, (t=[0.0; dur(seq)], A=zeros(eltype(x.A), 2))) : x
# RF
if :rf in events
t_rf = reduce(vcat, T0[i] .+ times(seq.RF[1,i], :A) for i in range)
t_Δf = reduce(vcat, T0[i] .+ times(seq.RF[1,i], :Δf) for i in range)
A_rf = reduce(vcat, ampls(seq.RF[1,i]; freq_in_phase) for i in range)
A_Δf = reduce(vcat, freqs(seq.RF[1,i]) for i in range)
t_rf = reduce(vcat, [T0[i] .+ times(seq.RF[1,i], :A) for i in range])
t_Δf = reduce(vcat, [T0[i] .+ times(seq.RF[1,i], :Δf) for i in range])
A_rf = reduce(vcat, [ampls(seq.RF[1,i]; freq_in_phase) for i in range])
A_Δf = reduce(vcat, [freqs(seq.RF[1,i]) for i in range])
rf_samples = (
rf = fill_if_empty((t = t_rf, A = A_rf)),
Δf = fill_if_empty((t = t_Δf, A = A_Δf))
)
end
# Gradients
if :gr in events
t_gx = reduce(vcat, T0[i] .+ times(seq.GR[1,i]) for i in range)
t_gy = reduce(vcat, T0[i] .+ times(seq.GR[2,i]) for i in range)
t_gz = reduce(vcat, T0[i] .+ times(seq.GR[3,i]) for i in range)
A_gx = reduce(vcat, ampls(seq.GR[1,i]) for i in range)
A_gy = reduce(vcat, ampls(seq.GR[2,i]) for i in range)
A_gz = reduce(vcat, ampls(seq.GR[3,i]) for i in range)
t_gx = reduce(vcat, [T0[i] .+ times(seq.GR[1,i]) for i in range])
t_gy = reduce(vcat, [T0[i] .+ times(seq.GR[2,i]) for i in range])
t_gz = reduce(vcat, [T0[i] .+ times(seq.GR[3,i]) for i in range])
A_gx = reduce(vcat, [ampls(seq.GR[1,i]) for i in range])
A_gy = reduce(vcat, [ampls(seq.GR[2,i]) for i in range])
A_gz = reduce(vcat, [ampls(seq.GR[3,i]) for i in range])
gr_samples = (
gx = fill_if_empty((t = t_gx, A = A_gx)),
gy = fill_if_empty((t = t_gy, A = A_gy)),
Expand All @@ -339,8 +339,8 @@ function get_samples(seq::Sequence, range; events=[:rf, :gr, :adc], freq_in_phas
end
# ADC
if :adc in events
t_aq = reduce(vcat, T0[i] .+ times(seq.ADC[i]) for i in range)
A_aq = reduce(vcat, ampls(seq.ADC[i]) for i in range)
t_aq = reduce(vcat, [T0[i] .+ times(seq.ADC[i]) for i in range])
A_aq = reduce(vcat, [ampls(seq.ADC[i]) for i in range])
adc_samples = (
adc = fill_if_empty((t = t_aq, A = A_aq)),
)
Expand Down

0 comments on commit 61cad11

Please sign in to comment.