playnano.io.formats.read_asd module

Load .asd high-speed AFM files as an AFMImageStack.

Files are read with AFMReader. Topography (channel "TP") is converted to nm from a unit guessed from the range of the data; other channels are left as read.

Timing: .asd headers record one frame time for the whole file, so timestamp steps evenly and frame_duration_s is the same for every frame. The header date is the end of the recording (when the file was written), so start_epoch_ms is that date minus n_frames * frame_duration_s.

Scan direction: the header does not record the slow-axis direction, so scan_direction is None. The header’s scan_direction integer seems to encode the acquisition mode and the fast-axis direction of channel 1, but it is not documented. Its raw value, the file version and the channel names are kept in stack.acquisition so they can be decoded later.

playnano.io.formats.read_asd.load_asd_file(file_path: Path | str, channel: str) → AFMImageStack[source]

Load an .asd file.

Parameters:
  • file_path (str or pathlib.Path) – The .asd file.

  • channel (str) – Channel to load: "TP" (topography), "ER" (error) or "PH" (phase).

Returns:

The stack, shape (n_frames, height, width). Topography is in nm.

Each frame_metadata entry holds timestamp (s from the first frame), frame_pixel_size_nm, line_rate (lines per second), frame_duration_s and start_epoch_ms; scan_direction is None.

stack.acquisition holds asd_file_version, asd_scan_direction_raw (the undecoded header value) and asd_channels (the two channel slots of the header). bidirectional is not set.

Return type:

AFMImageStack