Skip to content

aphoffmann/InvertibleWavelets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InvertibleWavelets

A lightweight, fully invertible wavelet transform toolkit for Python — implement time-frequency filterbanks, run forward/inverse transforms, and visualize scalograms with ease.

Features

  • Abstract FilterBank base class with pluggable implementations:
    • LinearFilterBank (linear-scale center frequencies)
    • DyadicFilterBank (dyadic/power-of-two scales)
  • FFT-based forward and inverse transforms with overlap-add handling
  • frame operator normalization built in to assist the dual-frame inverse
  • Scalogram plotting (log-power over time–frequency)
  • Four canonical mother wavelets:
    • Morlet, Cauchy, MexicanHat, DoG
  • Pure Python, minimal dependencies (numpy, scipy, matplotlib)

Installation

Install directly from GitHub (no PyPI publish required):

pip install git+https://github.com/aphoffmann/invertiblewavelets.git

Quickstart

import numpy as np
import matplotlib.pyplot as plt

from invertiblewavelets import LinearFilterBank, DyadicFilterBank, Transform, Morlet

# 1. Create a test signal
fs = 1000                       # sampling rate [Hz]
N = 10_000
t = np.arange(N)/fs
data = np.sin(2*np.pi*100*t)

# 2. Create a Filterbank
fb  = LinearFilterBank(
    wavelet=Morlet(fc=1, fb=100),
    fs=fs, 
    N=N, 
    b = 1/10, 
    real=False
)

fb_dyadic = DyadicFilterBank(
    wavelet=Morlet(fc=1, fb=100),
    fs=fs,
    N = N,
    s_max = 1/10,
    real=False
)

# 3. Build the Transform with the filterbank
xfm = Transform(fb.Wfreq)

# 4. Forward
xfm.forward(data, mode='full')

# 5. Plot scalogram
xfm.scalogram(coeffs, title="Demo Scalogram")
plt.show()

# 6. Inverse
reconstructed = xfm.inverse(coeffs, mode='full', Lx = N)

# 7. Print RMSE
print(np.sqrt(np.mean((data-reconstructed)**2)))

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages