slippy.surface.RandomFilterSurface

class slippy.surface.RandomFilterSurface(target_acf: Optional[slippy.surface.ACF_class.ACF] = None, grid_spacing: Optional[float] = None, extent: Optional[Sequence] = None, shape: Optional[Sequence] = None)[source]

Surfaces based on transformations of random sequences by a filter

Filter coefficients can be found by fourier analysis or solving the least squares problem given by Patir.

Parameters
  • target_acf (slippy.surface.ACF) – An ACF object describing the trage autocorrelation function of the surface

  • grid_spacing (float, optional (None)) – The distance between surface points, must be set before the filter coefficients can be found

  • extent (2 element sequence of floats, optional (None)) – The total size of the surface in the same units as the grid spacing

  • shape (2 element sequence of ints, optional (None)) – The number of points in each direction on the surface

dist

The statistical distribution which the random sequence is drawn from

Type

scipy.stats.rv_continuous

linear_transforms: find filter coefficients by Patir's method (with extentions)
fir_filter: find filter coefficients by Hu and Tonder's method
set_moments()[source]
set_quantiles()[source]
discretise()[source]

See also

surface_like

Notes

This is a subclass of Surface and inherits all methods. All key words that can be passed to Surface on instantiation can also be passed to this class apart from ‘profile’

Examples

In the following example we will generate a randomly rough surface with an exponential ACF and a non gaussian height distribution.

>>> import slippy.surface as s  # surface generation and manipulation
>>> import numpy as np          # numerical functions
>>> np.random.seed(0)
>>> target_acf = s.ACF('exp', 2, 0.1, 0.2)  # make an example ACF
>>> # Finding the filter coefficients
>>> lin_trans_surface = s.RandomFilterSurface(target_acf=target_acf, grid_spacing=0.01)
>>> lin_trans_surface.linear_transform(filter_shape=(40,20), gtol=1e-5, symmetric=True)
>>> # Setting the skew and kurtosis of the output surface
>>> lin_trans_surface.set_moments(skew = -0.5, kurtosis=5)
>>> # generating and showing a realisation of the surface
>>> my_realisation = lin_trans_surface.discretise([512,512], periodic=False, create_new=True)
>>> fig, axes = my_realisation.show(['profile', 'acf', 'histogram'], ['image', 'image'], figsize=(15,5))

References

Hu, Y. Z., & Tonder, K. (1992). Simulation of 3-D random rough surface by 2-D digital filter and Fourier analysis. International Journal of Machine Tools, 32(1–2), 83–90. doi.org/10.1016/0890-6955(92)90064-N

Patir, N. (1978). A numerical procedure for random generation of rough surfaces. Wear, 47(2), 263–277. doi.org/10.1016/0043-1648(78)90157-6

Watson, M., Lewis, R., & Slatter, T. (2020). Improvements to the linear transform technique for generating randomly rough surfaces with symmetrical autocorrelation functions. Tribology International, 151(April), 106487. doi.org/10.1016/j.triboint.2020.106487

__init__(target_acf: Optional[slippy.surface.ACF_class.ACF] = None, grid_spacing: Optional[float] = None, extent: Optional[Sequence] = None, shape: Optional[Sequence] = None)[source]

Methods

__init__([target_acf, grid_spacing, extent, ...])

convert_coordinates(y_coord, x_coord)

discretise([output_shape, periodic, create_new])

Create a random surface realisation based on preset parameters

find_summits([mask, four_nearest, ...])

Find summits after low pass filtering

fir_filter([target_acf, filter_span])

Create a 2D FIR filter to produce a surface with the given ACF

get_acf([profile_in])

Find the auto correlation function of the surface

get_fft([profile_in])

Find the fourier transform of the surface

get_height_of_mat_vr(ratio[, void, mask, ...])

Find the height of a given material or void volume ratio

get_mat_vr(height[, void, mask, ratio])

Find the material or void volume ratio for a given height

get_points_from_extent([extent, ...])

Gets the grid points from the extent and the grid spacing

get_psd()

Find the power spectral density of the surface

get_summit_curvature([summits, mask, ...])

Get summit curvatures

interpolate(y_points, x_points[, mode, ...])

Easy memoized interpolation on surface objects

linear_transform([filter_shape, symmetric, ...])

Generates a linear transform matrix

low_pass_filter(cut_off_freq[, return_copy])

Low pass FIR filter the surface profile

max_shape()

mesh(depth[, method, parameters])

Returns a Mesh object for the surface

resample([new_grid_spacing, return_profile, ...])

Resample or crop the profile by interpolation

roughness(parameter_name[, mask, ...])

Find areal roughness parameters

set_moments([skew, kurtosis])

Sets the skew and kurtosis of the output surface

set_quantiles(quantiles)

Fit a johnson distribution to give a resulting surface with the supplied quantiles

show([property_to_plot, plot_type, ax, ...])

Plot surface properties

subtract_polynomial(order[, mask])

Flatten the surface by subtracting a polynomial

wear(name, x_pts, y_pts, depth)

Add wear / geometry changes to the surface profile

Attributes

acf

The auto correlation function of the surface profile

dimensions

The number of spatial dimensions that

dist

extent

The overall dimensions of the surface in the same units as grid spacing

fft

The fast fourier transform of the surface

grid_spacing

The distance between grid points in the x and y directions

is_analytic

is_discrete

A bool flag, True if there is a profile present

mask

A mask used to exclude some values from analysis, a single float or an array of bool the same size as profile Either a boolean array of size self.size or a float of the value to be excluded

material

A material object describing the properties of the surface

moving_surface

profile

The height data for the surface profile

psd

The power spectral density of the surface

shape

The shape of the surface profile array, the number of points in each direction

size

The total number of points in the surface

surface_type

A description of the surface type

target_acf

target_acf_array

An array of acf values used as the target for the fitting procedure

unworn_profile

wear_volumes