playnano.io.formats.read_h5jpk module

Module to decode and load .h5-jpk high speed AFM data files into Python NumPy arrays.

Files containing multiple image frames are read together. Converts the height data into nm from another metric unit (e.g. m).

playnano.io.formats.read_h5jpk.apply_z_unit_conversion(images: ndarray, channel_group: Group, channel: str = 'height_trace') → ndarray[source]

Apply z unit conversion to nanometers if needed, or guess if unknown.

playnano.io.formats.read_h5jpk.load_h5jpk(file_path: Path | str, channel: str, flip_image: bool = True) → AFMImageStack[source]

Load image stack from a JPK .h5-jpk file, scaled to nanometers.

Frames are read from the channel’s frame axis, z-scaled, converted to nm, and given real per-frame timestamps from the file’s start/end-time datasets (with an interlace-aware scan-rate fallback). Interlace (bidirectional) and motion are read from the measurement attributes.

Parameters:
  • file_path (Path | str) – Path to the .h5-jpk file.

  • channel (str) – Channel to extract.

  • flip_image (bool, optional) – Flip each image vertically if True.

Returns:

Loaded AFM image stack with metadata and per-frame info.

Return type:

AFMImageStack

Notes

In .h5-jpk files the pixel size, interlace mode and motion are defined at the measurement level and are constant across all frames, so those metadata values are identical for every frame. Timestamps and frame durations are per-frame.

This differs from .jpk and .spm folder-based data, where pixel size may vary between frames and is stored per-frame.