Create TD source wavelet
Daniel Köhn
Kiel, 01.09.2017

Import necessary packages


In [ ]:
import numpy as np
import matplotlib as plt
import matplotlib.pyplot as plt
from matplotlib.pyplot import gca
import matplotlib as mpl
from pylab import rcParams
from matplotlib import rc
#%matplotlib notebook

Define parameters TD parameters of source wavelet


In [ ]:
# TD parameters
Tmax = 250e-9       # maximum time TD
dt = Tmax/1000      # time sampling

# source wavelet centre frequency
fc = 100e6

# define time samples in time and frequency domain
t = np.arange(0.0, Tmax, dt)
nt = np.shape(t)
dt

Font properties


In [ ]:
FSize = 25
font = {'color':  'black',
        'weight': 'bold',
        'size': FSize}
mpl.rc('xtick', labelsize=FSize) 
mpl.rc('ytick', labelsize=FSize) 
rcParams['figure.figsize'] = 15, 8

Convolve FDFD spike data with TD source wavelet


In [ ]:
# define Ricker wavelet
ts = 1.0 / fc
tau = np.pi * (t - 1.5 * ts) / (1.5 * ts)
stf = (1.0 - 4.0 * tau * tau) * np.exp(-2.0 * tau * tau)

# normalize source wavelet
stf = stf / np.max(np.abs(stf))

name_stf = "wavelet.bin"
f = open (name_stf, mode='wb')
data_type = np.dtype ('float32').newbyteorder ('<')
stf = np.array(stf, dtype=data_type)
stf.tofile(f)

Plot source wavelet


In [ ]:
plt.rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rc('text', usetex=True)

im = plt.plot(t*1e9,stf,'b-')

a = gca()
a.set_xticklabels(a.get_xticks(), font)
a.set_yticklabels(a.get_yticks(), font)

plt.title('Ricker wavelet', fontdict=font)
plt.ylabel('Amplitude[]', fontdict=font)
plt.xlabel('Time [ns]', fontdict=font)

plt.savefig('ricker.pdf', bbox_inches='tight', format='pdf')
plt.show()

In [ ]: