diff --git a/.github/workflows/Downgrade.yml b/.github/workflows/Downgrade.yml new file mode 100644 index 00000000..6f793a2f --- /dev/null +++ b/.github/workflows/Downgrade.yml @@ -0,0 +1,33 @@ +name: Downgrade +on: + pull_request: + branches: + - main + - dev + paths-ignore: + - 'docs/**' + push: + branches: + - main + - dev + paths-ignore: + - 'docs/**' +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + version: ['1.10', '1', 'pre'] + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + - name: Add LegendJuliaRegistry + run: julia -e 'using Pkg; Pkg.Registry.add("General"); Pkg.Registry.add(Pkg.RegistrySpec(url = "https://github.com/legend-exp/LegendJuliaRegistry"))' + shell: bash + - uses: julia-actions/julia-downgrade-compat@v1 + with: + skip: Pkg,TOML + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 \ No newline at end of file diff --git a/Project.toml b/Project.toml index cbb6c534..2e3185c5 100644 --- a/Project.toml +++ b/Project.toml @@ -53,44 +53,44 @@ LegendSpecFitsRecipesBaseExt = ["RecipesBase", "Plots"] [compat] ArgCheck = "1, 2" -ArraysOfArrays = "0.6" -BAT = "3" -ChangesOfVariables = "0.1.1" +ArraysOfArrays = "0.5, 0.6" +BAT = "3.1" +ChangesOfVariables = "0.1.3" DensityInterface = "0.4" -Distributions = "0.24, 0.25" -FillArrays = "0.7, 0.8, 0.9, 0.10, 0.11, 0.12, 0.13, 1" +Distributions = "0.25.87" +FillArrays = "1.4.1" Format = "1.2, 1.3" -ForwardDiff = "0.10" +ForwardDiff = "0.10.26" GaussianMixtures = "0.3.11" IntervalSets = "0.7" -InverseFunctions = "0.1" -IrrationalConstants = "0.1, 0.2" -KernelDensity = "0.5, 0.6" +InverseFunctions = "0.1.8" +IrrationalConstants = "0.1.1, 0.2" +KernelDensity = "0.6.4" LaTeXStrings = "1.3" -LogExpFunctions = "0.3" -LinearAlgebra = "1" +LogExpFunctions = "0.3.16" +LinearAlgebra = "<0.0.1, 1" LinearRegression = "0.2" LsqFit = "0.14, 0.15" -Measurements = "2" +Measurements = "2.5" Measures = "0.3" -Optim = "1" -Optimization = "3, 4" -OptimizationBBO = "0.3" -OptimizationNLopt = "0.2" -OptimizationOptimJL = "0.3" +Optim = "1.7.5" +Optimization = "3.25, 4" +OptimizationBBO = "0.3, 0.4" +OptimizationNLopt = "0.2, 0.3" +OptimizationOptimJL = "0.3, 0.4" Plots = "1" PropDicts = "0.2" RadiationSpectra = "0.5.12" -Random = "1" -RecipesBase = "1" +Random = "<0.0.1, 1" +RecipesBase = "1.3.4" Roots = "2" SnoopPrecompile = "1" -SpecialFunctions = "0.10, 1, 2" -Statistics = "1" -StatsBase = "0.32, 0.33, 0.34" -StructArrays = "0.4, 0.5, 0.6, 0.7" -Tables = "0.2, 1.0" -TypedTables = "1" -Unitful = "1" -ValueShapes = "0.10.1, 0.11" +SpecialFunctions = "2.1.4" +Statistics = "<0.0.1, 1" +StatsBase = "0.33.7, 0.34" +StructArrays = "0.6.17, 0.7" +Tables = "1.11" +TypedTables = "1.2" +Unitful = "1.6" +ValueShapes = "0.10.13, 0.11" julia = "1.10" diff --git a/test/Project.toml b/test/Project.toml index 18d256ba..af9e9b93 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -10,10 +10,10 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [compat] -Distributions = "0.24, 0.25" +Distributions = "0.25" Documenter = "1" -Interpolations = "0.15" +Interpolations = "0.13, 0.14, 0.15" LegendDataTypes = "0.1" Measurements = "2" -StatsBase = "0.32, 0.33, 0.34" +StatsBase = "0.33, 0.34" Unitful = "1" \ No newline at end of file diff --git a/test/test_utils.jl b/test/test_utils.jl index cd918bb2..5c909143 100644 --- a/test/test_utils.jl +++ b/test/test_utils.jl @@ -1,5 +1,9 @@ # This file is a part of LegendSpecFits.jl, licensed under the MIT License (MIT). +using Interpolations: Throw, extrapolate, interpolate, Gridded, Linear +_linear_interpolation(range::AbstractVector, vs::AbstractVector; extrapolation_bc = Throw()) = + extrapolate(interpolate((range, ), vs, Gridded(Linear())), extrapolation_bc) + """ generate_mc_spectrum(n_tot::Int=200000,; f_fit::Base.Callable=th228_fit_functions.f_fit) Sample Legend200 calibration data based on "Inverse Transform Sampling" method @@ -53,7 +57,7 @@ function generate_mc_spectrum(n_tot::Int=200000,; f_fit::Base.Callable=LegendSpe for i=1:length(th228_lines) bandwidth = maximum(model_cdf_all[i])-minimum(model_cdf_all[i]) rand_i = minimum(model_cdf_all[i]).+bandwidth.*rand(n_i[i]); # make sure sample is within model range - interp_cdf_inv = linear_interpolation(model_cdf_all[i], bin_centers_all[i]) # inverse cdf + interp_cdf_inv = _linear_interpolation(model_cdf_all[i], bin_centers_all[i]) # inverse cdf energy_mc_all[i] = interp_cdf_inv.(rand_i) end