Skip to main content

A Python binding for the eFFT library

Project description

We introduce eFFT, an efficient method for the calculation of the exact Fourier transform of an asynchronous event stream. It is based on keeping the matrices involved in the Radix-2 FFT algorithm in a tree data structure and updating them with the new events, extensively reusing computations, and avoiding unnecessary calculations while preserving exactness. eFFT can operate event-by-event, requiring for each event only a partial recalculation of the tree since most of the stored data are reused. It can also operate with event packets, using the tree structure to detect and avoid unnecessary and repeated calculations when integrating the different events within each packet to further reduce the number of operations.

⚙️ Installation

eFFT is provided as a header-only file for easy integration and relies solely on C++ standard and Eigen3 libraries.

Note: FFTW3 served as the benchmark for testing and evaluation. To enable it, define EFFT_USE_FFTW3 during compilation (e.g., -DEFFT_USE_FFTW3).

📦 Dependencies

For C++ usage, the following dependencies are required:

  • C++ compiler with C++17
  • CMake ≥ 3.20.0
  • Eigen ≥ 3.4.0
  • FFTW3 ≥ 3.3.8 (optional; see EFFT_USE_FFTW3)
  • (dev-only) GTest, Google Benchmark

For Python usage, dependencies are defined in python/pyproject.toml and the build dependencies are fetchable via python/CMakeLists.txt.

🖥️ Usage

Here's a minimal working example:

eFFT<128> efft;           // Instance
efft.initialize();        // Initialization

Stimulus e(1, 1, true);   // Event insertion
efft.update(e);           // Insert event

efft.getFFT();            // Get result as Eigen matrix

And another example handling event packets:

eFFT<128> efft;                   // Instance
efft.initialize();                // Initialization

Stimuli events;
events.emplace_back(1, 1, true);  // Insert event
events.emplace_back(2, 2, true);  // Insert event
events.emplace_back(3, 3, false); // Extract event
efft.update(events);              // Insert event

efft.getFFT();                    // Get result as Eigen matrix

Please refer to the official documentation for more details.

🐍 Python Bindings

The eFFT library also provides Python bindings for seamless integration into Python-based workflows. These bindings are built using nanobind and offer the same functionality as the C++ library. You can build and install the bindings using the following commands:

cd python
pip install .

However, you can also use PyPI to install the package directly:

pip install efft

Here's an example of how to use the Python bindings:

from efft import Stimulus, Stimuli, eFFT

efft = eFFT(128)                  # Create an eFFT instance with a frame size of 128
efft.initialize()

event = Stimulus(1, 1, True)      # Insert a single event
efft.update(event)

fft_result = efft.get_fft()       # Retrieve the FFT result

events = Stimuli()                # Insert multiple events
events.append(Stimulus(2, 2, True))
events.append(Stimulus(3, 3, False))
efft.update(events)

fft_result = efft.get_fft()       # Retrieve the updated FFT result

📜 Citation

If you use this work in an academic context, please cite the following publication:

R. Tapia, J.R. Martínez-de Dios, A. Ollero eFFT: An Event-based Method for the Efficient Computation of Exact Fourier Transforms, IEEE Transactions on Pattern Analysis and Machine Intelligence, 2024.

@article{tapia2024efft,
  author={Tapia, R. and Martínez-de Dios, J.R. and Ollero, A.},
  journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
  title={{eFFT}: An Event-based Method for the Efficient Computation of Exact {Fourier} Transforms},
  year={2024},
  volume={46},
  number={12},
  pages={9630-9647},
  doi={10.1109/TPAMI.2024.3422209}
}

📝 License

Distributed under the GPLv3 License. See LICENSE for more information.

📬 Contact

Raul Tapia - raultapia@us.es

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

efft-1.0.2.tar.gz (17.3 kB view details)

Uploaded Source

Built Distributions

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

efft-1.0.2-cp314-cp314-macosx_15_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.14macOS 15.0+ ARM64

efft-1.0.2-cp312-cp312-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.12Windows x86-64

efft-1.0.2-cp312-cp312-manylinux_2_34_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

File details

Details for the file efft-1.0.2.tar.gz.

File metadata

  • Download URL: efft-1.0.2.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for efft-1.0.2.tar.gz
Algorithm Hash digest
SHA256 50dbc1150d8fddca82a54376c688bfcd624f52599abbd205136f8a67339d2179
MD5 c92031e38d3e1d2787969365769b3992
BLAKE2b-256 8a5d8c64f8680b6cc732c0022db72c960340084c1fa22b30c67103e13f820311

See more details on using hashes here.

Provenance

The following attestation bundles were made for efft-1.0.2.tar.gz:

Publisher: cd.yaml on raultapia/efft

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

File details

Details for the file efft-1.0.2-cp314-cp314-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for efft-1.0.2-cp314-cp314-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 1cd4334d0a34b23d5d548c75be0e601580cbb781b7f2ee6c38a13eea1c5f555a
MD5 4d0859c9caa0b0a70ae2b4ace2ebebda
BLAKE2b-256 d0cf128b1ff1ff5424dc5960033af33fcd2cff2cef892cb5a1f2650b4a27076a

See more details on using hashes here.

Provenance

The following attestation bundles were made for efft-1.0.2-cp314-cp314-macosx_15_0_arm64.whl:

Publisher: cd.yaml on raultapia/efft

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

File details

Details for the file efft-1.0.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: efft-1.0.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for efft-1.0.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1c08b258dfb5ab18a22896ca3174f03e9d3d15e5112ab712cd044e54f7c8cdf1
MD5 14c48706c4cada1e672249da3058c5d2
BLAKE2b-256 4ac32f830720afd6499005b72b0d1257fb60d2f52d92a3eba1f3a6864d5c50e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for efft-1.0.2-cp312-cp312-win_amd64.whl:

Publisher: cd.yaml on raultapia/efft

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

File details

Details for the file efft-1.0.2-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for efft-1.0.2-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6450b5c1f7cacc59bb78d610b5329c1dfd3eb7a3a192a0570bcc36e8e479d7db
MD5 d979d74765a2e47e84e5040e27e3059d
BLAKE2b-256 ed90dd2b33ef6a5dc73bbebdd05f91146e9b1ac077afd30ccfd5e5e5cefc1e71

See more details on using hashes here.

Provenance

The following attestation bundles were made for efft-1.0.2-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: cd.yaml on raultapia/efft

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