Spectral smoothing in Rust/Python
Project description
Konno-Ohmachi spectral smoothing
Implemented in Rust with a Python interface. The performance gain measured against the widely used Python/numpy implementation that comes with obspy approaches approximately a factor of 2.5 for large spectra (see Benchmarks).
Dependencies
You need the rust compiler installed:
Installation
Installation from pypi:
pip install konnoohmachi
Installation from source:
pip install .
Usage
This smoothes some random numbers:
import konnoohmachi
b = 10
n = 1000
freqs = np.arange(n)
amplitudes = np.random.rand(n)
smoothed = konnoohmachi.smooth(freqs, amplitudes, b)
use konnoohmachi;
let frequencies = Array1::<f64>::zeros(10);
let amplitudes = Array1::<f64>::ones(10);
let bandwidth = 40.0;
konnoohmachi_smooth(
frequencies.view().into_dyn(),
amplitudes.view().into_dyn(),
bandwidth,
);
Benchmarks
Measuring the execution time based of increasing sized spectra yields:
❯ python3 benchmark.py
nsamples | Rust | Python | Performance Gain
----------------------------------------------------------
256 | 0.00017 | 0.00192 | 11.30802
512 | 0.00054 | 0.00431 | 7.97596
1024 | 0.00198 | 0.01117 | 5.63623
2048 | 0.00775 | 0.03143 | 4.05371
4096 | 0.03067 | 0.10024 | 3.26844
8192 | 0.12212 | 0.35058 | 2.87080
16384 | 0.49391 | 1.29653 | 2.62506
32768 | 1.98499 | 5.05335 | 2.54578
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
konnoohmachi-0.2.0.tar.gz
(5.1 kB
view hashes)
Built Distributions
Close
Hashes for konnoohmachi-0.2.0-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abdfe605482a5609f3a0ec9885094f28855e8980fd6070bfd4e23b97e00195e0 |
|
MD5 | 2c565e381f52dcbcc532a560130cd2e2 |
|
BLAKE2b-256 | 51a29d393fcb60571e9b7c79a032eadfbb7617f189648a7b20db5ae4272718c9 |
Close
Hashes for konnoohmachi-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e70a0524cf2fbe6bc2564f47e000cb91c7877a8d299e193385715234bf28d2c |
|
MD5 | f4b910b9f9f90ad4380c8e9f31870e31 |
|
BLAKE2b-256 | 987a1c8bd1e7a7d56086abf5e3b44461d0fa40b69eafd9f568801c41d933b6cf |
Close
Hashes for konnoohmachi-0.2.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9be8fca1a7abd86679ec01e47b62afaa75b7f123b101d6cc50ee265b3867204d |
|
MD5 | 09d52cf71a56eeff2af8423d22d805d0 |
|
BLAKE2b-256 | d61289000c62ba68d485f988cbccad991d58389a9a7f14f1e94d3c5939b5e44d |
Close
Hashes for konnoohmachi-0.2.0-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8493615ba0253d8bd5377d66d213b8caa16d0a11dfbaa78b4e6da1b637405441 |
|
MD5 | 8d82f69d824f17411259a5a7416e344c |
|
BLAKE2b-256 | 50549b3e5f00ffab4c3d5bc2fe724ab55ceea3634608080222923c103c86ab8a |
Close
Hashes for konnoohmachi-0.2.0-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f46bff1f8ceaca7f11304126a67223a05c5f1aaca9e16ae6b3c9e68543b2e2cb |
|
MD5 | 8e163eed0608d61a2ebb174cde58e60c |
|
BLAKE2b-256 | 35c92c3a3f4b2025b5f3a426d0cee6a72fc21ec2ec8bcc3a93dd76dd4e4a199e |
Close
Hashes for konnoohmachi-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 235d1756979d11960054cacf7160e70e04735232bf776880f8f9914b07de8a82 |
|
MD5 | 6191d2516cc9f5ecbb2e977e4b8ef78a |
|
BLAKE2b-256 | 3eaff6ea348c7459bc21abc49f72b2713cb9101a0490583c885b84cbda887c9f |
Close
Hashes for konnoohmachi-0.2.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf9135d2475a50fdd823a19ee7704527b94a86c7e16211942a91d03a8eb1de9d |
|
MD5 | d1f5d99e59c91088fc9ef64de7abd4bc |
|
BLAKE2b-256 | 08e5b7ccd6605bb61ec007edd01c0b6073e00a4aeaaf0619a540bc4293f32deb |
Close
Hashes for konnoohmachi-0.2.0-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7871e7d160bc9b01fe5320c8f5c0145ec04881aa181e8cfd38ca9a9b73d37acb |
|
MD5 | 3ed8f18337e750c84beab189cee4f5a9 |
|
BLAKE2b-256 | f14fea41fb93295628b56d156b1e627b8e40fa299b172bcad6af74aba05cbe8c |
Close
Hashes for konnoohmachi-0.2.0-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f226f63439654e6d5389c73f9827757ae7a131a361035a33bed6473509ff041 |
|
MD5 | 913c3b16becd514077fe10d0200a69d6 |
|
BLAKE2b-256 | 59f1be354450e61680720fd7b6b3d804a934672529c0e2082ac16d3b6a5900e3 |
Close
Hashes for konnoohmachi-0.2.0-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62dde8f06db3e364f64f84882b3baef8ec92aa1c59e2590f4f63924ccbd578a9 |
|
MD5 | 30ab57853a3a5375e212ff5549102906 |
|
BLAKE2b-256 | aeecf6143f2e52c6d6a5500afda09d498dc862688ffd289a340fd651648f7180 |
Close
Hashes for konnoohmachi-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 601924a852591f15a275bf78ff93588f9924501dca884b5a026985d7c83577c8 |
|
MD5 | a4d69bbaa9b8b8b27ce063fc38dbb2ae |
|
BLAKE2b-256 | 003a54c21241ccfa96a57ba6541e228dac5b92582c92e3a32caf2997837ed273 |
Close
Hashes for konnoohmachi-0.2.0-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65c90e94194a296953706dc181e3e5d8f2b1f99ae4cc674356bc48fca97207e2 |
|
MD5 | 317a0f8b3e4c13e2030326c06c52b535 |
|
BLAKE2b-256 | 381368848a2515ea03b7825d3a811b7a8d2c9b2188050773e736859b63cf868c |
Close
Hashes for konnoohmachi-0.2.0-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04c25c1b04c3ff77e64a7c96e29a923ca677b941cbf41246b652198c31898411 |
|
MD5 | 7df53556512852dfbafbf6e4e96ba39a |
|
BLAKE2b-256 | 71da77c0e9561d9d84802a3a7e9d6a56e4f2a28b183473e18a8d9d09ec50aa15 |
Close
Hashes for konnoohmachi-0.2.0-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a3f5fe390cd7ec2c7b96d19bc1bd9a0d267cdbf133431839b35de500ba5ce30 |
|
MD5 | 075122d22ff01acaf8810645c3b0abe1 |
|
BLAKE2b-256 | b73c15e5ab3e52cbaa828030f21d8df3fa8e6fea62bcf832b5692e7ba8d7deb4 |
Close
Hashes for konnoohmachi-0.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47b9ad505bf2fa55090e6f3412d0e0fc03563a938045c27ed891d425425052b4 |
|
MD5 | 2dfe5c42490f8e2c3575702efa7e2810 |
|
BLAKE2b-256 | f7e44d08b103704e329f6d10e07fb2c2b1d790ecfd44ca93a166446d3b8fe468 |
Close
Hashes for konnoohmachi-0.2.0-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8a001efe974101c0cc6e3cbfe392fe91ad3e027071debd826dda07119e7e8d5 |
|
MD5 | 0acf0f76d5adac14f668a4def4077afd |
|
BLAKE2b-256 | 806dffc235d7bad7f3d1103aae94ee91545c6bf4cdc4bd2e97b5799475b0ee03 |
Close
Hashes for konnoohmachi-0.2.0-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a1f04431d3079abeb6faeb9201837f95faac7e7cf5d272b97017b66152034b5 |
|
MD5 | 843d3ac21523fde1fec3499687bcb81c |
|
BLAKE2b-256 | dbc0bde2d0cea526187df450c73bdf3c88e81c2f9560f1b07b86e5937904189e |