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.2

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.2
File Size Uploaded
site_calculation-2026.10.2.tar.gz 153.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for site-calculation 2026.10.2
File
site_calculation-2026.10.2-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
site_calculation-2026.10.2-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.2-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.2-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details
site_calculation-2026.10.2-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
site_calculation-2026.10.2-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.2-cp314-cp314-macosx_11_0_x86_64.whl CPython 3.14 CPython 3.14 macOS 11.0+ x86-64 Details
site_calculation-2026.10.2-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
site_calculation-2026.10.2-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
site_calculation-2026.10.2-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.2-cp313-cp313-macosx_11_0_x86_64.whl CPython 3.13 CPython 3.13 macOS 11.0+ x86-64 Details
site_calculation-2026.10.2-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
site_calculation-2026.10.2-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
site_calculation-2026.10.2-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.2-cp312-cp312-macosx_11_0_x86_64.whl CPython 3.12 CPython 3.12 macOS 11.0+ x86-64 Details
site_calculation-2026.10.2-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.2.tar.gz

Download URL site_calculation-2026.10.2.tar.gz
Size 153.5 kB
Tags Source
SHA-256 checksum
How to use checksums
46a203eec63b24c1070e76f4c2c850994343a87b5a3cbf4c241e5f4d2e816d75
BLAKE2b-256 checksum
How to use checksums
b97cd82536aa7012e8b39d3f88405f59397266650cda9dddab809d97bbc36c49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp314-cp314t-win_amd64.whl
Size 156.5 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
803b56b101bd310175fa915b52cb59b72434420545184deda4e38660c2e7de02
BLAKE2b-256 checksum
How to use checksums
841beefcbdbe5fff9e04ec66c86aeaac6bcb1e3d8f1d23cb2ba7338e2d672085
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp314-cp314t-manylinux_2_28_x86_64.whl
Size 297.5 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
96cbddbf16dd1e614d486d15d0057378ac045c78a0b94691257b5bb894d26892
BLAKE2b-256 checksum
How to use checksums
9a99958d326e0a09d00cd2f7330d9348b7c83ddf9b85c799e212a337d97b1001
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp314-cp314t-macosx_11_0_x86_64.whl
Size 261.9 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
276a17d2f50bbc97eca8c048b4ce6b02ae6b1b320397e2a14120dc448919ad32
BLAKE2b-256 checksum
How to use checksums
7e839ea5a305b2404f5430efd9dcf8f2b2518f995c33e74e93d74095bdde099c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp314-cp314t-macosx_11_0_arm64.whl
Size 256.6 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1190fc27f9ab4b706dbc34026b608dcaaf5a617b17bc61b1b08f89b0e0c65abd
BLAKE2b-256 checksum
How to use checksums
c11c6a1f7d637bb1bddb2368f7ff4db701dfc698a290f924419bd18c6174fc23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp314-cp314-win_amd64.whl
Size 156.9 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
06ca8350dcc97e5ede90962d6f6d70937a7ba0864b8c8a1164614a503742eb50
BLAKE2b-256 checksum
How to use checksums
123949967fdf3b45190e62feb8b0ee32fd1c587b520a54da8a21ab57c62faa0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp314-cp314-manylinux_2_28_x86_64.whl
Size 298.0 kB
Tags CPython 3.14 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
0b77f62255b458f53e36697f24823d1430f439dae55d2f8b2e9425183c07ceae
BLAKE2b-256 checksum
How to use checksums
043547ff08e9268edd92b190eb21fbe957bf437a8be111110767f13859691fb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp314-cp314-macosx_11_0_x86_64.whl
Size 262.6 kB
Tags CPython 3.14 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
eb3f8ebcc7b0d148e8b7df3cb12e12c2bf87f6db2ee1899ad925ee5a0898b910
BLAKE2b-256 checksum
How to use checksums
f4b9dc5f87e54a022ab6d48b8ce3289629f9e44e8693dd1d708e333177f178c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp314-cp314-macosx_11_0_arm64.whl
Size 257.2 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5440b73702bb7f5f98663220a96e99ad79992eff4268ae72fbeff0be242213b0
BLAKE2b-256 checksum
How to use checksums
98229b62cb08904c16d3ba3fd2603da945153f667564b0ec5d31087349ddeea8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp313-cp313-win_amd64.whl
Size 152.3 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
b8b871cd11e283e2fdf5a470b0ab1998a8908a9569c2460d7b5ca5e6cbbc314a
BLAKE2b-256 checksum
How to use checksums
c7c27167d5dac192ddb8e87af5f3f58cc0be6d315a7c20fef5d221e4a1f12331
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp313-cp313-manylinux_2_28_x86_64.whl
Size 297.6 kB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
9cc51d6ffdc5461a1443939e14f3bd5f01bc67eae6afe44c3afad81b4ef03e39
BLAKE2b-256 checksum
How to use checksums
e3a26323b853f2d600e390bac63760c5a155a18bf02751ca75c687eba86db722
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp313-cp313-macosx_11_0_x86_64.whl
Size 262.6 kB
Tags CPython 3.13 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
7db60a963ca3daae40814cbfd078cbde18388d14bfe26a9bba37125f83d7c06b
BLAKE2b-256 checksum
How to use checksums
73220a32738ba4604cdff8464502f78b6333d0017fcd0c95f91ccad3382a0d6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp313-cp313-macosx_11_0_arm64.whl
Size 257.4 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bcbcf19b5682e012060a677387f28d2349be12d418e2889f19db72ad88d7d73d
BLAKE2b-256 checksum
How to use checksums
d720929755a8096d1e49da8d11bee89690c12d7055adc137a74d9e984f76e318
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp312-cp312-win_amd64.whl
Size 152.1 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
47a72d56581c872bb81cdccd078134ea97186e0c40a51654548951dab5028cb2
BLAKE2b-256 checksum
How to use checksums
1f504983d9fa3b001ec548686e82fdef2ee96714978527d66a64cc1605a95790
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp312-cp312-manylinux_2_28_x86_64.whl
Size 298.1 kB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
7fb4fb1d5d80a232742fb2e9ece2fa74f3069ba9567e84778a66fd1bef261fb2
BLAKE2b-256 checksum
How to use checksums
8df003e23962a83dc61bf4488d88dbe2f36550eae923871f1e1ecc908b1c2448
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp312-cp312-macosx_11_0_x86_64.whl
Size 262.6 kB
Tags CPython 3.12 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
9e176e7b716ac08e8f63161274758a4aea4b41697d3e48ba641e698f248141c3
BLAKE2b-256 checksum
How to use checksums
fdde3234211c23bcacf0802984dcc7cb9dea8acb826f918f282b86c57341248b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

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

Download URL site_calculation-2026.10.2-cp312-cp312-macosx_11_0_arm64.whl
Size 257.3 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
071b9569be6add2e5adaa17265eb7f476332192f280891f8063e0d8030bd4662
BLAKE2b-256 checksum
How to use checksums
94da2ef3bfb6acc9d02bb6d5caab64e739bb6beccedbefdae333ec7d75adfe6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2026.10.2 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