import numpy as N
import scipy as S
import pylab as P

# Construct a random image as input
x = N.random.random((300,300))
X = S.fft.fftn(x, axes=(1,))

# Construct a smoothing filter
f = N.zeros(300)
f[:20] = 1.
F = S.fft.fft(f)

# Apply along axis in Fourier domain and bring back to time-domain
XF = N.multiply(X,F)
xf = N.fft.ifftn(XF, axes=(1,))

P.subplot(121)
P.imshow(x,cmap=P.cm.gray)

P.subplot(122)
P.imshow(xf,cmap=P.cm.gray)

P.show()
