Surface Topography PSD and Synthetic Roughness Suite

Use at your own risk. Verify inputs, assumptions and results independently before applying them.

Surface and spectral settings

Use uniformly sampled power-of-two grids. Start at 32 × 32 and repeat with finer sampling.

Generated surface
Analysis

Topography result

The canonical amplitude result is direct RMS after selected form removal.

RMS height, Rq—

Enter or generate a surface, then select Calculate.

Processed height map, z(x,y)
Y position (µm)
—————
—————
X position (µm)
Numbered axes span Lx × Ly; the colorbar reports processed height in µm.
Two-dimensional PSD, log₁₀ C(qx,qy)
Directional content is retained; map scale is logarithmic in m⁴.
Radially averaged PSD
Both log₁₀ axes include numerical ticks. Radial averaging is a compact isotropic summary and can hide directional texture.

Equations used

Heights z are positive upward. x follows matrix columns, y follows rows, and angular spatial wavevectors q are in rad/m. All calculations use SI units internally.

Form removal, DFT, and areal PSD

z′jk = zjk − (a + bxj + cyk);   Zmn = Σj=0Nx−1Σk=0Ny−1 wjkz′jk exp[−i2π(mj/Nx + nk/Ny)]
U = (1/NxNy)Σwjk²;   Cmn = ΔxΔy |Zmn|²/[(2π)²NxNyU]

a, b, and c are least-squares plane coefficients; j and k index samples; m and n index Fourier modes; Δx and Δy are pixel spacings; w is either unity or a separable Hann window; U is its mean-square power correction; i² = −1; and Cmn is the two-sided areal PSD in m⁴ under the angular-wavevector convention. Lx = NxΔx, Ly = NyΔy, qx = 2πm/Lx, and qy = 2πn/Ly with wrapped negative-frequency indices.

Spectral moments and directionality

Δqx = 2π/Lx;   Δqy = 2π/Ly;   m0 = ΣCmnΔqxΔqy;   m2 = Σ(qx²+qy²)CmnΔqxΔqy;   m4 = Σ(qx²+qy²)²CmnΔqxΔqy
RqPSD = √m0;   Sdq = √m2;   RMS(∇²z) = √m4
M = Σ Cmn[qx² qxqy; qxqy qy²]ΔqxΔqy;   γ = √(λmax/λmin);   θ = ½ atan2(2Mxy, Mxx−Myy)

A = LxLy. The anisotropy ratio γ uses eigenvalues of the directional second-moment matrix; γ = 1 is balanced, while larger values indicate a preferred wavevector direction θ measured counter-clockwise from +x. Radial C(q) is the arithmetic mean of Cmn in each q-radius bin, with wavelength λ = 2π/q.

Sampling and generated surface

qNy,x = π/Δx;   qNy,y = π/Δy;   Δqx = 2π/Lx;   Δqy = 2π/Ly
C(q) ∝ 1 for q ≤ qr;   C(q) ∝ (q/qr)−2(1+H) for qr < q ≤ qs;   C(q) = 0 for q > qs

qr = 2π/λr, qs = 2π/λs, and the Hurst exponent H is dimensionless with 0 < H < 1. Seeded complex Gaussian coefficients obey Hermitian symmetry; inverse DFT heights are mean-centered and scaled to the requested Rq.

PSD normalization and verification

The two-sided areal spectrum uses angular wavevector q in rad/m and C in m⁴. Its discrete integral is Σ C Δqx Δqy. Without a window and after mean or plane removal, this equals the variance of the leveled heights. With form removal set to None, the DC component is retained, so the integral is mean-square height, including the mean offset, rather than variance.

The separable Hann window uses U = mean(w²). The corrected spectral integral equals mean((z w)²)/U. This power correction does not guarantee equality to the unwindowed variance for each finite or nonstationary surface. Direct RMS is calculated after subtracting the leveled surface mean; use it for the unwindowed amplitude summary.

Radial C(q) is a bin average of the 2D spectrum, not a one-dimensional line-profile PSD. Bin counts times Δqx Δqy provide the exact discrete integration weights; the zero-frequency cell is excluded from the radial curve. Bins near the rectangular Nyquist boundary have incomplete angular coverage. Radial averaging can hide directional structure.

Verification includes an independent direct DFT on a rectangular 8 × 16 grid with unequal spacing, with and without Hann windowing; spectral power and radial-bin energy checks; and spacing scaling of slope and curvature. A periodic cosine of amplitude 0.8 µm has RMS 0.565685 µm without windowing after mean removal. Halving pixel spacing doubles its wavevector and RMS slope and quadruples RMS Laplacian at fixed sampled heights.

Assumptions and limits

  • Samples must lie on a uniform orthogonal grid and represent a stationary patch.
  • The DFT treats opposite edges as periodic; plane removal and Hann windowing reduce, but do not eliminate, leakage.
  • Radial averaging discards direction. Interpret it only with the 2D PSD and anisotropy result.
  • Slope and curvature moments strongly amplify high-q noise. Repeat at different pixel spacing, map size, window, and detrending; do not report unconverged values.
  • No instrument transfer-function, missing-data, spike, uncertainty, or anti-alias correction is applied. Repair and calibrate metrology data before use.

References

Jacobs, Junge & Pastewka (2017), Quantitative characterization of surface topography using spectral analysis; ISO 25178-2:2021.

Worked example: periodic height grid

Select Measured grid, height unit µm, X and Y spacing 1 µm, Mean only form removal and None for the window. Paste the eight rows below. They describe z = 0.8 cos(2πx/16) µm, constant in the Y direction.

0.8,0.739103626009,0.565685424949,0.306146745892,4.89858719659e-17,-0.306146745892,-0.565685424949,-0.739103626009,-0.8,-0.739103626009,-0.565685424949,-0.306146745892,-1.46957615898e-16,0.306146745892,0.565685424949,0.739103626009
0.8,0.739103626009,0.565685424949,0.306146745892,4.89858719659e-17,-0.306146745892,-0.565685424949,-0.739103626009,-0.8,-0.739103626009,-0.565685424949,-0.306146745892,-1.46957615898e-16,0.306146745892,0.565685424949,0.739103626009
0.8,0.739103626009,0.565685424949,0.306146745892,4.89858719659e-17,-0.306146745892,-0.565685424949,-0.739103626009,-0.8,-0.739103626009,-0.565685424949,-0.306146745892,-1.46957615898e-16,0.306146745892,0.565685424949,0.739103626009
0.8,0.739103626009,0.565685424949,0.306146745892,4.89858719659e-17,-0.306146745892,-0.565685424949,-0.739103626009,-0.8,-0.739103626009,-0.565685424949,-0.306146745892,-1.46957615898e-16,0.306146745892,0.565685424949,0.739103626009
0.8,0.739103626009,0.565685424949,0.306146745892,4.89858719659e-17,-0.306146745892,-0.565685424949,-0.739103626009,-0.8,-0.739103626009,-0.565685424949,-0.306146745892,-1.46957615898e-16,0.306146745892,0.565685424949,0.739103626009
0.8,0.739103626009,0.565685424949,0.306146745892,4.89858719659e-17,-0.306146745892,-0.565685424949,-0.739103626009,-0.8,-0.739103626009,-0.565685424949,-0.306146745892,-1.46957615898e-16,0.306146745892,0.565685424949,0.739103626009
0.8,0.739103626009,0.565685424949,0.306146745892,4.89858719659e-17,-0.306146745892,-0.565685424949,-0.739103626009,-0.8,-0.739103626009,-0.565685424949,-0.306146745892,-1.46957615898e-16,0.306146745892,0.565685424949,0.739103626009
0.8,0.739103626009,0.565685424949,0.306146745892,4.89858719659e-17,-0.306146745892,-0.565685424949,-0.739103626009,-0.8,-0.739103626009,-0.565685424949,-0.306146745892,-1.46957615898e-16,0.306146745892,0.565685424949,0.739103626009

The direct and spectral RMS heights should both be approximately 0.5657 µm, and RMS slope approximately 0.2221. A directionality warning is expected because the example varies in only one direction. Use this synthetic check to understand PSD normalization; measured surfaces usually need form removal and an appropriate window, which changes the analyzed signal. This check does not establish measurement accuracy or represent isotropic roughness.

How to use

  1. Select Generated self-affine or Measured grid. Generated mode is for reproducible numerical studies; measured mode is for uniformly sampled areal topography.
  2. Set grid size and x/y pixel spacing in µm. Measured matrices must have power-of-two dimensions from 8 to 128; the grid-size selector controls generated mode.
  3. In measured mode, paste or upload finite TXT/CSV height values and choose nm, µm, or mm. Rows are y samples and columns are x samples.
  4. In generated mode, enter target Rq in µm, 0 < H < 1, λs, λr, and an integer seed. Require 2max(Δx,Δy) ≤ λs ≤ λr ≤ min(Lx,Ly).
  5. Select form removal. Least-squares plane is the normal starting point; use mean-only or none only when the physical datum/form is intentionally retained.
  6. Select Hann to reduce edge leakage or None for an already periodic map. Choose 4–64 radial bins, then select Calculate. Reset example restores defaults and clears results.
  7. Read direct Rq as the canonical amplitude result. Compare spectral RMS, RMS slope, RMS Laplacian, anisotropy ratio, and principal wavevector direction.
  8. Inspect the processed topography with its numbered x/y axes and height colorbar in µm. Use Download surface CSV to export the processed map as `x_um,y_um,z_um` coordinate rows. Read the numerical log₁₀ wavevector and PSD ticks on the radial curve, and download radial PSD CSV when a numerical result exists. A high anisotropy ratio warns that the radial curve hides direction.
  9. Correct red validation messages. Check the Nyquist and map-length limits, then repeat with finer spacing, larger area, another window, and another detrend choice.
  10. Do not use the model for irregularly sampled, uncalibrated, aliased, spike-contaminated, nonstationary, or safety-critical data, or when instrument transfer and uncertainty must be quantified.

Interpretation

Rq describes amplitude; Sdq and RMS Laplacian emphasize progressively shorter wavelengths. Differences between direct and spectral RMS can reflect window correction and leakage. Synthetic output is a statistical realization, not a material specification.

Input definitions

Surface mode (—)
Analyze an uploaded/pasted grid or generate a seeded self-affine surface. Unit: enum.
Height grid (z(x,y))
Rectangular power-of-two matrix of measured heights. Unit: selected nm, µm or mm; converted to metres internally.
X pixel spacing (Δx)
Sample pitch along columns, entered in µm and converted to metres internally. Unit: µm.
Y pixel spacing (Δy)
Sample pitch along rows, entered in µm and converted to metres internally. Unit: µm.
Height unit (—)
Unit applied to measured grid values. Unit: enum.
Form removal (—)
None, mean removal, or least-squares plane removal. Unit: enum.
Window (w)
None or separable Hann with mean-square power correction U. Unit: enum.
Radial bins (Nb)
Number of equal-width radial wavevector bins. Unit: count.
Synthetic RMS height (Rq)
Target mean-centered RMS for generated surface, entered in µm. Unit: µm.
Hurst exponent (H)
Self-affine spectral exponent parameter. Unit: dimensionless.
Short-wavelength cutoff (λs)
Smallest retained synthetic wavelength, entered in µm. Unit: µm.
Roll-off wavelength (λr)
Transition from flat low-q PSD to self-affine band, entered in µm. Unit: µm.
Random seed (s)
Integer controlling reproducible Gaussian Fourier coefficients. Unit: integer.