1
$\begingroup$

I often see images like this:

enter image description here

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)?

$\endgroup$

1 Answer 1

1
$\begingroup$
  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')
$\endgroup$
7
  • $\begingroup$ 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. $\endgroup$
    – stish
    Sep 8, 2021 at 14:29
  • 1
    $\begingroup$ @stish Forgot to provide install; try pip install git+https://github.com/kymatio/kymatio.git@refs/pull/674/head $\endgroup$ Sep 8, 2021 at 14:30
  • 1
    $\begingroup$ @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 $\endgroup$ Sep 8, 2021 at 14:44
  • 1
    $\begingroup$ @stish Alternatively fix-672, or clone branch directly $\endgroup$ Sep 8, 2021 at 15:07
  • 1
    $\begingroup$ @stish Added minimal code. $\endgroup$ Sep 8, 2021 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.