Skip to main content

Python implementation

The Python binding is provided by the osfdata package (imported as osf). It is not a pure-Python implementation but a thin PyO3 wrapper over the Rust foundation osf-core: that yields millisecond load times and numeric data without a copy as NumPy arrays.

import osf

mgr = osf.load("measurement.osf") # .osf and .osfz
temp = mgr.channel("Sensor.Temperature")
values = temp.samples() # NumPy array, dtype matches the OSF type
time = temp.timestamps_ns()

Installation:

pip install osfdata # or: uv pip install osfdata

The full documentation — supported platforms, API overview (DataManager, Channel, Segment, WriterBuilder), writing, OSFZ and usage notes — is in the chapter Python integration. It is deliberately not duplicated here.

Source code and further reading