Skip to content

shikhir-arora/sdft

Repository files navigation

TODO Docs/FAQ/Analysis/Cleanups

(Note: This is very much a WIP and probably will break...😆)


Installation

We use rye, a modern Python packaging and environment management tool, for easy and efficient environment management.

Using rye (Required)

Rye allows you to handle Python environments, install dependencies, and even manage Python versions all within one tool. To install rye, run the following command:

curl -sSf https://rye-up.com/get | bash

After installing Rye, you can use it to install packages or set up your Python environment. For example, to install the package in your current environment:

rye install

Once Rye is set up, it will automatically handle your project's dependencies by reading from pyproject.toml. If you want to create a new virtual environment, Rye does that automatically in the background. You can also install Python itself with Rye, meaning you don’t even need to manage Python installations manually.

Learn more about Rye's capabilities here.


Some Visuals

Figure_1

CleanShot.2023-09-28.at.04.19.42.mp4
CleanShot.2023-09-28.at.04.39.14.mp4

Optimization Benchmarks

See the test files in the tests folder in the repo.


First, for SDFT (sdft -> cython_sdft):

Parameters: n = 1000 samples and the number of runs specified below.

Time taken for 1000 runs (Cython): 0.007804499997291714 seconds
Per loop time (Cython): 7.804499997291713e-06 seconds

Time taken for 1000 runs (Normal): 0.5207489170134068 seconds
Per loop time (Normal): 0.0005207489170134067 seconds

Cython is approximately 66.75 times faster in this example.

Time taken for 100000 runs (Cython): 0.783888083009515 seconds
Per loop time (Cython): 7.83888083009515e-06 seconds

Time taken for 100000 runs (Normal): 47.388167375000194 seconds
Per loop time (Normal): 0.0004738816737500019 seconds

Cython is approximately 60.48 times faster in this case.

yes, it really is that much faster! 🙂


Secondly, for "Stable" SDFT (stable_sdft -> cython_stable_sdft) moving filter (IIR), kth frequency bin, N samples, fs sampling frequency:

Note: See https://www.dsprelated.com/showarticle/796.php and https://www.dsprelated.com/showarticle/1533.php by Rick Lyons, the original author of these algorithms and a wealth of insight!

Parameters: N = 10000 (large!) and the number of runs specified below, k = 5.

Cython Stable SDFT - Time taken for 10000 runs: 1.7372043330105953 seconds
Cython Stable SDFT - Time per loop: 0.00017372043330105954 seconds

Stable SDFT - Time taken for 10000 runs: 2.27197125001112 seconds
Stable SDFT - Time per loop: 0.000227197125001112 seconds

Cython Stable SDFT is faster.

Cython Stable SDFT is approximately 1.31 times faster in this example.

Cython Stable SDFT - Time taken for 1000000 runs: 170.44354233302874 seconds
Cython Stable SDFT - Time per loop: 0.00017044354233302874 seconds

Stable SDFT - Time taken for 1000000 runs: 220.6045451249811 seconds
Stable SDFT - Time per loop: 0.00022060454512498107 seconds

Cython Stable SDFT is faster.

Cython Stable SDFT is approximately 1.29 times faster in this example.

Cython Stable SDFT - Time taken for 100000 runs: 17.084494707989506 seconds
Cython Stable SDFT - Time per loop: 0.00017084494707989505 seconds

Stable SDFT - Time taken for 100000 runs: 22.193888457957655 seconds
Stable SDFT - Time per loop: 0.00022193888457957655 seconds

Cython Stable SDFT is faster.

Cython Stable SDFT is approximately 1.30 times faster in this example.

With a lot of cythoning, we've accomplished the speedups.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published