Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/resampling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@
true
```
"""
function resample(arr::AbstractArray{T, N}, new_size; normalize=true) where {T, N}
function resample(arr::AbstractArray{T, N}, new_size; shift_center=false, normalize=true) where {T, N}
if new_size == size(arr)
return copy(arr)
end
# for complex arrays we need a full FFT
if shift_center
arr = ifftshift(arr)

Check warning on line 61 in src/resampling.jl

View check run for this annotation

Codecov / codecov/patch

src/resampling.jl#L61

Added line #L61 was not covered by tests
end
if T <: Complex
arr_out = resample_by_FFT(arr, Tuple(new_size))
else
Expand All @@ -67,6 +70,9 @@
if normalize
arr_out .*= length(arr_out) ./ length(arr)
end
if shift_center
arr_out = fftshift(arr_out)

Check warning on line 74 in src/resampling.jl

View check run for this annotation

Codecov / codecov/patch

src/resampling.jl#L74

Added line #L74 was not covered by tests
end
return arr_out
end

Expand Down