diff --git a/Manifest.toml b/Manifest.toml index 21b502b..d745cbf 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.9.3" manifest_format = "2.0" -project_hash = "8cbb223fb1bc13003cdac808c2a640bd859706d1" +project_hash = "38777d06b992a33542bab2fcfaa3bece835c0dbf" [[deps.Adapt]] deps = ["LinearAlgebra", "Requires"] diff --git a/Project.toml b/Project.toml index cff0c88..7201416 100755 --- a/Project.toml +++ b/Project.toml @@ -11,21 +11,13 @@ NPZ = "15e1cf62-19b3-5cfa-8e77-841668bca605" NumericalIntegration = "e7bfaba1-d571-5449-8927-abc22e82249b" PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d" QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc" -Requires = "ae029012-a4dd-5104-9daa-d747884805df" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -[extensions] -BoltExt = "Bolt" - [compat] -Statistics = "1.7, 1.8, 1.9" -QuadGK = "2.9" Interpolations = "0.14.7" -NumericalIntegration = "0.2.0, 0.3.0" -Requires = "1.3" NPZ = "0.4" +NumericalIntegration = "0.2.0, 0.3.0" PythonCall = "0.9" +QuadGK = "2.9" +Statistics = "1.7, 1.8, 1.9" julia = "1.9" - -[extras] -Bolt = "d94d39b4-3f51-4e5a-bfd8-f3b08e8f2b62" diff --git a/ext/BoltExt.jl b/ext/BoltExt.jl deleted file mode 100644 index 6263802..0000000 --- a/ext/BoltExt.jl +++ /dev/null @@ -1,31 +0,0 @@ -module BoltExt - -if isdefined(Base, :get_extension) - using Bolt -else - using ..Bolt -end - -function lin_Pk0(mode::Val{:Bolt}, cpar::CosmoPar, settings::Settings) - 𝕡 = Bolt.CosmoParams(h = cpar.h, - Ω_r = cpar.Ωg, - Ω_b = cpar.Ωb, - Ω_c = cpar.Ωc, - A = cpar.As, - n = cpar.ns, - Y_p = cpar.Y_p, - N_ν = cpar.N_ν, - Σm_ν = cpar.Σm_ν) - bg = Background(𝕡) - 𝕣 = Bolt.RECFAST(bg; Yp=𝕡.Y_p, OmegaB=𝕡.Ω_b,OmegaG=𝕡.Ω_r) - ih = IonizationHistory(𝕣, 𝕡, bg) - ks_Bolt = LinRange(-4, 2, settings.nk) - ks_Bolt = 10 .^(k_grid) - pk0_Bolt = [plin(k,𝕡,bg,ih) for k in ks_Bolt] - pki_Bolt = linear_interpolation(ks_Bolt, log.(pk0_Bolt); - extrapolation_bc=Line()) - pk0 = exp.(pki_Bolt(settings.ks)) - return pk0 -end - -end # module \ No newline at end of file diff --git a/src/LimberJack.jl b/src/LimberJack.jl index 8125be6..5097558 100755 --- a/src/LimberJack.jl +++ b/src/LimberJack.jl @@ -22,19 +22,9 @@ include("theory.jl") # c/(100 km/s/Mpc) in Mpc const CLIGHT_HMPC = 2997.92458 -if !isdefined(Base, :get_extension) - using Requires -end - function __init__() emupk_files = npzread(joinpath(artifact"emupk", "emupk.npz")) global emulator = Emulator(emupk_files) - - @static if !isdefined(Base, :get_extension) - @require Bolt = "d94d39b4-3f51-4e5a-bfd8-f3b08e8f2b62" begin - include("../ext/BoltExt.jl") - end - end end end # module diff --git a/src/boltzmann.jl b/src/boltzmann.jl index fcfd5ea..f6b774b 100644 --- a/src/boltzmann.jl +++ b/src/boltzmann.jl @@ -127,8 +127,15 @@ function lin_Pk0(mode::Val{:EisHu}, cpar::CosmoPar, settings::Settings) return pk0 end -lin_Pk0(mode::Symbol, cpar::CosmoPar, settings::Settings) = lin_Pk0(Val(mode), cpar, settings) -lin_Pk0(@nospecialize(mode), cpar::CosmoPar, settings::Settings) = error("Tk mode $(typeof(i)) not supported.") +function lin_Pk0(mode::Val{:Custom}, cpar::CosmoPar, settings::Settings; kwargs...) + ks_c, pk_c = kwargs[:pk_custom] + pki_c = cubic_spline_interpolation(ks_c, Pk_c, extrapolation_bc=Line()) + pk0 = pki_c(settings.ks) + return pk0 +end + +lin_Pk0(mode::Symbol, cpar::CosmoPar, settings::Settings; kwargs...) = lin_Pk0(Val(mode), cpar, settings; kwargs...) +lin_Pk0(@nospecialize(mode), cpar::CosmoPar, settings::Settings; kwargs...) = error("Tk mode $(typeof(i)) not supported.") function _get_kernel(arr1, arr2, hyper) arr1_w = @.(arr1/exp(hyper[2:6])) diff --git a/src/core.jl b/src/core.jl index b8788ea..912f0ff 100755 --- a/src/core.jl +++ b/src/core.jl @@ -249,7 +249,7 @@ Cosmology(cpar::CosmoPar, settings::Settings; kwargs...) = begin logk, nk = settings.logk, settings.nk ks = settings.ks dlogk = settings.dlogk - pk0, pki = lin_Pk0(cpar, settings) + pk0, pki = lin_Pk0(cpar, settings; kwargs...) # Compute redshift-distance relation norm = CLIGHT_HMPC / cpar.h chis = zeros(cosmo_type, nz_chi) diff --git a/test/runtests.jl b/test/runtests.jl index 6f285be..7b734f8 100755 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -8,10 +8,12 @@ test_main=true if test_main println("testing main functions") end +#= test_Bolt = false if test_Bolt println("testing Bolt.jl") -end +end +=# extensive= false if extensive println("extensive") @@ -769,6 +771,7 @@ if test_main end end +#= if test_Bolt Bolt_test_output = Dict{String}{Vector}() @@ -832,4 +835,5 @@ if test_Bolt end end end +=#