topostats.statistics#

Function for calculating statistics about a whole image, for example number of grains or surface roughness.

Attributes#

Functions#

image_statistics(→ dict[str, int | str | float])

Calculate statistics pertaining to the whole image.

roughness_rms(→ float)

Calculate the root-mean-square roughness of a heightmap image.

Module Contents#

topostats.statistics.LOGGER#
topostats.statistics.image_statistics(image: numpy.typing.NDArray, filename: str, pixel_to_nm_scaling: float, n_grains: int) dict[str, int | str | float][source]#

Calculate statistics pertaining to the whole image.

Calculates the size of the image in pixels and metres, the root-mean-squared roughness and the grains per metre squared.

Parameters:
  • image (np.ndarray) – Numpy 2D image array of the image to calculate stats for.

  • filename (str) – The name of the file being processed.

  • pixel_to_nm_scaling (float) – Float of the scaling factor between pixels and nanometres.

  • n_grains (int) – Number of grains in image.

Returns:

Dictionary of image statistics.

Return type:

dict[str, int | str | float]

topostats.statistics.roughness_rms(image: numpy.ndarray) float[source]#

Calculate the root-mean-square roughness of a heightmap image.

Parameters:

image (np.ndarray) – 2-D numpy array of heightmap data to calculate roughness.

Returns:

The RMS roughness of the input array.

Return type:

float