Skip to main content

Spiking wavelets in JAX

Project description

Scale covariant and spiking wavelets

Wavelets that are guaranteed to be scale covariant, implemented as standard transforms and with spiking neurons.

Why

Standard wavelets are excellent at robust signal processing but work offline: they need the full signal. Real-time streams (audio, biosignals, sensors) need causal wavelets, and signals at unpredictable rates benefit from scale covariance: the response transforms predictably under time rescaling.

swavelet contains time-causal wavelets that can be used directly as neuromorphic signal encoders, deployable directly to neuromorphic hardware via NIR, both as spiking and non-spiking variants.

The spiking variants double as event-driven ADCs, encoding continuous inputs straight into sparse spike trains, skipping the uniform sampler entirely.

Wavelet spike coding diagram

Usage

Install using uv: uv sync

Encoding and decoding (non-spiking)

import jax.numpy as jnp
from swavelet import DoT

dt = 1e-3                        # Simulation time delta
t = jnp.arange(0, 1.0, dt)       # Duration: 1 second
signal = jnp.sin(2 * jnp.pi * t) # A simple sinusoidal

w = DoT(n_channels=4, dt=dt, mu_max=0.05) # 4-channel wavelet
coeffs = w(w.params, signal)              # analysis: (n_channels, T)
recon = w.reconstruct(w.params, coeffs)   # synthesis: back to signal

Encoding and decoding (spiking)

The same shape works for every wavelet — call returns coefficients, reconstruct inverts them. Spiking variants substitute spike trains for coefficients:

from swavelet import SpikingDoT

w = SpikingDoT(n_channels=4, dt=dt, mu_max=0.05)
spikes = w(w.params, signal) # (2 * n_channels, T)
# Use the spikes in your ML pipeline or reconstruct:
recon  = w.reconstruct(w.params, spikes)

Export to NIR

import nir
from swavelet import SpikingDoE

w = SpikingDoE(n_channels=4, dt=dt, mu_max=0.05)
nir_graph = w.to_nir()
nir.write("spiking_doe.nir", nir_graph)

The graph is a single chain: a fanout Affine broadcasts the scalar input across the K smoothing channels, the multi-channel LI bank produces L_1..L_K, the connectivity Affine wires each bandpass row with ±1 weights between adjacent scales (and the lowpass row taps L_K directly), and a multi-channel LIF emits the spike output. Diagram via NirViz:

Spiking DoE NIR graph

Wavelet implementations (spiking and non-spiking)

  • DoG: Difference of Gaussian
  • DoT: Difference of time-causal limit kernel
  • DoE: Difference of truncated exponential (DoT with cascade depth=1)
Wavelet Causal Recovery NIR Use case
DoG Perfect Offline, symmetric scale-space
DoT Perfect Streaming, full causal scale-space
DoE Perfect Streaming, cheapest (cascade depth 1)
Spiking DoG Quantized Offline neuromorphic encoding
Spiking DoT Quantized + delayed SNN streaming, biologically plausible
Spiking DoE Quantized + delayed Lightest SNN variant for streaming

Acknowledgements

Please cite our paper:

@inproceedings{pedersen2026scalecovariant,
  title = {Scale-{{Covariant Spiking Wavelets}}},
  booktitle = {2026 {{IEEE International Conference}} on {{Acoustics}}, {{Speech}} and {{Signal Processing}} ({{ICASSP}})},
  author = {Pedersen, Jens Egholm and Lindeberg, Tony and Gerstoft, Peter},
  year = 2026,
  month = may,
  pages = {20347--20351},
  issn = {2379-190X},
  doi = {10.1109/ICASSP55912.2026.11463688},
  urldate = {2026-05-10},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swavelet-0.1.2.tar.gz (247.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swavelet-0.1.2-py3-none-any.whl (43.6 kB view details)

Uploaded Python 3

File details

Details for the file swavelet-0.1.2.tar.gz.

File metadata

  • Download URL: swavelet-0.1.2.tar.gz
  • Upload date:
  • Size: 247.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for swavelet-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b785f790739f33669f1a89dea467ac1509171e1a346baa9a4fa6bf552780a592
MD5 79fe18482fe6c234cc07fbdd29e0463e
BLAKE2b-256 791de66b027b1ad06245770d83006edf7c445f8b385af2b22e50927b87935bc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for swavelet-0.1.2.tar.gz:

Publisher: publish.yml on Jegp/swavelet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file swavelet-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: swavelet-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 43.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for swavelet-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1a642e23275deb65a43293e5f5744662797cee098df0c4119f5d72c63d600a44
MD5 f0c7fc39eb8761e23ba915c79e9278a6
BLAKE2b-256 982af41f92390034d771f4ec4b7f69398a7a5f9594ae5ee455565b7e9bc65047

See more details on using hashes here.

Provenance

The following attestation bundles were made for swavelet-0.1.2-py3-none-any.whl:

Publisher: publish.yml on Jegp/swavelet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page