Skip to content
Snippets Groups Projects
Unverified Commit ab0bfbc2 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Set secondary cost to drive pulse phase and frequency to zero

parent 98609662
No related tags found
No related merge requests found
Pipeline #24990 failed
module ConstantPulses module ConstantPulses
import JuMP: @constraint import JuMP: @constraint
import ...AbstractTypes: RFPulseComponent, split_timestep 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 import ..GenericPulses: GenericPulse
""" """
...@@ -34,6 +34,7 @@ function ConstantPulse(; amplitude=nothing, duration=nothing, phase=nothing, fre ...@@ -34,6 +34,7 @@ function ConstantPulse(; amplitude=nothing, duration=nothing, phase=nothing, fre
) )
apply_simple_constraint!(res.amplitude, :>=, 0) apply_simple_constraint!(res.amplitude, :>=, 0)
set_simple_constraints!(res, kwargs) set_simple_constraints!(res, kwargs)
add_cost_function!(res.frequency^2 + res.phase^2)
return res return res
end end
......
...@@ -28,6 +28,7 @@ function InstantPulse(; flip_angle=nothing, phase=nothing, group=nothing) ...@@ -28,6 +28,7 @@ function InstantPulse(; flip_angle=nothing, phase=nothing, group=nothing)
group group
) )
apply_simple_constraint!(res.flip_angle, :>=, 0) apply_simple_constraint!(res.flip_angle, :>=, 0)
add_cost_function!(res.phase^2)
return res return res
end end
......
...@@ -55,6 +55,7 @@ function SincPulse(; ...@@ -55,6 +55,7 @@ function SincPulse(;
apply_simple_constraint!(res.lobe_duration, :>=, 0) apply_simple_constraint!(res.lobe_duration, :>=, 0)
end end
set_simple_constraints!(res, kwargs) set_simple_constraints!(res, kwargs)
add_cost_function!(res.frequency^2 + res.phase^2)
return res return res
end end
......
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