# Why the inverse discrete fourier transform of the Ricker pulse isn't the same as the Ricker pulse in time domain?

Question

I'm trying to use Python's scipy library to compute the IDFT of the Ricker wavelet function and compare it with the analytical time-domain version of the same function. When I compare the results, they do not match. I want to understand why.

Details

I'm using Python for the experiment. The Ricker pulse function in time domain is defined as follows:

def ricker_pulse_time(w0, t):
return (1. - .5 * w0**2 * t**2) * np.e ** (-.25 * w0**2 * t**2)

def ricker_pulse_freq(w0, w):
return (2. * w**2) / (np.sqrt(np.pi) * w0**3) * \
np.e ** (-w**2 / w0**2)


So, for 2Hz, for example:

hz_to_rad = lambda x: 2. * np.pi * x

time_step = 1e-6 # [s]
t = np.arange(-2.0, 2.0, time_step)
y = ricker_pulse_time(w0, t)
N = len(t)

omega = np.arange(0.0, 100.0, 1e-4)
yy = ricker_pulse_freq(w0, omega)

plt.plot(t, y, 'r-');
plt.show();
plt.plot(omega, yy, 'b-');


But, when I try to make the ifft of the ricker pulse in the frequency domain, I don't seem to get the expected curve in time domain, as above...

omega = np.arange(-300.0, 300.0, 1e-4)
yy = ricker_pulse_freq(w0, omega)
plt.plot(omega, yy);
plt.show();

y_ta = fft.fftshift(ifft(yy))
tt = np.arange(-2.0, 2.0, 4. / len(y_ta))
plt.plot(tt, y_ta.real, 'b-');
plt.xlim(-.005, +.005)
plt.show();


I don't understand the reasoning behind this, and what should I do to get the same results. I understand that, perhaps, I won't get the same amplitude of signal, but I want to at least get the same shape...

• Try ifft(fft.ifftshift(yy)). At the moment, you are taking the inverse DFT of some peaks very close to the Nyquist rate. So the output is going to be very high frequency. Dec 29 '20 at 22:05