Skip to content
Snippets Groups Projects
Verified Commit 8e2d0c38 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Remove dependency on linA

parent 34efb0cd
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,6 @@ version = "0.0.0" ...@@ -7,7 +7,6 @@ version = "0.0.0"
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9" Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572" JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Juniper = "2ddba703-00a4-53a7-87a5-e8b9971dde84" Juniper = "2ddba703-00a4-53a7-87a5-e8b9971dde84"
LinA = "f599c993-2677-4f60-8998-71feb0f665db"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MakieCore = "20f20a25-4f0e-4fdf-b5d1-57303727442b" MakieCore = "20f20a25-4f0e-4fdf-b5d1-57303727442b"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45" Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
......
...@@ -40,8 +40,6 @@ abstract type ReadoutComponent <: EventComponent end ...@@ -40,8 +40,6 @@ abstract type ReadoutComponent <: EventComponent end
split_times(component, t1, t2, precision) split_times(component, t1, t2, precision)
Indicates at what timepoints a given [`BaseComponent`](@ref) should be split during linearisation to achieve the given precision. Indicates at what timepoints a given [`BaseComponent`](@ref) should be split during linearisation to achieve the given precision.
For non-linear components this will use [`LinA.jl`](https://github.com/LICO-labs/LinA.jl) under the hood.
""" """
function split_times end function split_times end
......
module SincPulses module SincPulses
import JuMP: @constraint import JuMP: @constraint
import QuadGK: quadgk import QuadGK: quadgk
import LinA
import ....BuildSequences: global_model import ....BuildSequences: global_model
import ....Variables: duration, amplitude, effective_time, flip_angle, phase, inverse_bandwidth, VariableType, set_simple_constraints!, frequency, make_generic, get_free_variable import ....Variables: duration, amplitude, effective_time, flip_angle, phase, inverse_bandwidth, VariableType, set_simple_constraints!, frequency, make_generic, get_free_variable
import ...AbstractTypes: RFPulseComponent, split_times import ...AbstractTypes: RFPulseComponent, split_times
...@@ -103,11 +102,10 @@ function make_generic(block::SincPulse) ...@@ -103,11 +102,10 @@ function make_generic(block::SincPulse)
end end
function split_times(block::SincPulse, t1, t2, precision) function split_times(block::SincPulse, t1, t2, precision)
real_amplitude_precision = precision * amplitude(block) max_second_derivative = π^2/3 * (amplitude(block) / lobe_duration(block))^2
pwl = LinA.Linearize(t -> amplitude(block, t), t1, t2, LinA.Absolute(real_amplitude_precision)) step_size = sqrt(2 * precision / max_second_derivative)
times = [part.xMin for part in pwl] npoints = Int(div(t2 - t1, step_size, RoundUp))
push!(times, t2) return range(t1, t2, length=npoints)
return times
end end
end end
\ No newline at end of file
module Linearise module Linearise
import LinA
import StaticArrays: SVector import StaticArrays: SVector
import ...Components: GradientWaveform, split_times import ...Components: GradientWaveform, split_times
import ...Variables: amplitude, phase, gradient_strength3, duration import ...Variables: amplitude, phase, gradient_strength3, duration
......
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