From a8c611489278b4b4feade555e8076d709d235d03 Mon Sep 17 00:00:00 2001 From: Jeff Fessler Date: Mon, 13 May 2024 20:46:30 -0400 Subject: [PATCH] Compat for ImageGeoms !? --- test/Project.toml | 1 + test/helper.jl | 10 ++++++---- test/shape2.jl | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) 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