topostats.io#

Functions for reading and writing data.

Attributes#

Classes#

LoadScan

Load the image and image parameters from a file path.

Functions#

read_yaml(→ Dict)

Read a YAML file.

write_yaml(→ None)

Write a configuration (stored as a dictionary) to a YAML file.

Module Contents#

topostats.io.LOGGER#
topostats.io.read_yaml(filename: str | pathlib.Path) Dict[source]#

Read a YAML file.

Parameters:

filename (Union[str, Path]) – YAML file to read.

Returns:

Dictionary of the file.

Return type:

Dict

topostats.io.write_yaml(config: dict, output_dir: str | pathlib.Path) None[source]#

Write a configuration (stored as a dictionary) to a YAML file.

Parameters:
  • config (dict) – Configuration dictionary.

  • output_dir (Union[str, Path]) – Path to save the dictionary to as a YAML file (it will be called ‘config.yaml’).

class topostats.io.LoadScan(img_path: str | pathlib.Path, channel: str)#

Load the image and image parameters from a file path.

img_path#
channel#
channel_data = None#
file_path#
filename#
suffix#
image = None#
pixel_to_nm_scaling = None#
load_spm() tuple#

Extract image and pixel to nm scaling from the Bruker .spm file.

_spm_pixel_to_nm_scaling(channel_data) float#

Extract pixel to nm scaling from the SPM image metadata.

Parameters:

channel_data – Channel data

Returns:

Pixel to nm scaling factor.

Return type:

float

load_ibw() tuple#

Loads image from Asylum Research (Igor) .ibw files

_ibw_pixel_to_nm_scaling(scan) float#

Extract pixel to nm scaling from the IBW image metadata.

load_jpk() None#
static _extract_jpk(jpk: afmformats.mod_creep_compliance.AFMCreepCompliance) numpy.ndarray#

Extract data from jpk object.

get_data() None#

Method to extract image and pixel to nm scaling.