Skip to content

SurfaceTopography

Read and analyze surface topographies with Python. SurfaceTopography represents line scans and topography maps on uniform and nonuniform grids, reads the file formats of most commercial profilometers and scanning probe microscopes, and computes standard and scale-dependent roughness parameters.

Highlights

  • One interface for all measurements. Topography maps, uniform line scans and nonuniform line scans expose the same methods, independent of the instrument the data came from.
  • More than 40 file formats. Readers detect the format from the file content and report channels, physical sizes, units and instrument metadata.
  • Statistics with defined discretizations. Root-mean-square height, slope and curvature, power spectral density, height-difference autocorrelation, variable bandwidth analysis and bearing area, for maps and for profiles.
  • Scale-dependent roughness parameters from finite-difference derivatives at arbitrary scales, with a reliability cutoff for scanning probe artifacts.
  • Pipelines. Detrending, scan-line alignment, filtering, interpolation and filling of missing data return new topographies that record how they were derived from the raw data.
  • Containers combine several measurements of the same surface and average their statistics over the combined bandwidth.
  • Optional MPI. Topographies can be domain-decomposed across MPI processes; serial use needs no MPI installation.

A first example

from SurfaceTopography import read_topography

# The file format is detected from the file content
topography = read_topography("surface.opd")

print(topography.nb_grid_pts, topography.physical_sizes, topography.unit)
print("Sq =", topography.Sq())

# Remove a tilt and compute the power spectral density
detrended = topography.detrend(detrend_mode="height")
q, C = detrended.power_spectrum_from_profile()

# Plot the topography; x is the first array axis
import matplotlib.pyplot as plt
plt.pcolormesh(*detrended.positions_and_heights())
plt.colorbar(label=f"Height ({detrended.unit})")
plt.show()

Where to go next

Citing

If you use this code, please cite

Every analysis function records the publications it is based on; see Topographies for how to retrieve them.

Funding

Development of this project is funded by the European Research Council within Starting Grant 757343 and by the Deutsche Forschungsgemeinschaft within projects PA 2023/2 and EXC 2193.