Surface Roughness

FigureErrorBase

Base class for distorted optical surfaces.

FigureErrorImported

Figure error defined by external data file.

RandomRoughness

Random surface roughness model.

GaussianBump

Local surface deformation defined by Gaussian profile.

Waviness

Periodic surface waviness model.

Basic containers for surface roughness generators.

class xrt.backends.raycing.figure_error.FigureErrorBase

Base class for distorted optical surfaces.

This class provides common functionality for generating height maps and related diagnostics. Subclasses must implement the generate_profile() method, which defines how the surface distortion is computed.

Instances can optionally be combined with another figure error object via baseFE to construct more complex surface maps.

__init__(name='', baseFE=None, limPhysX=None, limPhysY=None, gridStep=0.5, **kwargs)
name: str

Human-readable name of the instance.

baseFE: FigureErrorBase subclass or None

Base figure error object used to build composite surface maps. If provided, the generated profile of this instance is added to the base figure error.

gridStep: float.

Grid spacing in [mm]. This value indirectly controls the number of grid points used for the height map. The actual number of nodes is rounded up to the next power of two in order to optimize Fourier-transform-based operations commonly used in map generation.

limPhysX and limPhysY: sequence of floats.

Physical limits [min, max] of the surface in the local coordinate system, in [mm]. These define the physical extent of the height map. Ideally, they should match the corresponding optical element dimensions, or at least fully cover the expected beam footprint.

class xrt.backends.raycing.figure_error.FigureErrorImported

Figure error defined by external data file.

This class loads a surface distortion (height map) from a file and exposes it through the standard FigureErrorBase interface. The input file is expected to contain three columns representing a grid of surface coordinates in [mm] and height values in [nm], with the order specified by orientation.

__init__(fileName=None, recenter=False, orientation='XYZ', columnFactors=[1, 1, 1], **kwargs)
fileName: str, path.

Path to the file containing the surface distortion map.

recenter: bool

If True, shifts the coordinate system so that the geometric center of the imported map is located at (0, 0).

orientation: str

Defines the order of columns in the input file. The default value “XYZ” means that the file columns are interpreted as x, y, z in xrt coordinate system.

columnFactors: 3-list

Optional multiplicative factors that bring the x and y column to mm and the z column to nm.

class xrt.backends.raycing.figure_error.RandomRoughness

Random surface roughness model.

Generates a stochastic height-error map with a given RMS amplitude and optional spatial correlation length.

__init__(rms=1.0, rmsKind='height', corrLength=5.0, seed=None, **kwargs)
rms: float or tuple of floats

Target Root Mean Square value.

  • For rmsKind="height", specifies RMS height in [nm]. Must be a scalar.

  • For rmsKind="slope", specifies RMS angular slope in [μrad]. May be:

    • scalar → isotropic slope RMS

    • (pitch, roll) → directional RMS slopes

Surface height and slope RMS are coupled through the spatial spectrum of the surface; only one can be enforced at a time.

rmsKind: ‘height’ or ‘slope’

Defines the metric used to normalize roughness. - “height”: RMS of surface height (z) deviations. - “slope”: RMS of surface slope (∂z/∂x, ∂z/∂y).

corrLength: float

Spatial correlation length of the roughness in [mm].

In height mode and isotropic slope mode, this value is used for both tangential and sagittal directions.

In directional slope mode, this value is interpreted as the tangential correlation length; the sagittal correlation length may be adjusted internally to match the requested directional slope RMS.

Extremely small values may lead to numerical instability and can break surface spline generation.

seed: int or None

Seed number for numpy random number generator. Any number from zero to 2^128-1. If provided, ensures reproducible roughness maps.

class xrt.backends.raycing.figure_error.GaussianBump

Local surface deformation defined by Gaussian profile.

__init__(bumpHeight=10.0, cX=0.0, cY=0.0, sigmaX=10.0, sigmaY=10.0, **kwargs)
bumpHeight: float

Peak height of the Gaussian bump in [nm]

cX, cY: float

Position of the bump in local surface coordinates in [mm].

sigmaX, sigmaY: float

Standard deviation of the Gaussian profile along the X and Y axes in [mm]. These values control the spatial extent of the bump.

class xrt.backends.raycing.figure_error.Waviness

Periodic surface waviness model.

Generates a smooth, deterministic height-error map based on a two-dimensional cosine function.

__init__(amplitude=10.0, xWaveLength=20.0, yWaveLength=50.0, **kwargs)
amplitude: float

Amplitude of the cosine modulation in [nm]

xWaveLength, yWaveLength: float

Spatial period of the waviness along the X and Y axes, respectively, in [mm].