diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml index 98d5bc0..e4ee926 100644 --- a/.github/workflows/CompatHelper.yml +++ b/.github/workflows/CompatHelper.yml @@ -4,11 +4,23 @@ on: schedule: - cron: 0 0 * * 0 # weekly workflow_dispatch: - +permissions: + contents: write + pull-requests: write jobs: CompatHelper: runs-on: ubuntu-latest steps: + - name: Check if Julia is already available in the PATH + id: julia_in_path + run: which julia + continue-on-error: true + - name: Install Julia, but only if it is not already available in the PATH + uses: julia-actions/setup-julia@latest + with: + version: '1' + # arch: ${{ runner.arch }} + if: steps.julia_in_path.outcome != 'success' - name: "Add the General registry via Git" run: | import Pkg @@ -31,3 +43,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} + +# based on: +# https://github.com/JuliaRegistries/CompatHelper.jl diff --git a/.github/workflows/SpellCheck.yml b/.github/workflows/SpellCheck.yml new file mode 100644 index 0000000..c344f6d --- /dev/null +++ b/.github/workflows/SpellCheck.yml @@ -0,0 +1,13 @@ +name: Spell Check + +on: [pull_request] + +jobs: + typos-check: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + - name: Check spelling + uses: crate-ci/typos@master diff --git a/Project.toml b/Project.toml index ddebd55..30c3df4 100644 --- a/Project.toml +++ b/Project.toml @@ -9,6 +9,6 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" [compat] -LazyGrids = "0.5" +LazyGrids = "0.5, 1" SpecialFunctions = "1.8, 2" julia = "1.10" diff --git a/docs/Project.toml b/docs/Project.toml index 3b1ba69..543b2b4 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -11,3 +11,4 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [compat] +ImageGeoms = "0.10" diff --git a/docs/lit/examples/01-overview.jl b/docs/lit/examples/01-overview.jl index fe6a136..507b5dc 100644 --- a/docs/lit/examples/01-overview.jl +++ b/docs/lit/examples/01-overview.jl @@ -149,13 +149,13 @@ pic1 = phantom(x, y, [ellipse1]) marker = :star p0 = jim(x, y, pic0, "Original ellipse"; - xlabel="x", ylabel="y", prompt=:false) + xlabel="x", ylabel="y", size=(700,300), prompt=:false) x0,y0 = 7,0 scatter!([x0], [y0], color=:blue; marker) point1 = [cos(ϕ1) -sin(ϕ1); sin(ϕ1) cos(ϕ1)] * [x0; y0] # rotate point x1,y1 = point1[1], point1[2] p1 = jim(x, y, pic1, "Rotated by ϕ = $ϕ1s"; - xlabel="x", ylabel="y", prompt=:false) + xlabel="x", ylabel="y", size=(700,300), prompt=:false) scatter!([x1], [y1], color=:blue; marker) jim(p0, p1) @@ -221,7 +221,7 @@ pic1 = phantom(x, y, z, [ellipsoid1]) p0z = jim(x, y, pic0, "Original ellipsoid:\n(x,y) slice"; - xlabel="x", ylabel="y", prompt=:false) + xlabel="x", ylabel="y", size=(700,300), prompt=:false) x0,y0 = 7,0 scatter!([x0], [y0], color=:blue; marker) Rz(ϕ) = [cos(ϕ) -sin(ϕ) 0; sin(ϕ) cos(ϕ) 0; 0 0 1] @@ -229,7 +229,7 @@ point1 = Rz(ϕ1) * [x0; y0; 0] # rotate point x1,y1 = point1[1], point1[2] p1z = jim(x, y, pic1, "Rotated about z\nby ϕ = $ϕ1s\n(z out of 'board')"; - xlabel="x", ylabel="y", prompt=:false) + xlabel="x", ylabel="y", size=(700,350), prompt=:false) scatter!([x1], [y1], color=:blue; marker) jim(p0z, p1z) @@ -285,7 +285,7 @@ pic1 = phantom(x, y, z, [ellipsoid1]); pic1 = selectdim(pic1, 2, 1) p0y = jim(x, z, pic0, "Original ellipsoid:\n (x,z) slice"; - xlabel="x", ylabel="z", prompt=false) + xlabel="x", ylabel="z", size=(700,350), prompt=false) x0,z0 = 7,0 scatter!([x0], [z0], color=:green; marker) Ry(θ) = [cos(θ) 0 sin(θ); 0 1 0; -sin(θ) 0 cos(θ)] @@ -293,7 +293,7 @@ point1 = Ry(θ1) * [x0; 0; z0] # rotate point x1,z1 = point1[1], point1[3] p1y = jim(x, z, pic1, "Rotated about y\nby θ = $θ1s\n(y into 'board')"; - xlabel="x", ylabel="z", prompt=false) + xlabel="x", ylabel="z", size=(700,350), prompt=false) scatter!([x1], [z1], color=:green; marker) jim(p0y, p1y) @@ -347,7 +347,7 @@ pic1 = phantom(x, y, z, [ellipsoid1]); pic1 = selectdim(pic1, 1, 1) p0x = jim(y, z, pic0, "Original ellipsoid:\n (y,z) slice)"; - xlabel="y", ylabel="z", prompt=false) + xlabel="y", ylabel="z", size=(700,350), prompt=false) y0,z0 = 3,0 scatter!([y0], [z0], color=:red; marker) Rx(ψ) = [1 0 0 ; 0 cos(ψ) -sin(ψ); 0 sin(ψ) cos(ψ)] @@ -355,7 +355,7 @@ point1 = Rx(ψ1) * [0; y0; z0] # rotate point y1,z1 = point1[2], point1[3] p1x = jim(y, z, pic1, "Rotated about x\nby ψ = $ψ1s\n(x out of 'board')"; - xlabel="y", ylabel="z", prompt=false) + xlabel="y", ylabel="z", size=(700,350), prompt=false) scatter!([y1], [z1], color=:red; marker) jim(p0x, p1x) @@ -441,10 +441,10 @@ pic1 = phantom(x, y, z, [ellipsoid1]) p0a = jim(mid3(pic0), "Original ellipsoid\n(central slices)"; - xlabel="x", ylabel="y", prompt=:false) + xlabel="x", ylabel="y", size=(700,320), prompt=:false) p1a = jim(mid3(pic1), "Rotated\nϕ = $ϕ1s, θ = $θ1s, ψ = $ψ1s"; - xlabel="x", ylabel="y", prompt=:false) + xlabel="x", ylabel="y", size=(700,320), prompt=:false) jim(p0a, p1a) diff --git a/docs/make.jl b/docs/make.jl index bbae53d..66587ba 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -2,8 +2,8 @@ execute = isempty(ARGS) || ARGS[1] == "run" org, reps = :JuliaImageRecon, :ImagePhantoms eval(:(using $reps)) -using Documenter -using Literate +import Documenter +import Literate # https://juliadocs.github.io/Documenter.jl/stable/man/syntax/#@example-block ENV["GKSwstype"] = "100" @@ -23,7 +23,7 @@ binder_root_url = repo = eval(:($reps)) -DocMeta.setdocmeta!(repo, :DocTestSetup, :(using $reps); recursive=true) +Documenter.DocMeta.setdocmeta!(repo, :DocTestSetup, :(using $reps); recursive=true) # preprocessing inc1 = "include(\"../../../inc/reproduce.jl\")" @@ -77,7 +77,7 @@ format = Documenter.HTML(; assets = ["assets/custom.css"], ) -makedocs(; +Documenter.makedocs(; modules = [repo], authors = "Jeff Fessler and contributors", sitename = "$repo.jl", @@ -90,7 +90,7 @@ makedocs(; ) if isci - deploydocs(; + Documenter.deploydocs(; repo = "github.com/$base", devbranch = "main", devurl = "dev", diff --git a/test/Project.toml b/test/Project.toml index af3374c..56efc6c 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -8,3 +8,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [compat] +ImageGeoms = "0.10" diff --git a/test/helper.jl b/test/helper.jl index 99314a6..61e74db 100644 --- a/test/helper.jl +++ b/test/helper.jl @@ -10,8 +10,10 @@ end =# -# fft cannot handle units so this is a work-around -function myfft(x::AbstractArray{<:Number}) - u = oneunit(eltype(x)) - return fftshift(fft(ifftshift(x) / u)) * u +if !@isdefined myfft + # fft cannot handle units so this is a work-around + function myfft(x::AbstractArray{<:Number}) + u = oneunit(eltype(x)) + return fftshift(fft(ifftshift(x) / u)) * u + end end diff --git a/test/shape2.jl b/test/shape2.jl index e743b0f..2a938c7 100644 --- a/test/shape2.jl +++ b/test/shape2.jl @@ -13,6 +13,7 @@ using ImageGeoms: ImageGeom, axesf using FFTW: fft, fftshift, ifftshift using Test: @test, @testset, @inferred +include("helper.jl") # myfft @testset "circle-square" begin # special constructors args = [(1, 5.0f0), (1, 2, 3., 5.0f0), ((1, 2), 3., 5.0f0)] @@ -178,7 +179,7 @@ end @testset "spectrum" begin (M,N) = (2^10,2^10+5) # odd - ig = ImageGeom( dims=(M,N), deltas=(0.02m, 0.025m), offsets=:dsp) + ig = ImageGeom(; dims=(M,N), deltas=(0.02m, 0.025m), offsets=:dsp) ob = shape((2m, -3m), swidth, π/6, 1.0f0) zscale = 1 / (ob.value * IP.area(ob)) # normalize spectra by area