Commit e611fb11 authored by Matthijs's avatar Matthijs
Browse files

prevent numpy ComplexWarnings

parent fcee5c09
......@@ -3,6 +3,7 @@ from .array_tools import shifted_fft, shifted_ifft, roll_to_pos
__all__ = ['fourier_interpolate']
def fourier_interpolate(arr: np.ndarray, factor: any = 2., **kwargs) -> np.ndarray:
"""
Interpolation by padding in the Fourier domain.
......@@ -30,6 +31,9 @@ def fourier_interpolate(arr: np.ndarray, factor: any = 2., **kwargs) -> np.ndarr
out = fourier_interpolate_3d(arr, factor=factor, **kwargs)
else:
raise NotImplementedError('Can only interpolate 2d or 3d arrays as of now')
if np.isrealobj(arr):
return out.real.astype(arr.dtype, casting='unsafe')
else:
return out.astype(arr.dtype, casting='unsafe')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment