Reader class
Read raw frame and header data from a log file. This is a lower level mechanism, most probably you will only need the Parser.load
factory method and not create a Reader
directly.
- class orangebox.reader.Reader(path: str, log_index: int | None = None, allow_invalid_header: bool = False)[source]
Implements a file-like object for reading a flight log and store the raw data in a structured way. Does not do any real parsing, the iterator just yields bytes.
- Parameters:
path – Path to a log file
log_index – Session index within log file. If set to
None
(the default) there will be no session selected and headers and frame data won’t be read until the first call toset_log_index()
.allow_invalid_header – Allow skipping of badly formatted headers
- set_log_index(index: int)[source]
Set the current log index and read its corresponding frame data as raw bytes, plus parse the raw headers of the selected log.
- Parameters:
index – The selected log index
- Raises:
RuntimeError – If
index
is smaller than 1 or greater thanlog_count
- property log_index: int
Return the currently set log index. May return 0 if
set_log_index()
haven’t been called yet.- Type:
int
- property log_count: int
The number of logs in the current file.
- Type:
int
- property log_pointers: List[int]
List of byte pointers to the start of each log file, including headers.
- Type:
List[int]
- property headers: Dict[str, str | int | float | List[int | float]]
Dict of parsed headers.
- Type:
dict