I am new here and new to DSP, so maybe my question is really basic.
I have the formula for the Ricker wavelet (Mexican Hat) in frequency-domain and I wish to do an inverse Fourier transform to recover my original signal in time-domain. I am using python numpy.fft module for this.
For some reason, instead of a Ricker wavelet (https://wiki.seg.org/wiki/Dictionary:Ricker_wavelet), I am obtaining a divided version of the signal, like it is aliased or cut in half or lagged (yes, I'm confused).
Do I have to change the order of my time vector accordingly to the frequency vector ? What is the reason for this ? Or is it something else that I am missing ?
My goal is to retrieve a Ricker wavelet centered in zero (or even lagged), but I don't know why my results are like these and how to justify flipping or slicing my time vector.
Please find below my code which also generate the plots. Please let me know if you need any further information.
Thanks in advance, Luis
import matplotlib.pyplot as plt
import numpy as np
# Dummy signal length
nsamples = 338
dt = 1.6199375667655787e-10
freq = np.fft.fftfreq(len(trace),d=dt)
# peak angular frequency
omega_p = 2*np.pi*250e6
#Using only the positive frequencies for the Ricker Wavelet calculation
omega = 2*np.pi*freq[0:169]
# Ricker Wavelet in Frequency Domain
S_desired = (2/np.sqrt(np.pi))*((omega**2)/(omega_p**3))*np.exp(-(omega**2)/(omega_p**2))
# Appending the Ricker Wavelet values
S_flip = np.flip(S_desired).copy()
S = np.concatenate((S_desired,S_flip))
S_desired_time = np.fft.ifft(S)
time = time=np.arange(0,nsamples*dt,dt)
plt.plot(freq,np.abs(S),'r',label='Power spectrum Ricker wavelet')
plt.xlabel('Frequency [Hz]')
plt.figure()
plt.plot(time,S_desired_time,label='IFFT of the Ricker Wavelet')
plt.xlabel('time [s]')
time=np.arange(0,nsamples*dt,dt)
and not type out each value, it would make your code look more compact $\endgroup$