Skip to main content

pykooh

PyPi Cheese Shop Build Status Code Quality Test Coverage License DOI

Konno Ohmachi filter implemented in Numba.

This code implements Konno-Ohmachi spectral smoothing as defined in:

Konno, K. and Ohmachi, T., 1998. Ground-motion characteristics estimated
from spectral ratio between horizontal and vertical components of
microtremor. Bulletin of the Seismological Society of America, 88(1),
pp.228-241.

This code was originally written for smoothing submodule in gmprocess by Bruce Worden. Dave Boore has provided notes on this topic, which also may be of interest. Notes regarding the characteristics of the Konno-Ohmachi filter and the implementation are provided in the implementation Jupyter Notebook.

Installation

pykooh is available via pip and can be installed with:

pip install pykooh

pykooh uses numba for fast implementation of the filter.

Implementation Notes

Previous versions of pykooh supported both Numba and Cython implementations. Testing showed that both implementations provided similar calculation speeds, but Cython required significantly more effort for packaging and distribution. Therefore, Cython support has been removed in favor of the Numba-only implementation which provides excellent performance with much simpler packaging.

Usage

Two primary approaches for using this library. Smooth a signal using a bandwidth of 30.

import pykooh
signal_smooth = pykooh.smooth(freqs, freqs_raw, signal_raw, 30)

If you are okay with a little bit of inaccuracy, you can pass simplified=True and have a 10x increase in speed. In other instances, where the smoothing is repeated applied, it might make more sense to use the CachedSmoother. This pre-computes the weights and then applies them with np.dot.

import pykooh

smoother = CachedSmoother(freqs_raw, freqs, 30)

signal_smooth = smoother(signal_raw)

By default, all of the smoothing functions normalize that weights, which is different than the default behavior of obspy. By normalizing the weights, the amplitude of the FAS is perserved regardless of spacing of the frequency values. Comparison of the smoothing provided by pykooh is compared with that of obspy in the following figure. The simplified numba routine results in some minor reduction in accuracy.

Method Comparison

Additional examples and comparison with obspy are provided in example.

Citation

Please cite this software using the following DOI.

Albert Kottke. (2025). arkottke/pykooh (v0.5.0). Zenodo. https://doi.org/10.5281/zenodo.15499453

Download files

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

Source Distribution

pykooh-0.5.1.tar.gz (933.3 kB view details)

Uploaded Source

Built Distribution

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

pykooh-0.5.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file pykooh-0.5.1.tar.gz.

File metadata

  • Download URL: pykooh-0.5.1.tar.gz
  • Upload date:
  • Size: 933.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pykooh-0.5.1.tar.gz
Algorithm Hash digest
SHA256 2b7705ab6480e7e0c8f3d8c399575f68f05467adc646f0ae67dd53028c0a43cb
MD5 7eaea62077946a989be4b49f3ad1a9b2
BLAKE2b-256 5a1a6c1c7d84c8071ae96137045603eb14be428267cd1fae699d5413536c1cdc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pykooh-0.5.1.tar.gz:

Publisher: python-publish.yml on arkottke/pykooh

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

File details

Details for the file pykooh-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: pykooh-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pykooh-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3c7b94c08392ff0811b322ddc11f01eac2a3ce36d8eca6cff5833dfbb655c7e8
MD5 6c64d771e7bd6260842d6de61260bfd2
BLAKE2b-256 572f39a0c7efb46b6919e61f6a3bdaa1440a27791348ad51c530b8f89cb85106

See more details on using hashes here.

Provenance

The following attestation bundles were made for pykooh-0.5.1-py3-none-any.whl:

Publisher: python-publish.yml on arkottke/pykooh

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

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 files

0.5.0

2 files

0.4.0

3 files

0.3.2

2 files

0.3.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page