pycsamt.format.pointcloud#
Generic point-cloud extraction from any PCSFModel geometry kind.
Phase 7 of the PCSF format plan needs a 3-D view that works the same
way regardless of which backend produced the file — “no backend-
specific glue code in the view layer” is the phase’s own definition of
done. pcsf_to_point_cloud() is that one shared extraction: it
knows how to turn each of the four geometry kinds
(GEOMETRY_KINDS) into a flat
(x, y, z, log10_rho) point cloud, so a view (the desktop 3-D panel
in this phase, potentially others later) only has to know how to
scatter-plot points, never how Occam2D/ModEM/MARE2DEM/a multiline
stack each store their own geometry.
Functions
|
Flatten any |
Classes
|
Flat point cloud ready for a 3-D scatter view. |
- class pycsamt.format.pointcloud.PointCloud(x, y, z, value, label)[source]
Bases:
objectFlat point cloud ready for a 3-D scatter view.
- Variables:
z (x, y,) – Position, metres.
zis elevation-like (positive up) — callers plotting depth sections see negative values below the surface, matching the sign convention already used bypycsamt.app.web.callbacks.map3d’s own 3-D views.value (ndarray, shape (n,)) – \(\log_{10}(\rho / \Omega\mathrm{m})\).
label (str) – Short description of what was plotted (geometry kind + any subsampling applied), for a status bar / axis title.
- Parameters:
- x: ndarray
- y: ndarray
- z: ndarray
- value: ndarray
- label: str
- pycsamt.format.pointcloud.pcsf_to_point_cloud(model, *, max_points=200000, seed=0)[source]
Flatten any
PCSFModelgeometry into one 3-D point cloud.- Parameters:
model (PCSFModel) – Any geometry kind.
max_points (int, default 200_000) – Random (seeded, reproducible) subsample cap — a native
grid3d/mesh_unstructuredmodel can carry hundreds of thousands of cells, too many for an interactive scatter plot.seed (int, default 0) – Subsampling RNG seed, for a reproducible view across renders.
- Returns:
Non-finite values (masked cells, log of non-positive resistivity) are dropped, not zeroed.
- Return type:
- Raises:
ValueError – If
model.geometry.kindis not one ofGEOMETRY_KINDS.
Examples
>>> import numpy as np >>> from pycsamt.format import Grid2DGeometry, PCSFModel >>> from pycsamt.format.pointcloud import pcsf_to_point_cloud >>> geometry = Grid2DGeometry(x=np.array([0.0, 100.0]), z=np.array([10.0, 50.0])) >>> model = PCSFModel(geometry=geometry, resistivity=np.array([[100.0, 110.0], [50.0, 55.0]])) >>> cloud = pcsf_to_point_cloud(model) >>> cloud.x.shape (4,)