1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! Minimal utilities for reading and writing ASAM MDF 4 files.
//!
//! The crate exposes a high level API under [`api`] to inspect existing
//! recordings as well as a [`writer::MdfWriter`] to generate new files. Only a
//! fraction of the MDF 4 specification is implemented.
/// File-cutting utilities (native only; not available on `wasm32-unknown-unknown`).
/// File-merging utilities (native only; not available on `wasm32-unknown-unknown`).
// Python bindings module
// Re-export the Python module when building as an extension
use *;
/// Python bindings for the ``mf4-rs`` crate: a minimal reader/writer for
/// ASAM MDF 4 measurement files.
///
/// Quick tour
/// ----------
///
/// Read::
///
/// import mf4_rs
/// mdf = mf4_rs.PyMDF("recording.mf4")
/// for g in mdf.channel_groups():
/// print(g.name, g.record_count)
/// speed = mdf.get_channel_values("Speed") # numpy.ndarray[float64]
///
/// Write::
///
/// w = mf4_rs.PyMdfWriter("out.mf4")
/// w.init_mdf_file()
/// cg = w.add_channel_group("group_0")
/// t = w.add_time_channel(cg, "Time")
/// y = w.add_float_channel(cg, "Speed")
/// w.start_data_block(cg)
/// w.write_record(cg, [
/// mf4_rs.create_float_value(0.0),
/// mf4_rs.create_float_value(123.4),
/// ])
/// w.finish_data_block(cg)
/// w.finalize()
///
/// Index (HTTP-friendly random access)::
///
/// idx = mf4_rs.PyMdfIndex.from_file("recording.mf4")
/// idx.save_to_file("recording.idx.json")
/// vals = idx.read_channel_values_by_name_as_f64("Speed", "recording.mf4")
///
/// Other utilities: :func:`merge_files`, :func:`cut_mdf_by_time`,
/// :func:`cut_mdf_by_utc`, and the :class:`PyFileLayout` block-layout
/// inspector.
///
/// All errors raised by this module are subclasses of :class:`MdfException`.