Skip to main content

svr-roughness

svr-roughness is a high-performance Python package for ASTM WK92969 and ISO 16610-61 areal surface roughness analysis ($S_a$, $S_q$, $S_{VR}$). It is developed by the Human-centered Advanced Manufacturing (HAM) Lab at Iowa State University.

The numerical core is implemented in pure Python using vectorized NumPy operations, eliminating all heavy external C++ compiler and DLL dependencies while providing 100% numerical fidelity to the reference SurfInspect metrology pipeline.

import numpy as np
from svr_roughness import RoughnessConfig, analyze_points

# points shape (N, 3), units in millimeters
config = RoughnessConfig(
    grid_mm=0.20,
    short_cutoff_mm=1.0,
    long_cutoff_mm=25.0,
    svr_points=10,
    svr_span_mm=0.50,
)
result = analyze_points(points_xyz_mm, config=config)
print(f"Sa:  {result.sa_um:.3f} µm")
print(f"Sq:  {result.sq_um:.3f} µm")
print(f"Svr: {result.svr_um:.3f} µm")

Features

  • Standard-Compliant Metrology: Implements the full ASTM WK92969 pipeline:
    1. Centering and unit standardization
    2. $O(N)$ 3D voxel grid centroid downsampling
    3. PCA best-fit plane alignment
    4. 2.5D elevation grid rasterization with iterative hole filling and boundary cropping
    5. Dual-pass ISO 16610-61 Gaussian filtration ($\alpha = 0.4697$)
    6. 2D FFT autocorrelation variogram and local $S_{VR}$ dispersion map
  • Zero-Compiling Pure-Python: Runs everywhere Python 3.10+ runs (Linux, macOS, Windows, Pyodide/WebAssembly) with only standard numpy and scipy.
  • Wide Scan Format Support: Reads .ply (ASCII & binary), .pcd (ASCII & binary), .stl (ASCII & binary), .obj, delimited text (.csv, .tsv, .xyz, .txt), and NumPy arrays (.npy, .npz).
  • CLI and Web Integration: Ships with a command-line interface (svr-roughness) and powers the client-side WebAssembly inspection dashboard.

Install

Install from PyPI:

pip install svr-roughness

Or install from source:

pip install .

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
# Add --gaussian-mesh to use the recovered legacy Gaussian mesh path.

Coordinates are assumed to be millimeters, and metrics are reported in micrometers. Unit conversion should happen before calling the library.

Testing

Run the test suite using pytest:

pytest tests/ -v

The test suite covers:

  • Complete I/O loading for all supported formats (ASCII/binary PLY, ASCII/binary STL, PCD, OBJ, CSV, XYZ, NPY/NPZ)
  • $O(N)$ voxel downsampling and edge cases
  • PCA plane alignment and coordinate frame invariants
  • 2.5D elevation grid rasterization, boundary shaving, and iterative hole filling
  • Dual-pass ISO 16610-61 Gaussian filtering ($\alpha = 0.4697$)
  • Monotonicity, dispersion mapping, and Cauchy-Schwarz mathematical invariants ($S_q \ge S_a$)
  • End-to-end ASTM WK92969 validation on SCRATA comparator standards

Legacy C++ Native Core (Optional)

The historical C++ native bridge and CMake configuration are preserved under native/ for reference and backwards compatibility. The standard pure-Python package no longer requires building or compiling native code, as the vectorized NumPy/SciPy engine provides identical numerical output with superior cross-platform portability.

License

MIT License — Iowa State University HAM Lab.

Metadata

Release files for svr-roughness 0.7.7

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.7.7
File Size Uploaded Provenance Actions
svr_roughness-0.7.7.tar.gz 45.0 kB With provenance Details for svr_roughness-0.7.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for svr-roughness 0.7.7
File Interpreter ABI Platform Actions
svr_roughness-0.7.7-py3-none-any.whl Python 3 none any Details for svr_roughness-0.7.7-py3-none-any.whl

Total release size: 80.7 kB

Release files / svr_roughness-0.7.7.tar.gz

Download URL svr_roughness-0.7.7.tar.gz
Size 45.0 kB
Tags Source
SHA-256 checksum
How to use checksums
560672dd11fd0d4d3c73f33f678b01b6b057a297b6ab61dc2e602fa6220065c8
BLAKE2b-256 checksum
How to use checksums
8162a0fb74ea8d0bd864e6f295b7eeff50a3eb96960eca4245ea41d33171d323
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 1, 2026.

Transparency log

Release files / svr_roughness-0.7.7-py3-none-any.whl

Download URL svr_roughness-0.7.7-py3-none-any.whl
Size 35.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
18aed557bbf8340cd3748561aa532241094214e7177329c4f29c775832e49369
BLAKE2b-256 checksum
How to use checksums
c3e18f1d73282c7b2bbcc799dc1b79f147a9411fa52d0a40338487de4f3b130f
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 1, 2026.

Transparency log

Security for svr-roughness 0.7.7

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.

Select from 2 files

Attestation for svr_roughness-0.7.7.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 1, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.7.7 This release

2 release files Full provenance

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