From 381962b0c1d074716b8a0093c64b4c7d7da56028 Mon Sep 17 00:00:00 2001 From: Michiel Cottaar <michiel.cottaar@ndcn.ox.ac.uk> Date: Mon, 29 Jan 2024 14:30:54 +0000 Subject: [PATCH] Fixed syntax errors --- src/gradients/fixed_gradients.jl | 2 +- src/gradients/pulsed_gradients.jl | 8 ++++---- src/gradients/slice_selects.jl | 3 ++- src/variables.jl | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gradients/fixed_gradients.jl b/src/gradients/fixed_gradients.jl index e4d3ad0..b5e79ef 100644 --- a/src/gradients/fixed_gradients.jl +++ b/src/gradients/fixed_gradients.jl @@ -37,7 +37,7 @@ struct FixedGradient <: GradientBlock end get_children_indices(fg::FixedGradient) = 1:(length(fg.time)-1) -Base.get_index(fg::FixedGradient, index::Int) = FixedChangingGradientBlock( +Base.getindex(fg::FixedGradient, index::Int) = FixedChangingGradientBlock( fg.gradient_strength[index], fg.gradient_strength[index + 1], fg.times[index + 1] - fg.times[index], diff --git a/src/gradients/pulsed_gradients.jl b/src/gradients/pulsed_gradients.jl index 6b4de10..fca1d38 100644 --- a/src/gradients/pulsed_gradients.jl +++ b/src/gradients/pulsed_gradients.jl @@ -105,10 +105,10 @@ slew_rate(g::PulsedGradient) = isnothing(g.scaling) ? maximum(slew_rate_vec(g)) duration(g::PulsedGradient) = 2 * rise_time(g) + flat_time(g) get_children_indices(::PulsedGradient) = (:rise, :flat, :fall) -Base.get_index(pg::PulsedGradient, symbol::Symbol) = pg[Val(symbol)] -Base.get_index(pg::PulsedGradient, ::Val{:rise}) = pg.rise -Base.get_index(pg::PulsedGradient, ::Val{:flat}) = pg.flat -Base.get_index(pg::PulsedGradient, ::Val{:fall}) = pg.fall +Base.getindex(pg::PulsedGradient, symbol::Symbol) = pg[Val(symbol)] +Base.getindex(pg::PulsedGradient, ::Val{:rise}) = pg.rise +Base.getindex(pg::PulsedGradient, ::Val{:flat}) = pg.flat +Base.getindex(pg::PulsedGradient, ::Val{:fall}) = pg.fall variables(::Type{<:PulsedGradient}) = [qval, δ, gradient_strength_vec, duration, rise_time, flat_time] diff --git a/src/gradients/slice_selects.jl b/src/gradients/slice_selects.jl index 0a30e73..e191e7c 100644 --- a/src/gradients/slice_selects.jl +++ b/src/gradients/slice_selects.jl @@ -1,5 +1,6 @@ module SliceSelects import JuMP: Model +import StaticArrays: SVector import ...BuildingBlocks: RFPulseBlock, ContainerBlock, get_children_indices import ...Variables: VariableType, slice_thickness, get_free_variable, effective_time, start_time, qvec, bmat, qval, bval import ...Variables: flip_angle, amplitude, phase, frequency, bandwidth, inverse_bandwidth, N_left, N_right @@ -48,7 +49,7 @@ end get_children_indices(::SliceSelect) = (:flat_before, :pulse, :flat_after) -Base.get_index(select::SliceSelect, index::Symbol) = getproperty(select, index) +Base.getindex(select::SliceSelect, index::Symbol) = getproperty(select, index) start_time(select::SliceSelect, symbol::Symbol) = start_time(select, Val(symbol)) start_time(select::SliceSelect, ::Val{:flat_before}) = 0. diff --git a/src/variables.jl b/src/variables.jl index e8d0180..576f627 100644 --- a/src/variables.jl +++ b/src/variables.jl @@ -16,7 +16,7 @@ all_variables_symbols = [ :inverse_bandwidth => (:pulse, "Inverse of the [`bandwidth`](@ref) of the RF pulse in ms"), :N_left => (:pulse, "The number of zero crossings of the RF pulse before the main peak"), :N_right => (:pulse, "The number of zero crossings of the RF pulse after the main peak"), - :slice_thickness => (:pulse, "Slice thickness of an RF pulse that is active during a gradient.") + :slice_thickness => (:pulse, "Slice thickness of an RF pulse that is active during a gradient."), # gradients :qvec => (:gradient, "The spatial range and orientation on which the displacements can be detected due to this gradient in 1/um (equivalent to [`area_under_curve_vec`](@ref))"), -- GitLab