Skip to main content

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:

  1. 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.rs and src-rust/campbell_bozorgnia_2014.rs to equations in the paper and document changes in the models per Felipe's thesis.
  2. 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.
  3. 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

Metadata

Release files for site-calculation 2026.10.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 site-calculation 2026.10.1
File Size Uploaded
site_calculation-2026.10.1.tar.gz 138.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for site-calculation 2026.10.1
File
site_calculation-2026.10.1-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
site_calculation-2026.10.1-cp314-cp314t-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64 Details
site_calculation-2026.10.1-cp314-cp314t-macosx_11_0_x86_64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ x86-64 Details
site_calculation-2026.10.1-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details
site_calculation-2026.10.1-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
site_calculation-2026.10.1-cp314-cp314-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64 Details
site_calculation-2026.10.1-cp314-cp314-macosx_11_0_x86_64.whl CPython 3.14 CPython 3.14 macOS 11.0+ x86-64 Details
site_calculation-2026.10.1-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
site_calculation-2026.10.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
site_calculation-2026.10.1-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details
site_calculation-2026.10.1-cp313-cp313-macosx_11_0_x86_64.whl CPython 3.13 CPython 3.13 macOS 11.0+ x86-64 Details
site_calculation-2026.10.1-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
site_calculation-2026.10.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
site_calculation-2026.10.1-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
site_calculation-2026.10.1-cp312-cp312-macosx_11_0_x86_64.whl CPython 3.12 CPython 3.12 macOS 11.0+ x86-64 Details
site_calculation-2026.10.1-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details

Total release size: 4.0 MB

Release files / site_calculation-2026.10.1.tar.gz

Download URL site_calculation-2026.10.1.tar.gz
Size 138.2 kB
Tags Source
SHA-256 checksum
How to use checksums
208f121a984dd094f67540c0ea4aced20aeee3f91531c9e97b1ddfc0d3a71c87
BLAKE2b-256 checksum
How to use checksums
f53ae097d964945f182a631d848c9df65e5ac57b4874dfa1912deac8412b9494
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp314-cp314t-win_amd64.whl

Download URL site_calculation-2026.10.1-cp314-cp314t-win_amd64.whl
Size 155.0 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
26fd254e79fcea871299a97b9c63754bab3bfa732fe0ca019163c8faf10bd266
BLAKE2b-256 checksum
How to use checksums
5dd3d077542ccf6156b18ba98e6d4eaadd2f3fd499ce05481f29b262a68b64d5
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp314-cp314t-manylinux_2_28_x86_64.whl

Download URL site_calculation-2026.10.1-cp314-cp314t-manylinux_2_28_x86_64.whl
Size 297.4 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
4079ca959238662431a226c295e1ae1201aa9953f1bbe6ce63abd76e384705e2
BLAKE2b-256 checksum
How to use checksums
3bfd04393ce5babcc943cbbc9260471e4dca1953bd8fd8e5fb0d98bcc47db891
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp314-cp314t-macosx_11_0_x86_64.whl

Download URL site_calculation-2026.10.1-cp314-cp314t-macosx_11_0_x86_64.whl
Size 259.8 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
e7fbfbf9668d2c33e555fe0e452abaa2aba037f497ba8c9e9eb9ae1996e46be9
BLAKE2b-256 checksum
How to use checksums
c8847c9bc0efec368ce93008ecfe18d2685add0c5ff128fa240ffd5863d8ba1a
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp314-cp314t-macosx_11_0_arm64.whl

Download URL site_calculation-2026.10.1-cp314-cp314t-macosx_11_0_arm64.whl
Size 254.9 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
072fde2b82ec1863a3a00715b46a7b9326f239a729b70864b5d03cc350f9420c
BLAKE2b-256 checksum
How to use checksums
00c8dd4288132b24b3420898725dd4734df0d53e083bc9a55d4e22bb8ec61589
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp314-cp314-win_amd64.whl

Download URL site_calculation-2026.10.1-cp314-cp314-win_amd64.whl
Size 155.1 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
7ba79384aff5908dbab1e095459a19f04de0e32cffb6e700bbe8f4a7ea093b58
BLAKE2b-256 checksum
How to use checksums
2af4b0ac152d7619b0cf91d9bd84dbaa3145d0e48e2de8b8e1f3b3a133c72b60
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp314-cp314-manylinux_2_28_x86_64.whl

Download URL site_calculation-2026.10.1-cp314-cp314-manylinux_2_28_x86_64.whl
Size 298.1 kB
Tags CPython 3.14 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b4f605ee2595d679d34b1114c25a00a00988643363fe25c5c186b18b0e9a7e77
BLAKE2b-256 checksum
How to use checksums
f40187ac644868ecdc07d20b4d05de488ae92ba05a3a8b316bd5d918e0f71e1c
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp314-cp314-macosx_11_0_x86_64.whl

Download URL site_calculation-2026.10.1-cp314-cp314-macosx_11_0_x86_64.whl
Size 260.3 kB
Tags CPython 3.14 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
7214a2d1f7bb3b50feb425c1b7d05f8f6dcac0c95e5c701f0bf0d103344e6d7f
BLAKE2b-256 checksum
How to use checksums
469f5495be54682eac01284015ff56f4e092f2f447850e73fc3c12b34fe72bdc
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp314-cp314-macosx_11_0_arm64.whl

Download URL site_calculation-2026.10.1-cp314-cp314-macosx_11_0_arm64.whl
Size 255.5 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
cfc47cebdeab8b7b94b6d4dcd1aaa5f7025308901042ec054ccc8aed1cb197fe
BLAKE2b-256 checksum
How to use checksums
254510d477cf887a78e767598d443f26fab26608999393ca135d9a18e90cf1a3
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp313-cp313-win_amd64.whl

Download URL site_calculation-2026.10.1-cp313-cp313-win_amd64.whl
Size 150.8 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
95ae58ea2ed420f8e1ed6016e552343979d541643c77ffa19c9670224e963f0c
BLAKE2b-256 checksum
How to use checksums
02173c9942f51be9c97913869b72e727a8ed5c796d041def1ef6dd69a4237fbe
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL site_calculation-2026.10.1-cp313-cp313-manylinux_2_28_x86_64.whl
Size 297.9 kB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
dc871dc082266ac4b19598f7bc2e9ddfe77f8ca99e81732903bf4b05d23249a8
BLAKE2b-256 checksum
How to use checksums
26975b67cd8c471e3683ab1d746f88ccc89035c3ed7ce1826b1ccf036309242c
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp313-cp313-macosx_11_0_x86_64.whl

Download URL site_calculation-2026.10.1-cp313-cp313-macosx_11_0_x86_64.whl
Size 260.2 kB
Tags CPython 3.13 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
9897faf9081ab382339f18b9eac8505be5a3cd065bd157f5677cab3e4c6fb14f
BLAKE2b-256 checksum
How to use checksums
6f4a02056e2b33b9da63a3c6a2dfda1a16e8b82269c9def35b5f91b5c157876b
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp313-cp313-macosx_11_0_arm64.whl

Download URL site_calculation-2026.10.1-cp313-cp313-macosx_11_0_arm64.whl
Size 255.4 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
457efcd545b23293bdf59fdf2fcffa3d296c6c5c515daa51da8b2fbf524a2ffe
BLAKE2b-256 checksum
How to use checksums
4daec490b0b57545bb3aac8b206f9e6c926fca2cbc2e50c8997c048adea349c3
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp312-cp312-win_amd64.whl

Download URL site_calculation-2026.10.1-cp312-cp312-win_amd64.whl
Size 150.8 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
019f5e145f5eaed1b8103b1dae00f7f8f3ba34df932d4d41ef0c33ef6bc5069e
BLAKE2b-256 checksum
How to use checksums
cbd02e9ca43bc4413c0c92ca35918260fa824825c50bf1b78f0e575c132e480a
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL site_calculation-2026.10.1-cp312-cp312-manylinux_2_28_x86_64.whl
Size 297.9 kB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
3389a322b5fbe2c7c7dac7260a98c568caf41e794dc003772ab86021d89005a5
BLAKE2b-256 checksum
How to use checksums
5c0f23f5bd65d9d8af42c839a8efb0ba98081e9dea2e259961561ac936da333a
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp312-cp312-macosx_11_0_x86_64.whl

Download URL site_calculation-2026.10.1-cp312-cp312-macosx_11_0_x86_64.whl
Size 259.9 kB
Tags CPython 3.12 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
aa80496a0872b84ce45e34699f64a48300c7db2952171b16ab66d076353e9dbc
BLAKE2b-256 checksum
How to use checksums
f3b11073d55e5d83ec0f09a2dafce86d0cc8bb5856a7dad86bc162d159fd3be6
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 Oct 1, 2026.

Transparency log

Release files / site_calculation-2026.10.1-cp312-cp312-macosx_11_0_arm64.whl

Download URL site_calculation-2026.10.1-cp312-cp312-macosx_11_0_arm64.whl
Size 255.2 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d050a87eaef74bd4fe3e8309f09db61a1a7992e9e1f23fccfbd945e9d7a1c12c
BLAKE2b-256 checksum
How to use checksums
985915e3cd2dbb9c2bd67bf53a2eec5f9e8d3cbbd015116df7f3e41a9a141aa3
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 Oct 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2026.10.1 This release

17 release files

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