How to plot the shape of a 2D wavelet?

I often see images like this:

where on the left it depicts 2D wavelets and on the right curvelets for different scales and locations.

How can I visualize different 2D wavelets/curvelets in such a way using Matlab or Python (e.g. using pywavelets)?

1. Transform to time domain
2. Center
3. Plot real & imag separately, or use complex colormap, or take modulus

Results below.

Minimal code

import numpy as np
from numpy.fft import ifft, ifftshift
import matplotlib.pyplot as plt

N = 2048
w = np.linspace(0, 1, N, 0)
psi_x = ifftshift(ifft(np.exp(-(w - .0125 )**2 * 2**19)))
psi_y = ifftshift(ifft(np.exp(-(w - .00625)**2 * 2**20)))
Psi = psi_x * psi_y[:, None]
plt.imshow(Psi.real, cmap='bwr')

• Oh wow thanks! Could you maybe provide a minimal example, e.g. for plotting \Psi_{2,3,+1}? I was able to install the package, but can't import for example the "visuals" module. Sep 8, 2021 at 14:29
• @stish Forgot to provide install; try pip install git+https://github.com/kymatio/kymatio.git@refs/pull/674/head Sep 8, 2021 at 14:30
• @stish Right, it's the most recent and final version. If it's still not working I'd try to clone the repository with and switch to branch pr/674 Sep 8, 2021 at 14:44
• @stish Alternatively fix-672, or clone branch directly Sep 8, 2021 at 15:07
• @stish Added minimal code. Sep 8, 2021 at 15:37