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

Metadata

Release files for pyKOOH 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyKOOH 0.5.1
File Size Uploaded
pykooh-0.5.1.tar.gz 933.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyKOOH 0.5.1
File Interpreter ABI Platform
pykooh-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 940.6 kB

Release files / pykooh-0.5.1.tar.gz

Download URL pykooh-0.5.1.tar.gz
Size 933.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2b7705ab6480e7e0c8f3d8c399575f68f05467adc646f0ae67dd53028c0a43cb
BLAKE2b-256 checksum
How to use checksums
5a1a6c1c7d84c8071ae96137045603eb14be428267cd1fae699d5413536c1cdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Release files / pykooh-0.5.1-py3-none-any.whl

Download URL pykooh-0.5.1-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c7b94c08392ff0811b322ddc11f01eac2a3ce36d8eca6cff5833dfbb655c7e8
BLAKE2b-256 checksum
How to use checksums
572f39a0c7efb46b6919e61f6a3bdaa1440a27791348ad51c530b8f89cb85106
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.0

3 release files

0.3.2

2 release files

0.3.1

1 release 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