Skip to content

Commit e95d5ce

Browse files
ssfrrararslan
authored andcommitted
expands docs for fftshift and ifftshift (#17)
1 parent cd22658 commit e95d5ce

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

src/definitions.jl

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,19 @@ plan_irfft
363363
fftshift(x) = circshift(x, div.([size(x)...],2))
364364

365365
"""
366-
fftshift(x)
366+
fftshift(x, [dim])
367367
368-
Swap the first and second halves of each dimension of `x`.
368+
Circular-shift along the given dimension of a periodic signal `x` centered at
369+
index `1` so it becomes centered at index `N÷2+1`, where `N` is the size of
370+
that dimension.
371+
372+
This can be undone with [`ifftshift`](@ref). For even `N` this is equivalent to
373+
swapping the first and second halves, so `fftshift` and [`ifftshift`](@ref) are
374+
the same.
375+
376+
If `dim` is not given then the signal is shifted along each dimension.
369377
"""
370-
fftshift(x)
378+
fftshift
371379

372380
function fftshift(x,dim)
373381
s = zeros(Int,ndims(x))
@@ -377,19 +385,20 @@ function fftshift(x,dim)
377385
circshift(x, s)
378386
end
379387

380-
"""
381-
fftshift(x,dim)
382-
383-
Swap the first and second halves of the given dimension or iterable of dimensions of array `x`.
384-
"""
385-
fftshift(x,dim)
386-
387388
ifftshift(x) = circshift(x, div.([size(x)...],-2))
388389

389390
"""
390391
ifftshift(x, [dim])
391392
392-
Undoes the effect of `fftshift`.
393+
Circular-shift along the given dimension of a periodic signal `x` centered at
394+
index `N÷2+1` so it becomes centered at index `1`, where `N` is the size of
395+
that dimension.
396+
397+
This undoes the effect of [`fftshift`](@ref). For even `N` this is equivalent to
398+
swapping the first and second halves, so [`fftshift`](@ref) and `ifftshift` are
399+
the same.
400+
401+
If `dim` is not given then the signal is shifted along each dimension.
393402
"""
394403
ifftshift
395404

0 commit comments

Comments
 (0)