jaxwt

Differentiable and gpu enabled fast wavelet transforms in JAX.

https://github.com/v0lta/jax-wavelet-toolbox

Science Score: 18.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary

Keywords

fwt jax python wavelet-packets wavelet-transform wavelets

Keywords from Contributors

fast-wavelet-transform matrix-fwt wavelet wavelet-analysis
Last synced: 6 months ago · JSON representation ·

Repository

Differentiable and gpu enabled fast wavelet transforms in JAX.

Basic Info
  • Host: GitHub
  • Owner: v0lta
  • License: eupl-1.2
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 1.15 MB
Statistics
  • Stars: 45
  • Watchers: 2
  • Forks: 3
  • Open Issues: 0
  • Releases: 6
Topics
fwt jax python wavelet-packets wavelet-transform wavelets
Created over 4 years ago · Last pushed over 1 year ago
Metadata Files
Readme License Citation

README.rst

.. |favicon| image:: https://raw.githubusercontent.com/v0lta/Jax-Wavelet-Toolbox/master/docs/favicon/favicon.ico
    :alt: Shannon-wavelet favicon
    :width: 32
    :target: https://pypi.org/project/jaxwt/

*************************************
|favicon| Jax Wavelet Toolbox (jaxwt)
*************************************


.. image:: https://github.com/v0lta/Jax-Wavelet-Toolbox/actions/workflows/tests.yml/badge.svg 
    :target: https://github.com/v0lta/Jax-Wavelet-Toolbox/actions/workflows/tests.yml
    :alt: GitHub Actions

.. image:: https://readthedocs.org/projects/jax-wavelet-toolbox/badge/?version=latest
    :target: https://jax-wavelet-toolbox.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

.. image:: https://img.shields.io/pypi/pyversions/jaxwt
    :target: https://pypi.org/project/jaxwt/
    :alt: PyPI Versions

.. image:: https://img.shields.io/pypi/v/jaxwt
    :target: https://pypi.org/project/jaxwt/
    :alt: PyPI - Project

.. image:: https://img.shields.io/pypi/l/jaxwt
    :target: https://github.com/v0lta/Jax-Wavelet-Toolbox/blob/master/LICENSE
    :alt: PyPI - License

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
    :alt: Black code style

.. image:: https://static.pepy.tech/personalized-badge/jaxwt?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads
    :target: https://pepy.tech/project/jaxwt
    :alt: PyPi - downloads


Differentiable and GPU-enabled fast wavelet transforms in JAX. 

Features
""""""""
- ``wavedec`` and ``waverec`` implement 1d analysis and synthesis transforms.
- Similarly, ``wavedec2`` and ``waverec2`` provide 2d transform support.
- The ``cwt``-function supports 1d continuous wavelet transforms.
- The ``WaveletPacket`` object supports 1d wavelet packet transforms.
- ``WaveletPacket2d`` implements two-dimensional wavelet packet transforms.
- ``swt`` and ``iswt`` allow 1d-stationary transformations.

This toolbox extends `PyWavelets `_. 
We additionally provide GPU and gradient support via a Jax backend.

Installation
""""""""""""
To install Jax, head over to https://github.com/google/jax#installation and follow the procedure described there.
Afterward, type ``pip install jaxwt`` to install the Jax-Wavelet-Toolbox. You can uninstall it later by typing ``pip uninstall jaxwt``.

Documentation
"""""""""""""
Complete documentation of all toolbox functions is available at
`readthedocs `_.


Transform Examples:
"""""""""""""""""""

To compute a one-dimensional fast wavelet transform, consider the code snippet below:

.. code-block:: python

  import jax.numpy as jnp
  import jaxwt as jwt

  import pywt
  import numpy as np;

  # generate an input of even length.
  data = jnp.array([0., 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0])
  
  # compare the forward fwt coefficients
  print(pywt.wavedec(np.array(data), 'haar', mode='zero', level=2))
  print(jwt.wavedec(data, 'haar', mode='zero', level=2))
  
  # invert the fwt.
  print(jwt.waverec(jwt.wavedec(data, 'haar', mode='zero', level=2),
                    'haar'))


The snipped also evaluates the `pywt` implementation to demonstrate that the coefficients are the same.
Use `jaxwt` if you require gradient or GPU support.

The process for two-dimensional fast wavelet transforms works similarly:

.. code-block:: python

  import jaxwt as jwt
  import jax.numpy as jnp
  from scipy.datasets import face

  image = jnp.transpose(
      face(), [2, 0, 1]).astype(jnp.float32)
  transformed = jwt.wavedec2(image, "haar", 
                             level=2, mode="reflect")
  reconstruction = jwt.waverec2(transformed, "haar")
  jnp.max(jnp.abs(image - reconstruction))


``jaxwt`` allows transforming batched data.
The example above moves the color channel to the front because wavedec2 transforms the last two axes by default.
We can avoid doing so by using the ``axes`` argument. Consider the batched example below:

.. code-block:: python

  import jaxwt as jwt
  import jax.numpy as jnp
  from scipy.datasets import face

  image = jnp.stack(
      [face(), face(), face()], axis=0
       ).astype(jnp.float32)
  transformed = jwt.wavedec2(image, "haar", 
                             level=2, mode="reflect",
                             axes=(1,2))
  reconstruction = jwt.waverec2(transformed, "haar", axes=(1,2))
  jnp.max(jnp.abs(image - reconstruction))


For more code examples, follow the documentation link above or visit
the `examples `_ folder.



Testing
"""""""
Unit tests are handled by ``nox``. Clone the repository and run it with the following:

.. code-block:: sh

    $ pip install nox
    $ git clone https://github.com/v0lta/Jax-Wavelet-Toolbox
    $ cd Jax-Wavelet-Toolbox
    $ nox -s test

Goals
"""""
- In the spirit of Jax, the aim is to be 100% pywt compatible. Whenever possible, interfaces should be the same
  results identical.


64-Bit floating-point numbers
"""""""""""""""""""""""""""""
If you need 64-bit floating point support, set the Jax config flag: 

.. code-block:: python

    from jax.config import config
    config.update("jax_enable_x64", True)


Citation
"""""""""""

If you use this work in a scientific context, please cite the following:

.. code-block::

  @phdthesis{handle:20.500.11811/9245,
    urn: https://nbn-resolving.org/urn:nbn:de:hbz:5-63361,
    author = {{Moritz Wolter}},
    title = {Frequency Domain Methods in Recurrent Neural Networks for Sequential Data Processing},
    school = {Rheinische Friedrich-Wilhelms-Universität Bonn},
    year = 2021,
    month = jul,
    url = {https://hdl.handle.net/20.500.11811/9245}
  }

Owner

  • Name: Moritz Wolter
  • Login: v0lta
  • Kind: user
  • Location: Bonn, Germany
  • Company: High-Performance Computing and Analytics Lab, Bonn University

Citation (CITATION.bib)

@phdthesis{handle:20.500.11811/9245,
  urn: https://nbn-resolving.org/urn:nbn:de:hbz:5-63361,
  author = {{Moritz Wolter}},
  title = {Frequency Domain Methods in Recurrent Neural Networks for Sequential Data Processing},
  school = {Rheinische Friedrich-Wilhelms-Universität Bonn},
  year = 2021,
  month = jul,
  url = {https://hdl.handle.net/20.500.11811/9245}
}

GitHub Events

Total
  • Watch event: 6
Last Year
  • Watch event: 6

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 182
  • Total Committers: 4
  • Avg Commits per committer: 45.5
  • Development Distribution Score (DDS): 0.203
Top Committers
Name Email Commits
moritz@wolter.tech m****z@w****h 145
Moritz Wolter v****a@u****m 31
Charles Tapley Hoyt c****t@g****m 5
Konstantin Tieber h****o@x****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 4
  • Total pull requests: 7
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 7 days
  • Total issue authors: 3
  • Total pull request authors: 1
  • Average comments per issue: 4.25
  • Average comments per pull request: 0.0
  • Merged pull requests: 7
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: 9 minutes
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • thoschm (2)
  • jakubMitura14 (1)
  • francois-rozet (1)
Pull Request Authors
  • v0lta (9)
Top Labels
Issue Labels
enhancement (2)
Pull Request Labels
enhancement (4)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 431 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 11
  • Total maintainers: 1
pypi.org: jaxwt

Differentiable and gpu enabled fast wavelet transforms in JAX

  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 431 Last month
Rankings
Dependent packages count: 10.1%
Stargazers count: 12.1%
Average: 17.2%
Forks count: 19.2%
Dependent repos count: 21.6%
Downloads: 23.1%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/tests.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
docs/requirements.txt pypi
  • jaxwt *
setup.py pypi