Python bindings for the Rust fCWT implementation
Project description
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
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/
- dtcwt library: https://dtcwt.readthedocs.io/en/0.12.0/
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fcwt2-1.5.0.tar.gz.
File metadata
- Download URL: fcwt2-1.5.0.tar.gz
- Upload date:
- Size: 985.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9ffadb81ec0d6fd71fc8c5ae318e1744b907d0745a7734a94c2f3825a3abee9
|
|
| MD5 |
ce9ef4fcd80b9eff09a955bf48165d4e
|
|
| BLAKE2b-256 |
975dee5a807950513486d17321882b556ccf6e5a4f14de2ffdcb248a1a94d861
|
Provenance
The following attestation bundles were made for fcwt2-1.5.0.tar.gz:
Publisher:
python-release.yml on RustedBytes/fcwt2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fcwt2-1.5.0.tar.gz -
Subject digest:
c9ffadb81ec0d6fd71fc8c5ae318e1744b907d0745a7734a94c2f3825a3abee9 - Sigstore transparency entry: 1857883975
- Sigstore integration time:
-
Permalink:
RustedBytes/fcwt2@e6e985b54a61a637cbbbe753a5d197235da55772 -
Branch / Tag:
refs/tags/v1.5.0 - Owner: https://github.com/RustedBytes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@e6e985b54a61a637cbbbe753a5d197235da55772 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fcwt2-1.5.0-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: fcwt2-1.5.0-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 550.8 kB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c86c932ae77f428807592366aab529065425cbc5777ed05612ccf2b96c0d4b0
|
|
| MD5 |
0c96544b8b67babd416166ce5f044fe2
|
|
| BLAKE2b-256 |
51065dc19ac1616fd27717ec8cc44f70e8b356b3b82a1982ed767aebe20b0349
|
Provenance
The following attestation bundles were made for fcwt2-1.5.0-cp38-abi3-win_amd64.whl:
Publisher:
python-release.yml on RustedBytes/fcwt2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fcwt2-1.5.0-cp38-abi3-win_amd64.whl -
Subject digest:
1c86c932ae77f428807592366aab529065425cbc5777ed05612ccf2b96c0d4b0 - Sigstore transparency entry: 1857884004
- Sigstore integration time:
-
Permalink:
RustedBytes/fcwt2@e6e985b54a61a637cbbbe753a5d197235da55772 -
Branch / Tag:
refs/tags/v1.5.0 - Owner: https://github.com/RustedBytes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@e6e985b54a61a637cbbbe753a5d197235da55772 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fcwt2-1.5.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: fcwt2-1.5.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 741.4 kB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b484af06346e8d69df3f592c97484c84b6001bca57e2dafcf43f99ca2197faba
|
|
| MD5 |
a391010a60e63c9efed7bbd9e11a2d01
|
|
| BLAKE2b-256 |
0af2ed0f02521dd799c28c5ea8feb92f7ab7244278d4fa885ce216035fd78189
|
Provenance
The following attestation bundles were made for fcwt2-1.5.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
python-release.yml on RustedBytes/fcwt2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fcwt2-1.5.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
b484af06346e8d69df3f592c97484c84b6001bca57e2dafcf43f99ca2197faba - Sigstore transparency entry: 1857883987
- Sigstore integration time:
-
Permalink:
RustedBytes/fcwt2@e6e985b54a61a637cbbbe753a5d197235da55772 -
Branch / Tag:
refs/tags/v1.5.0 - Owner: https://github.com/RustedBytes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@e6e985b54a61a637cbbbe753a5d197235da55772 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fcwt2-1.5.0-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: fcwt2-1.5.0-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 541.0 kB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afb3ce3c91a4b73eab6b26546f380c76fc4efedb559c838266a97afa252daa14
|
|
| MD5 |
938bbc645dd284e855a162f203dd9410
|
|
| BLAKE2b-256 |
98d79688b53f2b1c2834c32ab209045ed8df10a79ed1a469b9e2b762554f971a
|
Provenance
The following attestation bundles were made for fcwt2-1.5.0-cp38-abi3-macosx_11_0_arm64.whl:
Publisher:
python-release.yml on RustedBytes/fcwt2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fcwt2-1.5.0-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
afb3ce3c91a4b73eab6b26546f380c76fc4efedb559c838266a97afa252daa14 - Sigstore transparency entry: 1857883994
- Sigstore integration time:
-
Permalink:
RustedBytes/fcwt2@e6e985b54a61a637cbbbe753a5d197235da55772 -
Branch / Tag:
refs/tags/v1.5.0 - Owner: https://github.com/RustedBytes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@e6e985b54a61a637cbbbe753a5d197235da55772 -
Trigger Event:
push
-
Statement type: