Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add latest v1 Julia to CI matrix #366

Merged
merged 7 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
strategy:
fail-fast: false
matrix:
julia-version: ['1.9']
julia-version: ['1.9', '1']
julia-arch: [x64]
os: [ubuntu-latest, windows-latest, macos-latest]
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
Expand Down
1 change: 1 addition & 0 deletions test/test_fields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ using Luna
import FFTW
import Statistics: mean, std
import Random: MersenneTwister
import Luna: Hankel

# note that most of the Fields.jl code is tested in many other modules

Expand Down
16 changes: 8 additions & 8 deletions test/test_maths.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Test: @test, @testset, @test_throws, @test_broken
import Luna: Maths, Grid, Fields
import Dierckx
import HCubature: hquadrature
import Luna.Maths: Dierckx
import Luna.Modes: hquadrature
import Random: seed!
import FFTW

Expand Down Expand Up @@ -210,7 +210,7 @@ end
x = range(0.0, 2π, length=100)
y = sin.(x)
spl = Maths.BSpline(x, y)
@test all(abs.(spl.(x) .- y) .< 3e-16)
@test all(abs.(spl.(x) .- y) .< 3.5e-16)
x2 = range(0.0, 2π, length=300)
@test maximum(spl.(x2) - sin.(x2)) < 5e-8
# these use the actual spline derivative
Expand All @@ -234,7 +234,7 @@ end
@test abs(Maths.derivative(splc, 1.3, 1) - complex(cos(1.3), cos(1.3 + π/6))) < 2.5e-7
@test abs(Maths.derivative(splc, 1.3, 2) - complex(-sin(1.3), -sin(1.3 + π/6))) < 2.5e-3
# test Julia evaluation vs original Dierckx
@test all(spl.(x2) .== spl.rspl.(x2))
@test all(spl.(x2) . spl.rspl.(x2))
# test full spline Derivatives
spl1 = Maths.differentiate_spline(spl, 1)
@test maximum(abs.(cos.(x2) .- spl1.(x2))) < 5.1e-6
Expand Down Expand Up @@ -266,19 +266,19 @@ end
@testset "randgauss" begin
import Statistics: std, mean
seed!(1234)
x = Maths.randgauss(1, 0.5, 1000000)
x = Maths.randgauss(1, 0.5, 10000000)
@test isapprox(std(x), 0.5, rtol=1e-3)
@test isapprox(mean(x), 1, rtol=1e-3)
seed!(1234)
x = Maths.randgauss(10, 0.1, 1000000)
x = Maths.randgauss(10, 0.1, 10000000)
@test isapprox(std(x), 0.1, rtol=1e-3)
@test isapprox(mean(x), 10, rtol=1e-3)
seed!(1234)
x = Maths.randgauss(-1, 0.5, 1000000)
x = Maths.randgauss(-1, 0.5, 10000000)
@test isapprox(std(x), 0.5, rtol=1e-3)
@test isapprox(mean(x), -1, rtol=1e-3)
seed!(1234)
x = Maths.randgauss(1, 0.5, (1000, 1000))
x = Maths.randgauss(1, 0.5, (10000, 10000))
@test isapprox(std(x), 0.5, rtol=1e-3)
@test isapprox(mean(x), 1, rtol=1e-3)
end
Expand Down
16 changes: 10 additions & 6 deletions test/test_scans.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Test: @test, @testset, @test_throws
using Luna
import HDF5
using Distributed
import Logging: with_logger, NullLogger

@testset "Chunking" begin
function contains_all_unique(chunks, x)
Expand Down Expand Up @@ -170,23 +171,26 @@ if ~Sys.iswindows()
end
rmprocs(ps)
end

##
@testset "multi-process queue scan with error" begin
ps = addprocs(2)
@everywhere using Luna
@everywhere import Logging: with_logger, NullLogger
# do it again but with one process giving an error
scanname = "scantest_queue_multiproc_err"
function worker_err()
energies = collect(range(5e-6, 20e-6; length=16))
scan = Scan(scanname, Scans.QueueExec(); energy=energies)
idcs_run = Int[]
runscan(scan) do scanidx, energy
prop_capillary(125e-6, 3, :He, 0.8; λ0=800e-9, τfwhm=10e-15, energy=energy,
trange=400e-15, λlims=(200e-9, 4e-6))
if scanidx == 16
error("This exception is expected as part of the test suite")
with_logger(NullLogger()) do
prop_capillary(125e-6, 3, :He, 0.8; λ0=800e-9, τfwhm=10e-15, energy=energy,
trange=400e-15, λlims=(200e-9, 4e-6))
if scanidx == 16
error("This exception is expected as part of the test suite")
end
push!(idcs_run, scanidx)
end
push!(idcs_run, scanidx)
end
idcs_run
end
Expand Down
Loading