Skip to content

Commit

Permalink
Compat for ImageGeoms !?
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffFessler committed May 14, 2024
1 parent 9fb49b5 commit a8c6114
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
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 a8c6114

Please sign in to comment.