File I/O Utilities
For recording Rogue stream traffic to disk and replaying it later, Rogue
provides a file I/O family that spans both tree-managed PyRogue wrappers and
direct rogue.utilities.fileio endpoints.
The family is organized around three related roles:
pyrogue.utilities.fileio.StreamWriterandpyrogue.utilities.fileio.StreamReaderTree-managed wrappers that expose file selection and open/close control through a PyRogue tree.rogue.utilities.fileio.StreamWriterandrogue.utilities.fileio.StreamReaderDirect stream endpoints for capture and replay in standalone graphs or scripts.pyrogue.utilities.fileio.FileReaderA Python-side offline reader for analysis workflows that do not need to reconstruct a live stream graph.
The on-disk record format is shared by the whole family. Header words, channel IDs, flags, error fields, split-file handling, and raw-mode behavior all come from that format definition, so it is worth reading Rogue File Data Format early.
C++ API details for file I/O utilities are documented in rogue::utilities::fileio.
Common workflows include:
Capturing one or more stream channels to disk during integration and debug.
Replaying captured files back into processing pipelines.
Reading records directly in Python for offline analysis.
Extending the base writer for custom DAQ output formats.
The direct Rogue utilities are the simpler fit when a script already owns the
stream graph and just needs capture or replay endpoints. The PyRogue wrappers
are the better fit when file control should appear through DataFile,
Open, Close, IsOpen, and the rest of the tree-visible state
inherited from pyrogue.DataWriter or added by the wrapper Device.
Logging
The file I/O utilities use both Rogue C++ logging and Python logging, depending on the object:
rogue.utilities.fileio.StreamWriteruses Rogue C++ logging with logger namepyrogue.fileio.StreamWriter.pyrogue.utilities.fileio.FileReaderuses Python logging with logger namepyrogue.FileReaderby default.
This means capture-path debugging and offline-analysis debugging use different configuration APIs:
import logging
import rogue
rogue.Logging.setFilter('pyrogue.fileio.StreamWriter', rogue.Logging.Debug)
logging.getLogger('pyrogue.FileReader').setLevel(logging.DEBUG)
Subtopics
Rogue File Data Format: Defines the canonical Rogue on-disk record structure.
Writing Frames To A File: Starts from the common
pyrogue.utilities.fileio.StreamWriterwrapper, then explains the underlyingrogue.utilities.fileio.StreamWritercontrols and channel model.Reading Frames From A File: Starts from the tree-managed replay wrapper, then explains the direct
rogue.utilities.fileio.StreamReaderbehavior.Python File Reader: Lightweight coverage for non-stream Python analysis flows.
Custom Writers: Guidance for subclassing
StreamWriterfor custom output formats.
API Reference
Python:
C++: