from matplotlib import pyplot as plt
import numpy as np

def mexican_hat(t, sigma, t0):
    tmp = ((t - t0) / sigma)**2
    return (1 - tmp) * np.exp(-tmp/2) / np.sqrt(sigma)

t = np.arange(2000) / 100
y = np.sin(t**2 / 5)

t0_list = [2.5, 5.0, 7.5, 10.0, 12.5, 15.0, 17.5]
sigma_list = [0.25, 0.5, 0.75, 1.0, 1.25, 1.5]

fig = plt.figure(figsize=(12,9))
c = 0
for sigma in sigma_list:
    for t0 in t0_list:
        c += 1
        wavelet = mexican_hat(t, sigma, t0)
        ax = fig.add_subplot(len(sigma_list), len(t0_list), c)
        ax.set_ylim(-1.5, 1.5)
        ax.axes.xaxis.set_visible(False)
        ax.axes.yaxis.set_visible(False)
        ax.plot(t, y, lw=0.5)
        ax.plot(t, wavelet, lw=0.7)
        ax.plot(t, wavelet * y)
        ax.grid()
        ax.text(0, 1.2, '$\sigma = {}, t_0 = {}$'.format(sigma, t0), fontsize=8)
        I = (wavelet*y).sum()
        ax.text(0, 0.8, '$I = {:.3f}$'.format(I), fontsize=10)

plt.tight_layout()
plt.show()