jax.numpy.fft.fftshift
Contents
jax.numpy.fft.fftshift#
- jax.numpy.fft.fftshift(x,axes=None)[source]#
Shift zero-frequency fft component to the center of the spectrum.
JAX implementation of
numpy.fft.fftshift().- Parameters:
- Returns:
A shifted copy of
x.- Return type:
See also
jax.numpy.fft.ifftshift(): inverse offftshift.jax.numpy.fft.fftfreq(): generate FFT frequencies.
Examples
Generate FFT frequencies with
fftfreq():>>>freq=jnp.fft.fftfreq(5)>>>freqArray([ 0. , 0.2, 0.4, -0.4, -0.2], dtype=float32)
Use
fftshiftto shift the zero-frequency entry to the middle of the array:>>>shifted_freq=jnp.fft.fftshift(freq)>>>shifted_freqArray([-0.4, -0.2, 0. , 0.2, 0.4], dtype=float32)
Unshift with
ifftshift()to recover the original frequencies:>>>jnp.fft.ifftshift(shifted_freq)Array([ 0. , 0.2, 0.4, -0.4, -0.2], dtype=float32)
Contents
