cpt-anywidget
anywidget viewers for cone penetration tests (CPT) and geotechnical boreholes, rendered with plain D3. Built for notebook use (marimo, Jupyter). Every viewer shares a zoomable vertical axis in depth below surface or elevation, so soundings, borehole logs, and interpretations line up.
Full documentation: bedrock.engineer/docs/cpt-anywidget
Viewers
CPTViewer— one CPT: measurement channels (qc, fs, Rf, u1/u2, inclination, …) against the vertical axis, plus optional layer columns: a nearby borehole log, read-only interpretation columns (e.g. Robertson, Lengkeek), and an editable layer column synced back to Python.BoreholeViewer— a single borehole log with proportional soil-composition bands and hatch patterns;layers_from_bhrgt(brodata BHR-GT) andlayers_from_bore(pygef GEF/BRO XML) convert parsed boreholes into itslayerstrait.ProfileViewer— multiple CPTs side by side along a chainage axis (a cross-section);chainagecomputes along-profile distances from map coordinates.
Install
From PyPI, with uv (recommended):
uv add cpt-anywidget
or with pip: pip install cpt-anywidget.
The bro extra (cpt-anywidget[bro]) pulls in brodata, needed only for
layers_from_bhrgt and layers_from_bore (the lithology color table).
Usage
import polars as pl
from cpt_anywidget import CPTViewer, Channel
df = pl.DataFrame({
"depth": [0.0, 0.02, 0.04], # or "nap" for elevation
"coneResistance": [0.1, 0.4, 0.9], # MPa
"localFriction": [0.01, 0.02, 0.02],
})
CPTViewer(df, vertical="depth", channels=["coneResistance", "localFriction"])
data is tidy columns — a polars or pandas DataFrame or a dict of
equal-length lists — one row per depth sample. The widget never parses file
formats or converts units: loaders (e.g. brodata)
normalize upstream. BRO column names get built-in display defaults; any
other column can be bound with Channel(key, label=…, unit=…, color=…, side=…).
Custom vertical datums work the same way via Vertical(key, label=…, up=…).
Annotations, overlays, and axis limits are plain traits and track the zoom. See Interactions for the pointer and keyboard gestures.
Interactions
Zoom and pan — all viewers
- To zoom the vertical axis, hold the Ctrl key (Cmd on macOS) and turn the mouse wheel. A trackpad pinch also zooms.
- To pan a zoomed axis, drag in the plot area.
- To zoom to a range, hold the Shift key and drag along the axis.
- To reset the zoom, double-click in the plot area.
- Move the pointer across the plot to read the values at that depth.
- The mouse wheel without a modifier key scrolls the notebook, not the chart.
Edit layers — the CPTViewer edit column
- To move a boundary, drag it. A boundary stops at the minimum layer thickness.
- To split a layer, click in the lane beside the column. A dashed line previews where the new boundary goes.
- To merge two layers, move the pointer near their boundary in the lane and click the × it offers. The upper layer keeps its class.
- To set the class of a layer, click the layer. A pie menu opens. Click a wedge, or walk the wedges with the arrow keys and push Enter.
- As a fast path, press the layer, drag toward a wedge, and release.
- To close the pie menu, push the Escape key or click outside the menu.
- Each edit goes back to Python through the
editedLayerstrait.
Select a strip — ProfileViewer
- To select a CPT strip, click it. The name shows in the
selectedtrait in Python. - To deselect the strip, click it again.
Development
Front end (TypeScript, js/) builds into src/cpt_anywidget/static/:
npm install
npm run build # or: npm run dev (watch mode)
Set ANYWIDGET_HMR=1 so JS edits hot-reload in the browser. Sample files
(BRO XML, GEF, AGS) live in examples/.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cpt_anywidget-0.1.0.tar.gz.
File metadata
- Download URL: cpt_anywidget-0.1.0.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c8ca4cdc963d33a14dfd782ac5d77f34579254130b08671c57a2709db09220b
|
|
| MD5 |
721ba159caa832b8d56a9c879bd9785e
|
|
| BLAKE2b-256 |
80d79c0dfb42a316367a2e24cafba81139b228637d9d81b4fb871ad9ecef8e9d
|
Provenance
The following attestation bundles were made for cpt_anywidget-0.1.0.tar.gz:
Publisher:
release.yml on bedrock-engineer/cpt-anywidget
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cpt_anywidget-0.1.0.tar.gz -
Subject digest:
9c8ca4cdc963d33a14dfd782ac5d77f34579254130b08671c57a2709db09220b - Sigstore transparency entry: 2532988336
- Sigstore integration time:
-
Permalink:
bedrock-engineer/cpt-anywidget@ae0a35a3472676102d594a693b983245910760ec -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/bedrock-engineer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ae0a35a3472676102d594a693b983245910760ec -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpt_anywidget-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cpt_anywidget-0.1.0-py3-none-any.whl
- Upload date:
- Size: 149.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6779376d08aa57f1ac02fa6b9ba9c9191267e87613e3af1be2526871d199202
|
|
| MD5 |
195375c0dc48c1e815cb210643b7ca8d
|
|
| BLAKE2b-256 |
2fde57a475ef19f795402f623cc14265eb6e20b4dd41f2531097ee9bba2854b5
|
Provenance
The following attestation bundles were made for cpt_anywidget-0.1.0-py3-none-any.whl:
Publisher:
release.yml on bedrock-engineer/cpt-anywidget
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cpt_anywidget-0.1.0-py3-none-any.whl -
Subject digest:
e6779376d08aa57f1ac02fa6b9ba9c9191267e87613e3af1be2526871d199202 - Sigstore transparency entry: 2532988860
- Sigstore integration time:
-
Permalink:
bedrock-engineer/cpt-anywidget@ae0a35a3472676102d594a693b983245910760ec -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/bedrock-engineer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ae0a35a3472676102d594a693b983245910760ec -
Trigger Event:
push
-
Statement type: