Statistics Modules
Function for calculating statistics about a whole image, for example number of grains or surface roughness.
image_statistics(image: npt.NDArray, filename: str, pixel_to_nm_scaling: float, n_grains: int) -> dict[str, int | str | float]
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:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
ndarray
|
Numpy 2D image array of the image to calculate stats for. |
required |
filename
|
str
|
The name of the file being processed. |
required |
pixel_to_nm_scaling
|
float
|
Float of the scaling factor between pixels and nanometres. |
required |
n_grains
|
int
|
Number of grains in image. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, int | str | float]
|
Dictionary of image statistics. |
Source code in topostats\statistics.py
roughness_rms(image: np.ndarray) -> float
Calculate the root-mean-square roughness of a heightmap image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
ndarray
|
2-D numpy array of heightmap data to calculate roughness. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The RMS roughness of the input array. |