Skip to main content

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 .ply point clouds
  • ASCII and binary .pcd point clouds
  • ASCII and binary .stl mesh vertices
  • .obj vertex meshes
  • comma-, tab-, or whitespace-delimited .csv, .tsv, .xyz, and .txt
  • .npy and .npz NumPy 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_um
  • sq_um
  • svr_um
  • point counts, grid dimensions, grid coverage, and filter cutoffs

save_grid_npz() writes:

  • grid_raw
  • grid_filled
  • grid_filtered
  • valid_raw
  • valid_filled
  • grid_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)

Source distribution for svr-roughness 0.3.0
File Size Uploaded
svr_roughness-0.3.0.tar.gz 16.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for svr-roughness 0.3.0
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

0.7.2

2 release files

0.7.1

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.4.18

2 release files

0.4.17

2 release files

0.4.16

2 release files

0.4.13

2 release files

0.4.12

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

This release

0.3.0 This release

2 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