Skip to content

Latest commit

 

History

History
93 lines (48 loc) · 2.02 KB

plot_wavelets.rst

File metadata and controls

93 lines (48 loc) · 2.02 KB
.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        Click :ref:`here <sphx_glr_download_auto_examples_03_sp_plot_wavelets.py>`     to download the full example code
    .. rst-class:: sphx-glr-example-title

    .. _sphx_glr_auto_examples_03_sp_plot_wavelets.py:


Morlet Wavelet in time and Fourier domain

This example shows how to generate a wavelet filter-bank.

plot wavelets

import symjax
import symjax.tensor as T
import matplotlib.pyplot as plt
import numpy as np

J = 5
Q = 4
scales = T.power(2, T.linspace(0.1, J - 1, J * Q))
scales = scales[:, None]

wavelet = symjax.tensor.signal.complex_morlet(5 * scales, np.pi / scales)
waveletw = symjax.tensor.signal.fourier_complex_morlet(
    5 * scales, np.pi / scales, wavelet.shape[-1]
)

f = symjax.function(outputs=[wavelet, waveletw])

wavelet, waveletw = f()

plt.subplot(121)
for i in range(J * Q):
    plt.plot(2 * i + wavelet[i].real, c="b")
    plt.plot(2 * i + wavelet[i].imag, c="r")

plt.subplot(122)
for i in range(J * Q):
    plt.plot(i + waveletw[i].real, c="b")
    plt.plot(i + waveletw[i].imag, c="r")
.. rst-class:: sphx-glr-timing

   **Total running time of the script:** ( 0 minutes  10.489 seconds)


.. only :: html

 .. container:: sphx-glr-footer
    :class: sphx-glr-footer-example



  .. container:: sphx-glr-download sphx-glr-download-python

     :download:`Download Python source code: plot_wavelets.py <plot_wavelets.py>`



  .. container:: sphx-glr-download sphx-glr-download-jupyter

     :download:`Download Jupyter notebook: plot_wavelets.ipynb <plot_wavelets.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_