diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b7114a9..82c5302 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -19,8 +19,7 @@ jobs: matrix: version: - '1.7' - - '1.8' - - '1.9' + - '1.10' os: - ubuntu-latest arch: diff --git a/Project.toml b/Project.toml index 3ff781a..103de40 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "QuantitativeSusceptibilityMappingTGV" uuid = "bd393529-335a-4aed-902f-5de61cc7ff49" authors = ["Korbinian Eckstein korbinian90@gmail.com"] -version = "0.5.0" +version = "0.5.1" [deps] FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" diff --git a/src/oblique_stencil.jl b/src/oblique_stencil.jl index 741c8b7..b564b01 100644 --- a/src/oblique_stencil.jl +++ b/src/oblique_stencil.jl @@ -11,6 +11,10 @@ function dipole(x, y, z, r_treshold, direction=(0, 0, 1)) end function stencil(; st=27, res=(1.0, 1.0, 1.0), singularity_cutout=4, direction=(0, 0, 1), gridsize=(64, 64, 64)) + if any(res .== 0) || all(direction .== 0) || any(gridsize .== 0) + error("Please check the input parameters to the stencil computation. res $res, gridsize $gridsize and direction $direction must not be: any(res .== 0) || all(direction .== 0) || any(gridsize .== 0)") + end + middle = floor.(Int, gridsize ./ 2) .+ 1 coord = [((1:gridsize[i]) .- middle[i]) for i in 1:3] diff --git a/test/runtests.jl b/test/runtests.jl index 73566d4..a8fec10 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -52,6 +52,13 @@ end @test chi_3 != chi_romeo end +@testitem "Stencil wrong settings Error" begin + @test_throws ErrorException stencil(; res=(3,2,0)) + @test_throws ErrorException stencil(; direction=(0,0,0)) + @test_throws ErrorException stencil(; gridsize=(64,64,0)) + @test stencil() isa Array +end + @testitem "Aqua" begin using Aqua Aqua.test_ambiguities(QuantitativeSusceptibilityMappingTGV)