Skip to main content

build_compressed_frames

Function build_compressed_frames 

Source
pub fn build_compressed_frames(
    converter: &(dyn IndexConverter + Sync),
    frame_ids: &[u32],
    mz: &[&[f64]],
    mobility: &[&[f64]],
    intensity: &[&[f64]],
    max_scans: u32,
    compression_level: i32,
    num_threads: usize,
) -> Result<Vec<CompressedFrame>, String>
Expand description

The whole per-frame TDF writer pipeline — m/z → TOF and 1/K0 → scan conversion, (scan, tof) dedup, interleave into the Bruker layout, zstd — for a batch of frames, over a rayon pool.

This used to run one frame at a time in Python because the conversion went through the Bruker SDK, which is not safe to call concurrently on one handle. Given a Sync converter (the SDK-free BrukerFormulaConverter reproduces the SDK’s integer output exactly in both of these directions) the whole pipeline is per-frame independent, so only the final append has to stay ordered.

mz, mobility and intensity are parallel slices, one entry per frame, matching frame_ids. Results come back in input order.