diff --git a/src/pulses/constant_pulses.jl b/src/pulses/constant_pulses.jl index c6e8b83e6ce568bc25139f530448a2353177f0c4..dc8bbb7ebab94e3cef0641f9035a91e3c4991c14 100644 --- a/src/pulses/constant_pulses.jl +++ b/src/pulses/constant_pulses.jl @@ -23,14 +23,17 @@ struct ConstantPulse <: RFPulseBlock duration :: VariableType phase :: VariableType frequency :: VariableType + scale :: Union{Nothing, Symbol} end @global_model_constructor ConstantPulse -function ConstantPulse(model::Model; amplitude=nothing, duration=nothing, phase=nothing, frequency=nothing, kwargs...) +function ConstantPulse(model::Model; amplitude=nothing, duration=nothing, phase=nothing, frequency=nothing, scale=nothing, kwargs...) res = ConstantPulse( model, - [get_free_variable(model, value) for value in (amplitude, duration, phase, frequency)]... + [get_free_variable(model, value) for value in (amplitude, duration, phase, frequency)]..., + scale + ) @constraint model res.amplitude >= 0 set_simple_constraints!(model, res, kwargs) diff --git a/src/pulses/instant_pulses.jl b/src/pulses/instant_pulses.jl index 98f6825ec6684f62f6191202f9d86958ed3cb849..fb49d0e8e0f61a441230ab9a06e0875e39234326 100644 --- a/src/pulses/instant_pulses.jl +++ b/src/pulses/instant_pulses.jl @@ -9,15 +9,17 @@ struct InstantRFPulseBlock <: RFPulseBlock model :: Model flip_angle :: VariableType phase :: VariableType + scale :: Union{Nothing, Symbol} end @global_model_constructor InstantRFPulseBlock -function InstantRFPulseBlock(model::Model; flip_angle=nothing, phase=nothing) +function InstantRFPulseBlock(model::Model; flip_angle=nothing, phase=nothing, scale=nothing) res = InstantRFPulseBlock( model, get_free_variable(model, flip_angle), - get_free_variable(model, phase) + get_free_variable(model, phase), + scale ) @constraint model res.flip_angle >= 0 return res diff --git a/src/pulses/sinc_pulses.jl b/src/pulses/sinc_pulses.jl index b6d8e9f18f6b8a788cd842cab2f9e80b5cff5b3d..ecdcfe89b5e9ca602bb818931979e6cc25dc0e72 100644 --- a/src/pulses/sinc_pulses.jl +++ b/src/pulses/sinc_pulses.jl @@ -39,13 +39,14 @@ struct SincPulse <: RFPulseBlock phase :: VariableType frequency :: VariableType lobe_duration :: VariableType + scale :: Union{Nothing, Symbol} end @global_model_constructor SincPulse function SincPulse(model::Model; symmetric=true, max_Nlobes=nothing, apodise=true, N_lobes=nothing, N_left=nothing, N_right=nothing, - amplitude=nothing, phase=nothing, frequency=nothing, lobe_duration=nothing, kwargs... + amplitude=nothing, phase=nothing, frequency=nothing, lobe_duration=nothing, scale=nothing, kwargs... ) if symmetric N_lobes = get_free_variable(model, N_lobes) @@ -63,7 +64,8 @@ function SincPulse(model::Model; nlobe_integral_params(max_Nlobes, apodise), N_left_var, N_right_var, - [get_free_variable(model, value) for value in (amplitude, phase, frequency, lobe_duration)]... + [get_free_variable(model, value) for value in (amplitude, phase, frequency, lobe_duration)]..., + scale ) @constraint model res.amplitude >= 0 @constraint model res.N_left >= 1