From d70b7a9a892274e95f27eb6d7edd4976e16c6003 Mon Sep 17 00:00:00 2001 From: michael-petersen Date: Wed, 19 Jun 2024 13:46:53 -0700 Subject: [PATCH] Add guard for frequency scale --- src/Utils/ParameterStructure.jl | 2 +- src/Xi.jl | 11 +++++++++++ test/runtests.jl | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Utils/ParameterStructure.jl b/src/Utils/ParameterStructure.jl index 2a1c446..9b3d80e 100644 --- a/src/Utils/ParameterStructure.jl +++ b/src/Utils/ParameterStructure.jl @@ -4,7 +4,7 @@ TODO: """ -struct LinearParameters +mutable struct LinearParameters # Orbital Elements parameters Orbitalparams::OrbitalElements.OrbitalParameters diff --git a/src/Xi.jl b/src/Xi.jl index c96175d..281a943 100644 --- a/src/Xi.jl +++ b/src/Xi.jl @@ -144,6 +144,17 @@ function RunLinearResponse(model::OrbitalElements.Potential, FHT::FiniteHilbertTransform.AbstractFHT, basis::AstroBasis.AbstractAstroBasis, params::LinearParameters) + + # Check model against provided parameters + #OrbitalElements.frequency_scale(model) + + # Check if frequency scale is set by the model already + Ω₀tmp = frequency_scale(model) + + if Ω₀tmp != params.Ω₀ + params.Ω₀ = Ω₀tmp + println("Overriding Ω₀ with model-set value.") + end # call the function to construct W matrices RunWmat(model,FHT,basis,params) diff --git a/test/runtests.jl b/test/runtests.jl index c39a465..97c21fd 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -79,7 +79,8 @@ OEparams = OrbitalElements.OrbitalParameters(EDGE=OrbitalElements.DEFAULT_EDGE,T ITERMAX=OrbitalElements.DEFAULT_ITERMAX,invε=OrbitalElements.DEFAULT_TOL) -Parameters = LinearResponse.LinearParameters(basis,Orbitalparams=OEparams,Ω₀=OrbitalElements.frequency_scale(model),Ku=Ku,Kv=Kv,Kw=Kw, +#Parameters = LinearResponse.LinearParameters(basis,Orbitalparams=OEparams,Ω₀=OrbitalElements.frequency_scale(model),Ku=Ku,Kv=Kv,Kw=Kw, +Parameters = LinearResponse.LinearParameters(basis,Orbitalparams=OEparams,Ω₀=15.,Ku=Ku,Kv=Kv,Kw=Kw, modelname=modelname,dfname=dfname, wmatdir=wmatdir,gfuncdir=gfuncdir,modedir=modedir,axidir=modedir, lharmonic=lharmonic,n1max=n1max,