svr-roughness
svr-roughness is a reusable Python library for SurfInspect-compatible surface
roughness analysis from industrial scan outputs. Use svr_roughness as the
consistent Python import name.
The core API is file-type agnostic: roughness is computed from an Nx3 NumPy-like XYZ point array in millimeters. Svr is calculated from signed distances to a smoothed, triangulated reference surface and a KD-tree variogram modeled on SurfInspect. The regular grid remains available for Sa/Sq and visualization. Reference mesh resolution and smoothing default to 0.30 mm, matching the supplied SurfInspect A2 reference closely. At most 10,000 variogram points are used by default to bound memory on industrial scans; set max_svr_points higher when full point coverage is required.
config = RoughnessConfig(
mesh_resolution_mm=0.30,
mesh_smoothing_mm=0.30,
svr_points=10,
svr_span_mm=0.50,
)
Install
From this repository:
python -m pip install ./svr-roughness
For deployment from inside SurfaceRoughnessPi:
python -m pip install ../svr-roughness
Python API
Use analyze_points() when your scanner or upstream software already gives you XYZ points:
import numpy as np
from svr_roughness import analyze_points
points_xyz_mm = np.asarray(points) # shape (N, 3), columns x/y/z, units mm
result = analyze_points(points_xyz_mm, grid_mm=0.30, short_cutoff_mm=0.6, long_cutoff_mm=8.0)
print(result.sa_um, result.sq_um, result.svr_um)
Use analyze_file() as a convenience adapter for supported files:
from svr_roughness import RoughnessConfig, analyze_file
config = RoughnessConfig(grid_mm=0.30, short_cutoff_mm=0.6, long_cutoff_mm=8.0)
result = analyze_file("scan.ply", config=config)
Supported file loaders (all are converted to an Nx3 NumPy array):
- ASCII and binary little-endian
.plypoint clouds - ASCII and binary
.pcdpoint clouds - ASCII and binary
.stlmesh vertices .objvertex meshes- comma-, tab-, or whitespace-delimited
.csv,.tsv,.xyz, and.txt .npyand.npzNumPy arrays
STL files are converted to their unique mesh vertices before analysis. For production mesh metrology, prefer scanner point clouds or add controlled surface sampling before calling analyze_points().
Result Output
result.save_grid_npz("output/roughness/latest_grid.npz")
result.save_metrics_json("output/roughness/latest_metrics.json")
save_metrics_json() writes:
sa_umsq_umsvr_um- point counts, grid dimensions, grid coverage, and filter cutoffs
save_grid_npz() writes:
grid_rawgrid_filledgrid_filteredvalid_rawvalid_filledgrid_origin- plane basis arrays
Command line
The package also includes a no-code command for scanner integrations:
svr-roughness scan.ply --grid-mm 0.30 --metrics-out metrics.json --grid-out grid.npz
Coordinates are assumed to be millimeters, and metrics are reported in micrometers. Unit conversion should happen before calling the library.
Release files for svr-roughness 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| svr_roughness-0.3.0.tar.gz | 16.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| svr_roughness-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.6 kB
Release files / svr_roughness-0.3.0.tar.gz
| Download URL | svr_roughness-0.3.0.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f9b3cb5e7888f72d07a6866bf8748e478b27f435f8c1e51dde88c2c38ee2d14
|
|
BLAKE2b-256 checksum How to use checksums |
d252540624090045fd6999715cc4484d52ef8fd573ee4094c43c6abe77b01ae9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.0
|
Release files / svr_roughness-0.3.0-py3-none-any.whl
| Download URL | svr_roughness-0.3.0-py3-none-any.whl |
|---|---|
| Size | 17.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f219a08ff67b5f5abdd067d89874696615e6df67c77bf75e1071cbb7b3ae5c65
|
|
BLAKE2b-256 checksum How to use checksums |
10e8811bdb2b7ed78d0781c3eca11287306e26b99e8a5d28dec206fdfe18a4e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.0
|