Skip to content
Table of contents

TrueMapData

TrueMapData is a Python library and tmd-process CLI for TrueMap and GelSight height maps, maintained under ETSim. It reads surface captures as NumPy arrays and provides analysis and graphics export. Facts below come from the repository README and guides as read for the companion article.

  • Updated

1. Overview

Why it exists. One surface representation that serves metrology work and graphics assets such as displacement maps or meshes.

Best fit. Inspecting measured surfaces, comparing captures over time (wear), and exporting normal maps, displacement maps or meshes with physical scale preserved.

2. Use cases

Python library and tmd-process CLI that read TrueMap and GelSight .tmd height maps for metrology, wear and 3D export.

Use-case diagram for TrueMapData: Load a .tmd height map; Export texture maps; Export a 3D mesh; Measure ISO 25178 roughness; Track wear across scans; Plot surfaces and profilesTrueMapDataLoad a .tmd height mapExport texture mapsExport a 3D meshMeasure ISO 25178 roughnessTrack wear across scansPlot surfaces and profilesTribology researcher«system»TrueMap / GelSight«system»Surfalize (ISO 25178)
People on the left, external systems on the right; each oval is a use case backed by the files cited below.
Load a .tmd height map
Tribology researcherTrueMap / GelSight

TMD.load("file.tmd") in tmd/core/tmd.py decodes v1 or v2 headers and returns height_map as a float32 (height, width) array plus a metadata dict.

Export texture maps
Tribology researcher

tmd-process maps all|normal|ao|bump|hillshade|displacement writes PNG maps through the generators in tmd/image/maps/, and maps batch processes a whole folder.

Export a 3D mesh
Tribology researcher

tmd-process mesh generate exports STL, OBJ, PLY, glTF or USD with adaptive or quadtree triangulation; mesh apply puts the maps on a template OBJ/MTL such as tmd/fixtures/templates/plane.

Measure ISO 25178 roughness
Tribology researcherSurfalize (ISO 25178)

tmd-process roughness file <path> --quick computes areal parameters through the optional truemapdata[roughness] extra, which installs Surfalize under GPL-3.0.

Track wear across scans
Tribology researcherTrueMap / GelSight

tmd-wear (same as tmd-process wear) computes bearing curves, wear-volume series, slip axis and scratch evolution on aligned sequences, using tmd/sequence/wear_analysis.py.

Plot surfaces and profiles
Tribology researcher

tmd-process visualize basic <file> draws 2D heatmaps, 3D surfaces and X/Y profiles with the matplotlib, plotly, seaborn or optional Polyscope plotters; tribology plot writes a PNG dashboard.

2.1. Scenario: Compare two GelSight captures of a worn sample

  1. Install the package with pip install truemapdata, or pip install -e . from a clone.
  2. Run tmd-wear bearing curve examples/gelsight/circle_0mm_100g_heightmap_linear_detrend.tmd --json to get the Abbott curve of the first capture.
  3. Run tmd-wear volume-series with that file and tests/fixtures/gelsight_wear_volume_second_frame.tmd to measure the volume lost between frames.
  4. Export textures with tmd-process maps all <file> -o ./maps_out.
  5. Build a mesh with tmd-process mesh generate <file> --format stl --method adaptive --quality high for a 3D view of the worn area.

Files readREADME.mdpyproject.tomldocs/reference/cli.mddocs/user-guide/getting-started.mdtmd/core/tmd.pytmd/cli/main.pytmd/sequence/wear_analysis.py

3. Getting started

Package. TrueMapData is on PyPI as truemapdata (MIT, Python 3.8 or later). The latest release on PyPI is 1.0.5; the repository’s pyproject.toml is already at 1.0.6. There is no .NET or NuGet package: the library is Python only, and the import name is tmd.

pip install truemapdata

The extras pull in optional features. Each one is declared in pyproject.toml:

ExtraAddsUse it for
vizPyVista, ipywidgets, Kaleido3D views and static Plotly export
meshtrimesh, pygltflib, numpy-stlSTL, OBJ, PLY and glTF export
advancedPolyscope, scikit-image, Open3DInteractive viewer and image processing
roughnessSurfalize (GPL-3.0, Python 3.10+)ISO 25178 areal roughness; kept out of full because of its licence
fulldev, docs, viz, mesh and advanced, plus pandas and nbformatWorking on the library itself
pip install "truemapdata[mesh,viz]"
pip install "truemapdata[roughness]"

Installing the package adds two commands, tmd-process (the full toolkit) and tmd-wear (the wear subset).

A first script. This example follows tests/core/test_tmd.py, so it runs without a capture file: it builds a height map in memory, saves it in the TMD v2 format, reads it back and looks at it.

import numpy as np
from tmd import TMD

# A 200 x 200 grid of heights, 0.05 mm between samples
y, x = np.mgrid[0:200, 0:200]
heights = (np.sin(x / 25) * np.cos(y / 30)).astype(np.float32)

surface = TMD(heights, {"comment": "synthetic", "resolution_x": 0.05, "resolution_y": 0.05})
path = surface.save("synthetic.tmd")            # version 2 by default, returns the .tmd path

loaded = TMD.load(path)
print(loaded.shape)                              # (200, 200)
print(loaded.dimensions)                         # width and height in physical units: 10.0 x 10.0
print(loaded.stats["min"], loaded.stats["max"])  # computed on first access

patch = loaded.crop(50, 50, 64, 64)              # x_start, y_start, width, height
small = loaded.resize(100, 100)

TMD.load raises FileNotFoundError or TMDProcessingError for a missing file, and dimensions multiplies the grid size by resolution_x and resolution_y from the metadata (1.0 when they are missing). With a real capture, replace the synthetic grid with TMD.load("capture.tmd"). The repository tracks sample captures for this: TrueMap files in examples/v1/ and examples/v2/ (a dime, a step height, coins, paper, and in v2 a laser marking and a Vickers indentation) and three GelSight captures in examples/gelsight/ taken after 0, 150 and 300 mm of sliding at 100 g.

From the command line. The README’s wear examples run on those fixtures:

tmd-process visualize basic examples/v2/Dime.tmd
tmd-wear bearing curve examples/gelsight/circle_0mm_100g_heightmap_linear_detrend.tmd --json
tmd-wear volume-series examples/gelsight/circle_0mm_100g_heightmap_linear_detrend.tmd \
  tests/fixtures/gelsight_wear_volume_second_frame.tmd --json

The first wear command prints the bearing (Abbott–Firestone) curve of one capture; the second compares captures of the same grid and reports the loss against the first one (z_ref - z_i, positive where the surface went down).

Matplotlib 3D surface of a 200 by 200 height map with normalised heights
README example: the 3D surface plot of a 200 × 200 height map with normalised heights.

Height profile along row 100, from 0 to 10 mm
README example: the X cross-section at row 100, with the horizontal axis in millimetres.

4. Features and components

AreaContent
File format.tmd header, spatial metadata and a float32 row-major height grid; legacy v1 and TrueMap v6-style v2 formats, with checks for alternate v2 headers
Visualisation2D heatmap, 3D surface, row and column profiles, contours, file comparisons; Matplotlib, Plotly HTML, optional Polyscope
Derived mapsNormal maps, displacement maps, apply-on-mesh with a template OBJ/MTL using template bounds, mm_per_pixel and capture dimensions for tiling
MetrologyISO 25178 areal roughness through Surfalize (optional)
Weartmd-wear commands: volume series, scratch evolution, slip-axis heuristics, roughness trajectories; translation alignment and OpenCV/SIFT registration, including normals-driven registration
Pipeline toolsFilters, defect detection, sequence export, compression

5. Architecture

flowchart TB
  Capture["TrueMap or GelSight capture"] --> Read["Height grid and spatial metadata"]
  Read --> Inspect["Heatmap, profile or 3D surface"]
  Inspect --> Metrics["Roughness and surface metrics"]
  Inspect --> Maps["Normal and displacement maps"]
  Inspect --> Mesh["Mesh export and template texturing"]

6. Constraints and checks

  • Roughness describes one capture; wear compares captures over time and needs the same grid and in-plane region before heights are subtracted.
  • Loss convention: reference height − current height; positive loss means the current surface is lower. Physical volume also needs the pixel spacing in both directions.
  • Registration errors or inconsistent height units change wear results.
  • The README figures are repository examples with normalised heights, not thesis measurements.

8. CI/CD pipeline

7 GitHub Actions workflows, 9 jobs. Each box is a job; double-bordered boxes publish or deploy, and arrows follow needs.

Mermaid Pipeline flow
flowchart LR
  subgraph wf0["Build"]
    direction LR
    wf0_build["build<br/>ubuntu-latest"]
  end
  subgraph wf1["Dependabot Auto-Merge"]
    direction LR
    wf1_dependabot["dependabot<br/>ubuntu-latest"]
  end
  subgraph wf2["Dependency submission"]
    direction LR
    wf2_dependency_submission["dependency-submission<br/>ubuntu-latest"]
  end
  subgraph wf3["Documentation"]
    direction LR
    wf3_build[["build<br/>ubuntu-latest"]]
    wf3_deploy[["deploy<br/>ubuntu-latest"]]
  end
  subgraph wf4["Release and publish"]
    direction LR
    wf4_test[["test<br/>ubuntu-latest"]]
    wf4_release_and_pypi[["release-and-pypi<br/>ubuntu-latest"]]
  end
  subgraph wf5["Ruff"]
    direction LR
    wf5_ruff["ruff<br/>ubuntu-latest"]
  end
  t0(["push · pull request"])
  t1(["pull request"])
  t2(["push · pull request · manual run"])
  t3(["manual run"])
  d0[("GitHub Pages")]
  d1[("PyPI")]
  d2[("GitHub Releases")]
  t0 --> wf0_build
  t1 --> wf1_dependabot
  t2 --> wf2_dependency_submission
  t0 --> wf3_build
  wf3_build --> wf3_deploy
  wf3_deploy -.-> d0
  t3 --> wf4_test
  wf4_test --> wf4_release_and_pypi
  wf4_release_and_pypi -.-> d1
  wf4_release_and_pypi -.-> d2
  t0 --> wf5_ruff
Workflows, triggers, jobs and targets
WorkflowTriggersJobsPublishes to
Build
.github/workflows/build.yml
push, pull request
  • build ubuntu-latest
    actions/checkout · Install dependencies · Build sdist and wheel
—
Dependabot Auto-Merge
.github/workflows/dependabot-auto-merge.yml
pull request
  • dependabot ubuntu-latest
    Dependabot metadata · Approve safe PR · Auto-merge safe PRs
—
Dependency submission
.github/workflows/dependency-submission.yml
push, pull request, manual run
  • dependency-submission ubuntu-latest
    actions/checkout · Set up Python · Stash broad requirements for graph scan · Submit dependencies to GitHub · Report submission failure
—
Documentation
.github/workflows/docs.yml
push, pull request
  • build ubuntu-latest
    actions/checkout · actions/setup-python · Install dependencies · Build documentation · Upload Pages artifact
  • deploy ← build ubuntu-latest
GitHub Pages
Release and publish
.github/workflows/publish.yml
manual run
  • test ubuntu-latest
    Validate release ref · Checkout · Set up Python · Install dependencies · Test with pytest
  • release-and-pypi ← test ubuntu-latest
    Checkout · Set up Python · Install build tools · Build sdist and wheel · Verify package · Create GitHub Release
PyPI, GitHub Releases
Ruff
.github/workflows/ruff.yml
push, pull request
  • ruff ubuntu-latest
    actions/checkout · astral-sh/ruff-action
—
Test
.github/workflows/test.yml
push, pull request
  • test ubuntu-latest
    actions/checkout · Install dependencies · Test with pytest · Upload coverage to Codecov
—

Generated from the source at commit 8e44bd4.

9. Deployment diagram

Mermaid Deployment diagram
flowchart LR
  repo[("GitHub repository")]
  ci[["GitHub Actions<br/>7 workflows"]]
  pub_GitHub_Pages[("GitHub Pages")]
  pub_PyPI[("PyPI")]
  pub_GitHub_Releases[("GitHub Releases")]
  host_MkDocs_site("Documentation site (MkDocs)<br/>mkdocs.yml")
  repo -->|"push or pull request"| ci
  ci -->|"publishes"| pub_GitHub_Pages
  ci -->|"publishes"| pub_PyPI
  ci -->|"publishes"| pub_GitHub_Releases
  ci -.->|"configured"| host_MkDocs_site

10. External dependencies

44 declared packages (19 runtime, 25 development) in pyproject.toml, requirements.txt.

Package table 44
External dependencies
PackageVersionScopePurposeRegistry
numpy>=1.20.0runtimeData analysispypi.org
matplotlib>=3.5.0runtimeChartspypi.org
pillow>=9.0.0runtimeGraphics, imaging and 3Dpypi.org
scipy>=1.8.0runtimeData analysispypi.org
opencv-python>=4.5.0runtimeGraphics, imaging and 3Dpypi.org
rich>=12.0.0runtimeCommand linepypi.org
typer>=0.7.0runtimeCommand linepypi.org
plotly>=5.10.0runtimeChartspypi.org
seaborn>=0.12.0runtimeChartspypi.org
meshio>=5.0.0runtimeGraphics, imaging and 3Dpypi.org
psutil>=5.8.0runtimeCross-platform lib for process and system monitoring.pypi.org
noise>=1.2.2runtimePerlin noise for Pythonpypi.org
pytest>=7.0.0developmentTestingpypi.org
pytest-cov>=4.0.0developmentTestingpypi.org
black>=23.0.0developmentLinting and formattingpypi.org
isort>=5.10.0developmentLinting and formattingpypi.org
flake8>=5.0.0developmentLinting and formattingpypi.org
mypy>=1.0.0developmentLinting and formattingpypi.org
tox>=4.0.0developmenttox is a generic virtualenv management and test command line toolpypi.org
pre-commit>=3.0.0developmentLinting and formattingpypi.org
mkdocs>=1.6.0developmentProject documentation with Markdown.pypi.org
mkdocs-material>=9.7.0developmentDocumentation that simply workspypi.org
pymdown-extensions>=9.0developmentExtension pack for Python Markdown.pypi.org
pygments>=2.13.0developmentPygments is a syntax highlighting package written in Python.pypi.org
pyvista>=0.37.0developmentGraphics, imaging and 3Dpypi.org
ipywidgets>=7.6.0developmentJupyter interactive widgetspypi.org
kaleido>=0.2.1developmentPlotly graph export librarypypi.org
trimesh>=3.9.0developmentGraphics, imaging and 3Dpypi.org
pygltflib>=1.15.0developmentPython library for reading, writing and managing 3D objects in the Khronos Group gltf and gltf2 formats.pypi.org
numpy-stl—developmentData analysispypi.org
polyscope>=1.3.0developmentPolyscope: A viewer and user interface for 3D data.pypi.org
scikit-image—developmentGraphics, imaging and 3Dpypi.org
open3d—developmentGraphics, imaging and 3Dpypi.org
surfalize>=0.16.0developmentA python module to analyze surface roughnesspypi.org
truemapdata—developmentA library for processing TMD files and visualizing height mapspypi.org
pandas>=1.3.0developmentData analysispypi.org
nbformat>=5.1.0developmentThe Jupyter Notebook formatpypi.org
tqdm>=4.60.0runtimeCommand linepypi.org
openstl—runtimeA simple STL serializer and deserializerpypi.org
python-pptx—runtimeCreate, read, and update PowerPoint 2007+ (.pptx) files.pypi.org
PyWavelets—runtimePyWavelets, wavelet transform modulepypi.org
moviepy—runtimeGraphics, imaging and 3Dpypi.org
usd-core—runtimePixar's Universal Scene Descriptionpypi.org
rasterio—runtimeFast and direct raster I/O for use with NumPypypi.org

11. Glossary

Repository

The versioned source files, configuration, and history of a project.

README

The repository’s entry document, usually covering its purpose and initial setup.

Dependency

A library, tool, or service that another component needs to build or run.

HTTP

A request-and-response protocol used by browsers and web services. A method, path, headers, and optional body describe a request.

Volume and bind mount

A volume is storage managed by the container platform; a bind mount exposes a chosen host path inside a container.

Published port

A host port mapped to a service’s container port. Publishing a port can expose that service beyond its container network.

CLI

A text interface in which commands and arguments select operations. Exit codes let scripts detect success or failure.

Build

The steps that turn source files and dependencies into a runnable program or distributable artifact.

Continuous integration

Automated checks that run when source changes, such as building, testing, and linting. Passing checks cover only what those checks exercise.

Mermaid

A text-based diagram language. Nodes and connections describe a model; the diagram itself does not execute the project.

GPU

A processor designed for parallel workloads, including graphics rendering and many numerical operations.

Mesh

A surface represented by vertices and connected elements, often triangles. Its geometry is distinct from its material or texture.

12. References

  1. ETSim. (2026, November 5). [Web page] github.com.
  2. ETSim. (2026, November 5). TrueMapData. [Software repository] github.com.
  3. Documentation. (2026, November 5). [Web page] etsim.github.io.
  4. ETSim. (2026, November 5). Binary format guide. [Source file or documentation] github.com.
  5. ETSim. (2026, November 5). Sequential wear analysis. [Source file or documentation] github.com.

Sources without a publication date show the date they were last checked, November 5, 2026. File links retain the inspected revision where available.