diff --git a/src/components/pulses/constant_pulses.jl b/src/components/pulses/constant_pulses.jl index 4af0975b9a971518613cca9f58640c6dee312305..cf6f2f507efda7526736c1059e2e21affe607a36 100644 --- a/src/components/pulses/constant_pulses.jl +++ b/src/components/pulses/constant_pulses.jl @@ -1,7 +1,7 @@ module ConstantPulses import JuMP: @constraint import ...AbstractTypes: RFPulseComponent, split_timestep -import ....Variables: VariableType, set_simple_constraints!, make_generic, get_free_variable, adjust_internal, variables, @defvar, apply_simple_constraint! +import ....Variables: VariableType, set_simple_constraints!, make_generic, get_free_variable, adjust_internal, variables, @defvar, apply_simple_constraint!, add_cost_function! import ..GenericPulses: GenericPulse """ @@ -34,6 +34,7 @@ function ConstantPulse(; amplitude=nothing, duration=nothing, phase=nothing, fre ) apply_simple_constraint!(res.amplitude, :>=, 0) set_simple_constraints!(res, kwargs) + add_cost_function!(res.frequency^2 + res.phase^2) return res end diff --git a/src/components/pulses/instant_pulses.jl b/src/components/pulses/instant_pulses.jl index 25296687c3a72446d8212e341e000770cd995d11..546cab90419ea85bccc6cce453984b39371c3f4b 100644 --- a/src/components/pulses/instant_pulses.jl +++ b/src/components/pulses/instant_pulses.jl @@ -28,6 +28,7 @@ function InstantPulse(; flip_angle=nothing, phase=nothing, group=nothing) group ) apply_simple_constraint!(res.flip_angle, :>=, 0) + add_cost_function!(res.phase^2) return res end diff --git a/src/components/pulses/sinc_pulses.jl b/src/components/pulses/sinc_pulses.jl index b445ef137ef6ff3c6e88faa30fd6f67c34b56d0f..1ff06a8312c24c282a92bda8efb60f8d2a0e74e4 100644 --- a/src/components/pulses/sinc_pulses.jl +++ b/src/components/pulses/sinc_pulses.jl @@ -55,6 +55,7 @@ function SincPulse(; apply_simple_constraint!(res.lobe_duration, :>=, 0) end set_simple_constraints!(res, kwargs) + add_cost_function!(res.frequency^2 + res.phase^2) return res end