Skip to main content

Peaks and codecs

decode_peaks is the only entry point you should need; the codec selection is automatic. This page documents what happens under the hood for users who need to interpret performance or implement a compatible reader.

Output shape​

pub struct Peak {
pub scan: u32, // mobility bin
pub tof: u32, // TOF index
pub intensity: u32, // detector counts
}

The output is a flat Vec<Peak> for a frame, in (scan, tof) order.

Codec dispatch​

compression_type() returns the GlobalMetadata TimsCompressionType value, which determines the decode path used by decode_peaks:

ValueCodecPipeline
1LZF + signed-delta TOFOne LZF blob per scan, signed-delta-encoded TOF stream. Includes a Rust LZF decoder; no liblzf dependency.
2zstd + byte-transpose + deltaSingle zstd blob per frame, untransposed back into TOF and intensity streams, then delta-decoded.

For the exact byte layout and the LZF implementation specifics, see the format spec: