SurfaceTopography.Generic package
Submodules
SurfaceTopography.Generic.Curvature module
Scale-dependent slope
- SurfaceTopography.Generic.Curvature.scale_dependent_curvature_from_profile(topography, **kwargs)
Compute the one-dimensional scale-dependent curvature.
The scale-dependent curvature is given by
\begin{equation} h_\text{rms}^{\prime\prime}(\lambda) = \left[8A(\lambda) - 2A(2\lambda)\right]^{1/2}/\lambda^2 \end{equation}where \(A(\lambda)\) is the autocorrelation function.
- Parameters:
topography (
SurfaceTopography.Topography
orSurfaceTopography.UniformLineScan
) – Container storing the uniform topography map**kwargs (dict) – Additional keyword parameters are passed on to autocorrelation_from_profile
- Returns:
r (array) – Distances. (Units: length)
curvature (array) – Curvature. (Units: 1/length)
- SurfaceTopography.Generic.Curvature.scale_dependent_curvature_from_area(topography, **kwargs)
Compute the two-dimensional, radially averaged scale-dependent curvature.
The scale-dependent curvature is given by
\begin{equation} h_\text{rms}^{\prime\prime}(\lambda) = 4\left[8A(\lambda/2) - 2A(\lambda)\right]^{1/2}/\lambda^2 \end{equation}where \(A(\lambda)\) is the autocorrelation function.
- Parameters:
topography (SurfaceTopography or UniformLineScan) – Container storing the uniform topography map
**kwargs (dict) – Additional keyword parameters are passed on to autocorrelation_from_area
- Returns:
r (array) – Distances. (Units: length)
curvature (array) – Curvature. (Units: 1/length)
SurfaceTopography.Generic.Fractional module
- SurfaceTopography.Generic.Fractional.container_variance_half_derivative_from_autocorrelation(container, scale_dependent=False, **kwargs)
The scale-dependence is introduced by considering only the ACF below the distance scale.
This is the definition of scale-dependent elastic energy as in Wang and Müser equation 44
see container.autocorrelation concerning further arguments
- Returns:
if scale_dependent
r (array of floats)
distance scale
variance_half_derivative (array of floats)
SurfaceTopography.Generic.Moments module
Computation of moments of a discrete curve, e.g. the PSD
The example below computes the PSD of a surface topography and integrates it to obtain the RMS height.
>>> from SurfaceTopography.Generation import fourier_synthesis
>>> t = fourier_synthesis((256, 256), (256,256), hurst=0.8, rms_height=1, short_cutoff=4, long_cutoff=64)
>>> hrms = t.rms_height_from_profile()
>>> hrms_from_psd = np.sqrt(compute_1d_moment(,)
>>> assert abs(hrms_from_psd / hrms - 1) < 0.1
However, because the averaging of the PSD before integration introduces errors, it is better to sum directly the raw spectum, see the methods integrate_psd of the topographies and the container.
- SurfaceTopography.Generic.Moments.compute_1d_moment(x, y, order=1, cumulative=False)
Computes the moment of order \(\alpha\)
\[m_\alpha = \int dx y x^{\alpha}\]using trapezoidal interpolation of the integrand
Parameters:
- x: np.ndarray
sample points
- y: np.ndarray
values of the function sampled at x
- order: float, default=1
order of the moment
- cumulative: bool, default=True
if True returns the cumulative value of this integral for each x (uses cumulative_trapezoid instead of trapezoid)
- returns:
If cumulative is False (Default)
integral (float)
If cumulative is True
integral (np.ndarray of length)
- SurfaceTopography.Generic.Moments.compute_iso_moment(x, y, order=1, cumulative=False)
Computes the moment of order \(\alpha\) of the 2D isotropic funtion \(y_{2D}(x)\)
\(y\) is the 1D representation of the isotropic function \(y_{2D}(x_1, x_2) = y(|\vec x|)\)
\[m_\alpha = \int dx_1 dx_2 y_{2D}(x_1, x_2) |\vec x|^{\alpha} = 2\pi \int dx y(x) x^{\alpha + 1}\]using trapezoidal interpolation of the integrand
Parameters:
- x: np.ndarray
sample points
- y: np.ndarray
values of the function sampled at x
- order: float, default=1
order of the moment
- cumulative: bool, default=True
if True returns the cumulative value of this integral for each x (uses cumulative_trapezoid instead of trapezoid)
- returns:
If cumulative is False (Default)
integral (float)
If cumulative is True
integral (np.ndarray of length)
SurfaceTopography.Generic.ReliabilityCutoff module
Automatic determination of the reliability of the underyling data
- SurfaceTopography.Generic.ReliabilityCutoff.short_reliability_cutoff(self, other_cutoff=None)
Determine down to which distance scale the data is reliable, i.e. below which distance it may be affected by instrumental artifacts. Currently supported are tip radius artifacts and a user specified resolution.
- Returns:
short_cutoff – All data below this length scale is unreliable. For tip radius analysis, this is the length of the stencil for the second derivative used to compute the reliability cutoff.
- Return type:
float
SurfaceTopography.Generic.RobustStatistics module
Robust statistics (median, median absolute deviation, etc.) for topography data.
- SurfaceTopography.Generic.RobustStatistics.bisect(bearing_area, target_area, rtol=1e-06)
Find the root of a function using the bisection method.
- Parameters:
bearing_area (
UniformBearingArea
orNonuniformBearingArea
) – Instance of bearing area class.target_area (float) – Target bearing area.
rtol (float) – Relative tolerance for the root with respect to the initial bounds.
- Returns:
root – Height where the bearing area is equal to target_area.
- Return type:
float
- SurfaceTopography.Generic.RobustStatistics.median(self)
Compute the median height of the topography.
- Parameters:
self (
HeightContainer
) – Topography or line scan container object.- Returns:
median – Median height.
- Return type:
float
- SurfaceTopography.Generic.RobustStatistics.mad_height(self, percentile=np.float64(0.15865525393145707))
Compute the median-absolute-deviation of the height.
- Parameters:
self (
HeightContainer
) – Topography or line scan container object.percentile (float) – Fraction of the bearing area that should be considered for the deviation. (Default: One standard deviation)
- Returns:
mad_height – Median absolute deviation of the height.
- Return type:
float
- SurfaceTopography.Generic.RobustStatistics.mad_polyfit(self, nb_coeffs)
Find the polynomial that minimizes the median absolute deviation.
- Parameters:
self (
HeightContainer
) – Topography or line scan container object.nb_coeffs (int) – Number of coefficients to be fitted.
SurfaceTopography.Generic.ScaleDependentStatistics module
SurfaceTopography.Generic.ScanningProbe module
Analysis functions related to scanning-probe microscopy
SurfaceTopography.Generic.Slope module
Scale-dependent slope
- SurfaceTopography.Generic.Slope.scale_dependent_slope_from_profile(topography, **kwargs)
Compute the one-dimensional scale-dependent slope.
The scale-dependent slope is given by
\begin{equation} h_\text{rms}^\prime(\lambda) = \left[2A(\lambda)\right]^{1/2}/\lambda \end{equation}where \(A(\lambda)\) is the autocorrelation function.
- Parameters:
topography (
SurfaceTopography.Topography
orSurfaceTopography.UniformLineScan
) – Container storing the uniform topography map**kwargs (dict) – Additional keyword parameters are passed on to autocorrelation_from_profile
- Returns:
r (array) – Distances. (Units: length)
slope (array) – Slope. (Units: dimensionless)
- SurfaceTopography.Generic.Slope.scale_dependent_slope_from_area(topography, **kwargs)
Compute the two-dimensional, radially averaged scale-dependent slope.
The scale-dependent slope is given by
\begin{equation} h_\text{rms}^\prime(\lambda) = \left[2A(\lambda)\right]^{1/2}/\lambda \end{equation}where \(A(\lambda)\) is the autocorrelation function.
- Parameters:
topography (SurfaceTopography or UniformLineScan) – Container storing the uniform topography map
**kwargs (dict) – Additional keyword parameters are passed on to autocorrelation_from_area
- Returns:
r (array) – Distances. (Units: length)
slope (array) – Slope. (Units: dimensionless)
Module contents
Module containing generic functions that work for both uniform and nonuniform topographies