Skip to main content

Spectral smoothing in Rust/Python

Project description

PyPI PyPI Python Rust

Fast 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 and 10 for small vectors (see Benchmarks).

Installation

Installation from pypi:

pip install konnoohmachi

Installation from source:

pip install .

Usage

This smoothes some random numbers:

Python

import konnoohmachi

bandwidth = 40

# using fake random data
frequencies = np.arange(1000)
amplitudes = np.random.rand(1000)

smoothed_amplitudes = konnoohmachi.smooth(frequencies, amplitudes, bandwidth)

Rust

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

konnoohmachi-1.0.0-cp310-none-win_amd64.whl (148.8 kB view details)

Uploaded CPython 3.10 Windows x86-64

konnoohmachi-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (222.9 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

konnoohmachi-1.0.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (393.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

konnoohmachi-1.0.0-cp310-cp310-macosx_10_7_x86_64.whl (202.4 kB view details)

Uploaded CPython 3.10 macOS 10.7+ x86-64

konnoohmachi-1.0.0-cp39-none-win_amd64.whl (148.8 kB view details)

Uploaded CPython 3.9 Windows x86-64

konnoohmachi-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (222.5 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

konnoohmachi-1.0.0-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (393.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

konnoohmachi-1.0.0-cp39-cp39-macosx_10_7_x86_64.whl (202.0 kB view details)

Uploaded CPython 3.9 macOS 10.7+ x86-64

konnoohmachi-1.0.0-cp38-none-win_amd64.whl (148.8 kB view details)

Uploaded CPython 3.8 Windows x86-64

konnoohmachi-1.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (222.9 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

konnoohmachi-1.0.0-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (393.1 kB view details)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

konnoohmachi-1.0.0-cp38-cp38-macosx_10_7_x86_64.whl (202.3 kB view details)

Uploaded CPython 3.8 macOS 10.7+ x86-64

konnoohmachi-1.0.0-cp37-none-win_amd64.whl (148.5 kB view details)

Uploaded CPython 3.7 Windows x86-64

konnoohmachi-1.0.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (222.9 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

konnoohmachi-1.0.0-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (393.0 kB view details)

Uploaded CPython 3.7m macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

konnoohmachi-1.0.0-cp37-cp37m-macosx_10_7_x86_64.whl (202.3 kB view details)

Uploaded CPython 3.7m macOS 10.7+ x86-64

File details

Details for the file konnoohmachi-1.0.0-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 1262093446adfa38cb0894133a2e63662cb841c30b9e4bb462917fa1247c0d85
MD5 28dff5d9841bb769b60bf7b1641f2791
BLAKE2b-256 b8cd8a28f4971bfa9d6d0ac8bfa0948f7836e1f6ab7bab94e2ba1d19f3f8fc6e

See more details on using hashes here.

File details

Details for the file konnoohmachi-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fa0f8d2736cee227580692ddb22110f04494a1b52a8b8d163c71e2f9d618257f
MD5 30eb4dbfd305f84ad598d9d4cc46ee30
BLAKE2b-256 b67626f3cd3741c940c452242314e98180e5921648dca754b6260bc199914c6f

See more details on using hashes here.

File details

Details for the file konnoohmachi-1.0.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 75029508cabfdbee8c57c2f01319f26d1d6052370577b723921fef9b07455e3b
MD5 3c6a95ea8ccbbd13d05c8066520ed1b9
BLAKE2b-256 947f645b3f4c0a7aa437a7e614161398888a29550ac4c9c0b6a81253e5612733

See more details on using hashes here.

File details

Details for the file konnoohmachi-1.0.0-cp310-cp310-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 32fc183f16abf9964fac54e8b6d8aa754728d7badf6201d2acb00176b459f9f6
MD5 5cc6cba3c65c28099e812b3f309a35e2
BLAKE2b-256 ef819bb6a920cf4186ca8154a778bf289c9548c9414bdd7d3fccb119d0d667ab

See more details on using hashes here.

File details

Details for the file konnoohmachi-1.0.0-cp39-none-win_amd64.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 d441d22cdebc51bdf285cc66bdf8143aabb2a6e2649dc40de220cf621fa404e9
MD5 d9db26565943ead3d026232c61ec4737
BLAKE2b-256 f1590d3a1355000437321fa2910bfe3327694d2939b243b2f6dba7f7f78199ff

See more details on using hashes here.

File details

Details for the file konnoohmachi-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 af5b22c196c904e83ba47d2b4c6c2edb78dea7e9ab3b537567f2d5c0454b5116
MD5 17a360cda4a786d51077863d1e629de3
BLAKE2b-256 e79c2941c05df516044f96093bc5e0fbb5d283a590656641e717983a59b00eea

See more details on using hashes here.

File details

Details for the file konnoohmachi-1.0.0-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 eb81161f6f6656e20453cacd88e9bd937558ef318bd23d247f82e61a9c2f3983
MD5 c08e4c576710fb22315f92ad6d909ad0
BLAKE2b-256 9eb586a990410bf8452c5b0b3859c43faf75ae5f830cde632cc7b1e0673faccf

See more details on using hashes here.

File details

Details for the file konnoohmachi-1.0.0-cp39-cp39-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 40fce8cd0330f22e1852d9e683e0bda178f19f5b02bc6d80e42fa2db6607e409
MD5 c1f209a9415efeb0a54528b5d5137c1d
BLAKE2b-256 7af85386180fcd74035829b824a438e83fc8cb7447a753410696132a653c4987

See more details on using hashes here.

File details

Details for the file konnoohmachi-1.0.0-cp38-none-win_amd64.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 83f54027dceff5ec90e2eb17d0faf1d7cf4c01504528e25a32b5108825b4f048
MD5 ca74e8d4cf7ce821ef25ca1650f5bce1
BLAKE2b-256 deddc136e897960f9330e8d87be3f68d563fd752b9763d125f9df880daeaacd9

See more details on using hashes here.

File details

Details for the file konnoohmachi-1.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f9da7863246a5442b81f01f746cfa22f51e062105fc2e8eca404a0c6a69edf98
MD5 1dfff9169e0f427f8ad1288c82d3b313
BLAKE2b-256 25f9a08a8bdee404543219dcf84eb1f275c8cfb2775120d6b90373320291f43e

See more details on using hashes here.

File details

Details for the file konnoohmachi-1.0.0-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 62ff387d98821bba16e4abe5c0fa2b6012d2cfaad4cc4aa674608c01f6b97d63
MD5 e78ebdaf12f631e33167fd6108a608d0
BLAKE2b-256 e6cccda5d7ab6b273a28fca0cc8dc4b72167e4b3386944f42c1899fbcdb38b44

See more details on using hashes here.

File details

Details for the file konnoohmachi-1.0.0-cp38-cp38-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 94167833622a307af950c51d6ca9db59c7060ef715a4a0e9eb453d44192570ae
MD5 345de5277f869ab9dffa030bf71a31da
BLAKE2b-256 effdaf7f58fc25a25c5a0d95c49caf4e6669835a85e413480c34b6886f175198

See more details on using hashes here.

File details

Details for the file konnoohmachi-1.0.0-cp37-none-win_amd64.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 a91afff103df0c3932dc1fb9e7ef161e6c4e7aff5820f2696144f87826ea3d7f
MD5 0c704d0d68cc9997c72220df822bae5f
BLAKE2b-256 2203c8a200f76ee0f32aaeff7537a1ea82019681a76a3f1a49ece3b07651450a

See more details on using hashes here.

File details

Details for the file konnoohmachi-1.0.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3dda3fff2039f833adcf0c5dfec02932c07fbe2199e833b138dbef1c75cde5d5
MD5 54f467776dde2e7c09d4956ffce0a254
BLAKE2b-256 67fb13ef9c9100d146aa9a71637df21b41db4eab76ef5e049e6729860548ed5a

See more details on using hashes here.

File details

Details for the file konnoohmachi-1.0.0-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 c42064235431d05d77493ca16382e1952b5987ee7afe48a3b9c2e592bdf86366
MD5 8f2182243b55b8e0a788513a37df7812
BLAKE2b-256 fc845ce57e93df6ebac9bc53a4488a53a7702141e0e7e5f19bfdda4de6caab46

See more details on using hashes here.

File details

Details for the file konnoohmachi-1.0.0-cp37-cp37m-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for konnoohmachi-1.0.0-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 25499fbe1e59bda7eb6d9428d7353ca2290f66506b71e079624a8c60f610e14a
MD5 d1ed73433a7e6c15a1cfc588980a1961
BLAKE2b-256 5c5738a20a8d0b69cdad1e77157f2ce5fd4fcfbb60e15dba834d3333840a5aaa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page