playnano.io.formats.read_asd module¶
Module to decode and load .asd high-speed AFM data files as an AFMImageStack.
Files containing multiple image frames are read together. Height data (channel ‘TP’) is converted to nm from the guessed source unit.
Timing (per-frame): asd files record a uniform frame time in the header, so
timestamp (seconds from frame 0) and frame_duration_s are the same for
every frame. Absolute time (start_epoch_ms) is derived from the header
date, which is the END of acquisition (the file’s write time), backdated by
num_frames * frame_duration_s to place frame 0 at the true start.
Frame direction (scan_direction) is left as None, asd files don’t encode
slow-axis direction. Anecdotally, the asd scan_direction is usually topDown
(or Ygo).
The asd scan_direction integer in the header encodes an acquisition mode
plus channel-1 fast-axis direction, although I’ve not found formal documentation
of this. The raw value, file version and channel signature are preserved in
stack.acquisition for later decoding.
- playnano.io.formats.read_asd.load_asd_file(file_path: Path | str, channel: str) AFMImageStack[source]¶
Load an .asd HS-AFM file into an AFMImageStack, with height data in nm.
- Parameters:
- Returns:
Loaded stack.
Data is held in
dataas a 3D array (N, H, W). The stack’spixel_size_nmis the constant pixel size in nanometres, andchannelis the channel name.Per-frame
frame_metadatapopulatestimestamp,frame_pixel_size_nm,line_rate,frame_duration_sandstart_epoch_ms;scan_directionstays None.Stack-level
acquisitionrecords asd-specific provenance:asd_file_version,asd_scan_direction_raw(undecoded int),asd_channels(tuple).bidirectionalis not set, asd files don’t encode slow-axis alternation.- Return type: