This release is a pre-release and may not be stable for production use.
opencpt
Open-source Python library for CPT (cone penetration test) analysis: site characterization, liquefaction triggering by Boulanger & Idriss (2014) and shear wave velocity from CPT. It is the engine of the OpenCPT app.
Alpha. The API may change between 0.x releases.
pip install --pre opencpt
Example
import numpy as np
from opencpt import corrected_cone_resistance, triggering_bi2014
from opencpt.site import site_profile
from opencpt.shear_wave import vs_assaf2023_a07, time_averaged_vs
# A made-up 10 m sounding: loose sand under a 2 m clay crust (kPa, m).
depth = np.arange(0.5, 10.01, 0.5)
qc = np.where(depth < 2, 600.0, 4000.0 + 300 * depth)
fs = np.where(depth < 2, 25.0, 30.0)
u2 = np.where(depth < 2, 40.0, 9.81 * np.clip(depth - 1.5, 0, None))
qt = corrected_cone_resistance(qc, u2, area_ratio=0.8)
result = triggering_bi2014(depth, qt, fs, gwt=1.5, mw=7.5, amax=0.3)
result.critical_layers # [(2.0, 10.0)]
result.critical_thickness # 8.0 m
result.fsl # factor of safety per reading; NaN where not assessed
site = site_profile(depth, qt, fs, gwt=1.5)
vs = vs_assaf2023_a07(site.qt, site.ic, depth)
time_averaged_vs(depth, vs) # (132.1, 10.0): Vs over the 10 m covered, m/s
Profile inputs accept array-like values; numerical result fields use NumPy arrays. Units are SI: depth in m, cone readings and stresses in kPa, unit weight in kN/m³, Vs in m/s, amax in g.
Methods
| Module | What | Source |
|---|---|---|
opencpt.site |
qt from u2, unit weight, stresses, Ic with the stress exponent iterated | Boulanger & Idriss (2014) Eq. 2.3; Robertson & Cabal (2010); Robertson (2009) |
opencpt.liquefaction |
Deterministic triggering: FC from Ic, qc1Ncs, rd, CSR, MSF, Kσ, CRR (C0 = 2.80), FSL and critical layers | Boulanger & Idriss (2014), Report UCD/CGM-14/01, Eqs. 2.2–2.30; rd from Idriss & Boulanger (2008) |
opencpt.shear_wave |
Vs from the A07 and MG15_qc regressions for Metro Vancouver post-glacial sediments; time-averaged Vs (Vs30) | Assaf, Molnar & El Naggar (2023), Soil Dyn Earthq Eng 165:107693; coefficients from Assaf (2022), Table B-1 |
Choices worth knowing:
- u2 is used as measured, so a negative reading reduces qt (Eq. 2.3).
- Readings with qt or fs missing, qt ≤ 0 or fs < 0 are flagged
invalidand get no FSL. Their unit weight is interpolated so the stresses below stay defined. triggering_bi2014assesses readings down tomax_depth(20 m by default) and leaves deeper ones out.max_depthcan be at most 34 m, the depth to which rd is defined; a larger value raisesValueError, as doesstress_reduction_coefficientfor any depth deeper than 34 m. Below 20 m, Idriss & Boulanger (2008) recommend CSR from a site response analysis instead.- A critical layer's thickness is measured from its first to its last reading with FSL ≤ 1. Runs are merged across gaps of up to 0.1 m and kept from 0.4 m thick.
- The Vs regressions were fitted to 1 m averages of CPT readings; they are applied here per reading.
Validation
tests/test_ran20100.py reproduces Fig. 3 of Javanbakht et al. (2025), Soil Dyn Earthq Eng
189:109101, for CPT RAN20100 in Richmond, BC (GWT 3 m, amax 0.3 g):
| Paper | opencpt | |
|---|---|---|
| Critical thickness, Mw 7.5 | 13.8 m | 13.55 m |
| Critical thickness, Mw 9.0 | 14.2 m | 13.70 m |
| qc1Ncs over critical layers | 101 ± 17–18 | 100–101 ± 16–17 |
The thickness differs by up to 0.5 m, most likely because of how layer boundaries are measured.
The CPT data come from the MVSMMP CPT database (Javanbakht et al. 2024,
doi:10.5683/SP3/XFJR0P) and are not distributed with this
package. Set OPENCPT_MVSMMP_DATA to the folder of CPT CSV files to run the test; it is skipped
otherwise.
Development
uv run pytest
MIT license.
Metadata
Release files for opencpt 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| opencpt-0.1.0a1.tar.gz | 11.6 kB | With provenance | Details for opencpt-0.1.0a1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| opencpt-0.1.0a1-py3-none-any.whl | Python 3 | none | any | Details for opencpt-0.1.0a1-py3-none-any.whl |
Total release size: 23.4 kB
Release files / opencpt-0.1.0a1.tar.gz
| Download URL | opencpt-0.1.0a1.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8938b8cef1347747b35b9f9eebd297dbd58117ec761332d9aa1e4b770b1a3525
|
|
BLAKE2b-256 checksum How to use checksums |
c948158a5e8c86dca196452c453a3868d5de8a4545d95f2a2dacaf0a0f4f799d
|
| 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 18, 2026.
Transparency logRelease files / opencpt-0.1.0a1-py3-none-any.whl
| Download URL | opencpt-0.1.0a1-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d6722abcc133deb67186f42a9e4e8709f44ee66e4daf50548a3330407b58be04
|
|
BLAKE2b-256 checksum How to use checksums |
f61729d98dee30f847660727bce3e34a3f43f69f538d9db2dc28998e2fe8974d
|
| 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 18, 2026.
Transparency logSecurity for opencpt 0.1.0a1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for opencpt-0.1.0a1.tar.gz
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 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.