fCWT in Rust
Rust implementation of the fast Continuous Wavelet Transform.
It uses rustfft for FFT planning and
execution, and nightly Rust portable_simd for the daughter-wavelet frequency
multiplication.
Toolchain
The crate is pinned to nightly in rust-toolchain.toml because
std::simd/portable_simd is still unstable.
cargo test
cargo clippy --all-targets
cargo fmt --check
cargo bench --bench cwt
If you want to call the toolchain explicitly:
cargo +nightly-2026-04-03 test
Usage
use fcwt2::{Fcwt, Morlet, ScaleType, Scales};
let signal = vec![0.0_f32; 1024];
let scales = Scales::new(ScaleType::LinearFrequencies, 1_000, 1.0, 100.0, 64)?;
let mut fcwt = Fcwt::new(Morlet::new(2.0));
let coefficients = fcwt.cwt_real(&signal, &scales);
assert_eq!(coefficients.len(), signal.len() * scales.len());
# Ok::<(), fcwt2::ScaleError>(())
Output is scale-major: coefficients[scale_index * signal.len() + sample_index].
Benchmarks
Criterion benchmarks cover real and complex CWT transforms at 1024 and 4096 samples:
cargo bench --bench cwt
Examples
Run the wavelet packet denoising example to see article-style basis selection combined with soft-threshold reconstruction:
cargo run --example wavelet_packet_denoiser
My homelab benchmarks
Running benches/cwt.rs (target/release/deps/cwt-6c2d4260722aeb78)
cwt_real/1024 time: [320.71 µs 321.58 µs 322.68 µs]
thrpt: [203.10 Melem/s 203.79 Melem/s 204.34 Melem/s]
Found 3 outliers among 100 measurements (3.00%)
3 (3.00%) high severe
Benchmarking cwt_real/4096: Warming up for 3.0000 s
cwt_real/4096 time: [1.6010 ms 1.6288 ms 1.6622 ms]
thrpt: [157.71 Melem/s 160.95 Melem/s 163.74 Melem/s]
Found 15 outliers among 100 measurements (15.00%)
2 (2.00%) high mild
13 (13.00%) high severe
cwt_complex/1024 time: [325.21 µs 326.07 µs 327.12 µs]
thrpt: [200.34 Melem/s 200.99 Melem/s 201.52 Melem/s]
Found 3 outliers among 100 measurements (3.00%)
2 (2.00%) high mild
1 (1.00%) high severe
Benchmarking cwt_complex/4096: Warming up for 3.0000 s
cwt_complex/4096 time: [1.4950 ms 1.4991 ms 1.5039 ms]
thrpt: [174.31 Melem/s 174.86 Melem/s 175.35 Melem/s]
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild
Python bindings
PyO3 bindings are available behind the optional python feature:
cargo build --features python
The module exposes Morlet, Scales, Fcwt/FCWT,
WaveletPacketTransform, StationaryWaveletTransform, and
DualTreeComplexWaveletTransform. Real transforms accept a list of floats;
complex transforms accept Python complex values or (real, imag) tuples and
return Python complex values in the same scale-major layout as the Rust API.
To build/install the Python extension with maturin:
pip install maturin
maturin develop
Example:
import fcwt2
scales = fcwt2.Scales.linear_frequencies(1000, 1.0, 120.0, 64)
transform = fcwt2.Fcwt(2.0)
coefficients = transform.cwt_real([0.0] * 1024, scales)
complex_coefficients = transform.cwt_complex([1.0 + 0.0j] * 1024, scales)
packet = fcwt2.WaveletPacketTransform(3)
tree = packet.decompose([0.0] * 8)
reconstructed = tree.reconstruct()
swt = fcwt2.StationaryWaveletTransform(2)
swt_coefficients = swt.decompose([0.0] * 8)
dtcwt = fcwt2.DualTreeComplexWaveletTransform(2)
dtcwt_tree = dtcwt.decompose([0.0] * 8)
Tagged releases matching v* build Python wheels on Linux, macOS, and Windows
with GitHub Actions and upload the wheels plus source distribution to the
corresponding GitHub Release.
Acknowledgements
- Original library fCWT: https://github.com/fastlib/fCWT
- Fixed fCWT in C++: https://github.com/ThirdLetterC/fCWT
- PyWavelets - Wavelet Transforms in Python: https://pywavelets.readthedocs.io/en/latest/
- Wavelet Basis Selection in Signal Denoising Based on Wavelet-Coefficient Distribution Shape: https://www.mdpi.com/2624-6120/7/3/39
- dtcwt library: https://dtcwt.readthedocs.io/en/0.12.0/
Metadata
Release files for fcwt2 1.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fcwt2-1.6.0.tar.gz | 54.1 kB | With provenance | Details for fcwt2-1.6.0.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fcwt2-1.6.0-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details for fcwt2-1.6.0-cp38-abi3-win_amd64.whl |
| fcwt2-1.6.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details for fcwt2-1.6.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| fcwt2-1.6.0-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details for fcwt2-1.6.0-cp38-abi3-macosx_11_0_arm64.whl |
Total release size: 2.0 MB
Release files / fcwt2-1.6.0.tar.gz
| Download URL | fcwt2-1.6.0.tar.gz |
|---|---|
| Size | 54.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45386e27183f045c87303a8faf2c1da33472d3e654c22bc5195936d2633610a5
|
|
BLAKE2b-256 checksum How to use checksums |
820af62f0540778d74f6ee1b142f699b6c49b09f00735b57949484b42ce24c98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.
Transparency logRelease files / fcwt2-1.6.0-cp38-abi3-win_amd64.whl
| Download URL | fcwt2-1.6.0-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 589.5 kB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
8af864c3b7f08d82b79c82756ed02560e92d4fedfcdfd64cf280609ee84f6e1a
|
|
BLAKE2b-256 checksum How to use checksums |
a4a941f58d151a1eb148837ce35ca2d77b2fec9015930de8984fe7fce3b3a558
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.
Transparency logRelease files / fcwt2-1.6.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fcwt2-1.6.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 780.8 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
9dc13e74e7911878a91ee3a67709e3b82015c4605f1f081ac349b08cc70925a1
|
|
BLAKE2b-256 checksum How to use checksums |
d38d7115307b6d7108693856d20ac767cab1009069912e6bf46fea251b97fbc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.
Transparency logRelease files / fcwt2-1.6.0-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | fcwt2-1.6.0-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 577.4 kB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
60e84d9d2bd6109a745f8a1c48a490d30bcf9e9820ec7b8ca929bd5944ab6c0d
|
|
BLAKE2b-256 checksum How to use checksums |
ab21883d503381928ec89354c7442c8c4be93722d94d907b380de5f34425e7c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.
Transparency logSecurity for fcwt2 1.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 4 files in this release have been uploaded with provenance metadata.
Attestation for fcwt2-1.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.