Skip to content

Commit

Permalink
Standardize yml and LazyGrids compat v1 (#84)
Browse files Browse the repository at this point in the history
* Standardize docs

* Standardize yml

* Compat LazyGrids v1

* Fix size

* Compat for ImageGeoms !?

* Compat ImageGeoms for docs/ too !?
  • Loading branch information
JeffFessler authored May 14, 2024
1 parent 33181fe commit 39b51aa
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 22 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,3 +43,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}

# based on:
# https://github.com/JuliaRegistries/CompatHelper.jl
13 changes: 13 additions & 0 deletions .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[compat]
ImageGeoms = "0.10"
20 changes: 10 additions & 10 deletions docs/lit/examples/01-overview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -221,15 +221,15 @@ 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]
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)

Expand Down Expand Up @@ -285,15 +285,15 @@ 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(θ)]
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)

Expand Down Expand Up @@ -347,15 +347,15 @@ 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(ψ)]
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)

Expand Down Expand Up @@ -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)


Expand Down
10 changes: 5 additions & 5 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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\")"
Expand Down Expand Up @@ -77,7 +77,7 @@ format = Documenter.HTML(;
assets = ["assets/custom.css"],
)

makedocs(;
Documenter.makedocs(;
modules = [repo],
authors = "Jeff Fessler and contributors",
sitename = "$repo.jl",
Expand All @@ -90,7 +90,7 @@ makedocs(;
)

if isci
deploydocs(;
Documenter.deploydocs(;
repo = "github.com/$base",
devbranch = "main",
devurl = "dev",
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[compat]
ImageGeoms = "0.10"
10 changes: 6 additions & 4 deletions test/helper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion test/shape2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 39b51aa

Please sign in to comment.