Site Calculation
This repo implements the basics of the site calculation package. This incorporates both the Bayless 2018 model and the Campbell and Bozorgnia 2014 model. It is intended to replace the qcore modules for the same task, as well as being a future home for site calculations including things like backarc modules, kappa0 models, etc in the future. This repo incorporates the lessons of previous designs of this code including:
- Copious documentation. Prior implementations of site amplification models and the amplification process were not well documented. I have tried very hard to pin the equations in the rust code
src-rust/bayless_abrahamson_2018.rsandsrc-rust/campbell_bozorgnia_2014.rsto equations in the paper and document changes in the models per Felipe's thesis. - Rust over numba for complex high-performance code. The benefits of rust code include: speed, correctness, existing library of high-performance code. Numba is great for small blocks, but for code we intend to maintain long-term rust's usability beats Numba's conveniences.
- Single-threaded as fast as possible. Implementing multi-threaded calculations within a library is annoying for downstream application users because (a) the multi-threading model may not be compatible with your model forcing you to turn it off (e.g. NZGMDB), and (b) it can muck up the environment variables of the caller. Instead the code is designed to be run on a single-thread as fast as possible using optimised rust and numpy code. This enables the caller to multi-threading how they like without worrying about extra threads spawned by this library.
Example
import numpy as np
from site_calculation.amplification import (
bayless_abrahamson_2018,
interpolate_frequencies,
amp_lowpass,
amp_highpass,
amplify_waveform,
BAYLESS_ABRAHAMSON_2018_FREQUENCIES,
)
# Compute amplification factors for 2 stations
vs30 = np.array([400.0, 760.0])
vs30_sim = np.array([500.0, 500.0])
pga = np.array([0.1, 0.05])
amp = bayless_abrahamson_2018(vs30, vs30_sim, pga) # (2, n_freqs)
# Interpolate to FFT frequencies
dt = 0.005
n_fft = 2048
fft_freqs = np.fft.rfftfreq(n_fft, dt)
amp_interp = interpolate_frequencies(
BAYLESS_ABRAHAMSON_2018_FREQUENCIES, fft_freqs, amp
)
# Apply lowpass / highpass filters
amp_lowpass(fft_freqs, amp_interp, fmin=0.1, fmidbot=0.5)
amp_highpass(fft_freqs, amp_interp, fhightop=15.0, fmax=25.0)
# amp_interp is now our filter!
# Amplify a waveform
waveform = np.random.randn(2, 2000).astype(np.float32)
result = amplify_waveform(waveform, amp_interp, n_fft)
Repo structure
site_calculation/ # Python package
__init__.py
amplification.py # Amplification models & signal processing
_utils.pyi # Type stubs for the rust extension module
src-rust/ # Rust extension (PyO3)
lib.rs
campbell_bozorgnia_2014.rs
bayless_abrahamson_2018.rs
tests/ # Python test suite
resources/ # Test data (CSV files)
test_amplification.py
data/ # Reference / validation data
Cargo.toml # Rust build configuration
pyproject.toml # Python build & tool configuration
build.rs # Rust build script
Release files for site-calculation 2026.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| site_calculation-2026.7.1.tar.gz | 127.6 kB | Details |
Built distributions (wheels)
Total release size: 4.0 MB
Release files / site_calculation-2026.7.1.tar.gz
| Download URL | site_calculation-2026.7.1.tar.gz |
|---|---|
| Size | 127.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e32970aa5b5f4b2650d94441c75bf0dbe83f82cfe57d38ea258c2ddfa8857e7
|
|
BLAKE2b-256 checksum How to use checksums |
ea0ed8c2513b130fd5e23cbc9455f10ac85541dd897b88563c2002c330509176
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp314-cp314t-win_amd64.whl
| Download URL | site_calculation-2026.7.1-cp314-cp314t-win_amd64.whl |
|---|---|
| Size | 153.5 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-64 |
|
SHA-256 checksum How to use checksums |
81e9bffdc595d85d25044a1d2119e32266d0886c387373b5da1a5c6535f8a897
|
|
BLAKE2b-256 checksum How to use checksums |
e4161c6cd0b224abf7e88361679657243265eb3c89d863daa9d2d7c37e09cf37
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp314-cp314t-manylinux_2_28_x86_64.whl
| Download URL | site_calculation-2026.7.1-cp314-cp314t-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 294.5 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
1c86e27e6d985a827fafef1bbe841060c411df4af00d62ba8ec077ac0815e2ef
|
|
BLAKE2b-256 checksum How to use checksums |
314c03bbd62ccdea3780dd154ee078b15a2d3fac8cda3c1f98bbf9d0976c5511
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp314-cp314t-macosx_11_0_x86_64.whl
| Download URL | site_calculation-2026.7.1-cp314-cp314t-macosx_11_0_x86_64.whl |
|---|---|
| Size | 258.9 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
01804b221c4ed7332052b27693c41f147d0beaf6b48e7def4dc8904af5050340
|
|
BLAKE2b-256 checksum How to use checksums |
67c08981b96ffbef6da17d9f85f946839dc344b914a9db9a343a6a76f0cfeaee
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp314-cp314t-macosx_11_0_arm64.whl
| Download URL | site_calculation-2026.7.1-cp314-cp314t-macosx_11_0_arm64.whl |
|---|---|
| Size | 254.4 kB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5cd24e0c69905436b86073edcde12f2b4981d0e1b091366b435bf5b82788ed69
|
|
BLAKE2b-256 checksum How to use checksums |
0c365f24de7b7cf370e552108f180e4403f85253257db3df278dde86c1a31cc0
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp314-cp314-win_amd64.whl
| Download URL | site_calculation-2026.7.1-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 153.6 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2c428c6d491728f9ab502819a1ae1e4cb95a84293e6da938dc8dfd9dfc1313bb
|
|
BLAKE2b-256 checksum How to use checksums |
55b36d9670475b007be219b249300b9f2c6167bd4f65ecd34afc42e5351d76f0
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp314-cp314-manylinux_2_28_x86_64.whl
| Download URL | site_calculation-2026.7.1-cp314-cp314-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 294.5 kB |
| Tags | CPython 3.14 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
67855ec4c7c3288e753f349b6f6d915e86a05c42ddbca9bdead24c780639a79e
|
|
BLAKE2b-256 checksum How to use checksums |
da5249553e8d6194dba19439703f25e628e2bb9388aaec14f06e48d3b5c62ece
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp314-cp314-macosx_11_0_x86_64.whl
| Download URL | site_calculation-2026.7.1-cp314-cp314-macosx_11_0_x86_64.whl |
|---|---|
| Size | 259.1 kB |
| Tags | CPython 3.14 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
23b2443f599ba737a6158a6742b27c051bb362355915115fdfb7a07ab3415439
|
|
BLAKE2b-256 checksum How to use checksums |
0c696487c0bc361c82214e032d916ea125b28fdc0c0c8672a0215444500d646c
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | site_calculation-2026.7.1-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 254.5 kB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
26db03728f865c738e65f2aae027e545f6e8f25f47497d9fcd7e370bcbd24905
|
|
BLAKE2b-256 checksum How to use checksums |
be7e5335a1b9ce66c060ce6f089c7271ca21d488ea03265df2f620c220039399
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp313-cp313-win_amd64.whl
| Download URL | site_calculation-2026.7.1-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 149.2 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c06018d59f8dd4fdc6c89c30b125e6e671e2fa50a54fada663f0a17c8f11b2de
|
|
BLAKE2b-256 checksum How to use checksums |
ee251c154149e6b6b0967fc28e919b19b455836f05a3372d979f8405dfe5a5b6
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp313-cp313-manylinux_2_28_x86_64.whl
| Download URL | site_calculation-2026.7.1-cp313-cp313-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 294.7 kB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
1d13f6f7a178162a6d81770d9ce1c8a4e3a0caaa90da9f717200fa5db2a644d9
|
|
BLAKE2b-256 checksum How to use checksums |
4c9db1fcdfc26fcc202d7800cbd13f63977ddb774091dd10985f92afe02db2bc
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp313-cp313-macosx_11_0_x86_64.whl
| Download URL | site_calculation-2026.7.1-cp313-cp313-macosx_11_0_x86_64.whl |
|---|---|
| Size | 259.5 kB |
| Tags | CPython 3.13 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
7dbc8d4bb442af684593279e05f749f152d307458955b56ab689d85e5006d5bf
|
|
BLAKE2b-256 checksum How to use checksums |
169c774d399059501ad14293e3a373fe5608b87696f4cad9606a7a32a5a5422f
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | site_calculation-2026.7.1-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 254.9 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9a66ea2e32ed2b73ef91dddb091117775e0f7894526382caa5a7b5883c1ed325
|
|
BLAKE2b-256 checksum How to use checksums |
1d64f7cabee255e847e01a1fca39933aa5a9ace6ba0ac552c2fd40b73154a07b
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp312-cp312-win_amd64.whl
| Download URL | site_calculation-2026.7.1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 149.1 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
94fb0a42617f0b07ea1fd77f4693f54236b66cca96fadea01c6a7921e1fb772f
|
|
BLAKE2b-256 checksum How to use checksums |
9daa42bf56c22675d4e6d05966277e3f8cbd9183e6ebf12bfdfd1e7a5a26c517
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | site_calculation-2026.7.1-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 294.4 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
04868e26bd886f7636ac95bd2abf304c5b392711a31359ec1b3beb5c6819501a
|
|
BLAKE2b-256 checksum How to use checksums |
9006f048f0f9714189ef6eac75853751f467c6c1f7e06f57255af93b73057e78
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp312-cp312-macosx_11_0_x86_64.whl
| Download URL | site_calculation-2026.7.1-cp312-cp312-macosx_11_0_x86_64.whl |
|---|---|
| Size | 259.5 kB |
| Tags | CPython 3.12 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
6d09682045ac3c4bc762d70a565252870298f1611a5deb274574498d161bd83f
|
|
BLAKE2b-256 checksum How to use checksums |
73a8825013bf5cde2798a84d193f20f3049a6fba544786d408025b1f48c97c83
|
| 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 31, 2026.
Transparency logRelease files / site_calculation-2026.7.1-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | site_calculation-2026.7.1-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 254.7 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a6d442b876e7ffcb7aca696befca12a4438aef6ac4e9e999a0fde696d9ecbcf4
|
|
BLAKE2b-256 checksum How to use checksums |
c27db6a53b877e6b372b8b49739feb49eb6b386d73c23ad7df3f7fbb61ed173d
|
| 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 31, 2026.
Transparency log