Skip to main content

stack

Function stack 

Source
pub fn stack(
    files: &[&Mf4File],
    alignment: TimeAlignment,
) -> Result<Vec<StackedSeries>>
Expand description

Combines several measurements side by side: every file’s channels present together, rather than one file’s samples after another’s.

Nothing is merged and nothing is resampled. A channel name that appears in two files yields two series, each keeping its own file’s samples and its own file’s sample rate; StackedSeries::file_index says which file each came from. Files need not have the same structure — a channel present in only one of them simply appears once.

The “common time base” is a common origin, not a common raster: under TimeAlignment::StartTime each file’s timestamps are shifted by its header start time relative to the earliest file’s, so t = 0 means the same instant for all of them. asammdf’s MDF.stack does exactly this. To put stacked series on one raster as well, resample them afterwards with SignalSeries::resample.

§Example

let a = Mf4File::open("engine.mf4")?;
let b = Mf4File::open("chassis.mf4")?;
for s in multi_ops::stack(&[&a, &b], TimeAlignment::StartTime)? {
    println!("file {}: {}", s.file_index, s.series.name());
}