topostats.statistics#

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

Attributes#

Functions#

image_statistics(→ pandas.DataFrame)

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.ndarray, filename: str, pixel_to_nm_scaling: float, results_df: pandas.DataFrame) pandas.DataFrame[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.

  • results_df (pd.DataFrame) – Pandas DataFrame of statistics pertaining to individual grains including from grainstats and dna tracing.

Returns:

Dictionary of image statistics.

Return type:

dict

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

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

Parameters:

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

Returns:

The RMS roughness of the input array.

Return type:

float