Skip to main content

lcmlog-py

LCM log utilities

Installation

lcmlog-py is available on PyPI:

pip install lcmlog-py

Usage

Events

lcmlog-py provides classes to abstract the LCM log file format. The Event class represents a single event in the log file. An Event is composed of a header, channel string, and data byte array.

The Header class represents a fixed-length header at the beginning of each event which describes the event number, timestamp, and channel/data lengths. This is parsed first, and then the channel and data are read in.

If the header is read incorrectly or is corrupt, a BadSyncError is raised.

To read a header, call the Header.from_file method:

from lcmlog import Header

with open('lcmlog', 'rb') as f:
    header = Header.from_file(f)

print(header.timestamp)  # e.g.

A full event can be read via the Event.from_file method:

from lcmlog.event import Event

with open('lcmlog', 'rb') as f:
    event = Event.from_file(f)

print(event.header.timestamp)
print(event.channel)  # e.g.

Log Reader & Writer

lcmlog-py also provides two utility classes for reading and writing LCM log files in order.

The LogReader reads events from a file (starting at the beginning) and the LogWriter writes events to a file. The LogReader class is iterable. Both classes close their respective files when they are garbage collected.

from lcmlog import LogReader, LogWriter

reader = LogReader('lcmlog_source')
writer = LogWriter('lcmlog_dest')

# Read and write each event
for event in reader:
    writer.write(event)

Metadata

Release files for lcmlog-py 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lcmlog-py 0.1.0
File Size Uploaded
lcmlog_py-0.1.0.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lcmlog-py 0.1.0
File Interpreter ABI Platform
lcmlog_py-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.8 kB

Release files / lcmlog_py-0.1.0.tar.gz

Download URL lcmlog_py-0.1.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e435d6016c40d42df657ccbf171a66b0ceaed34d4f8dd5fea49d5a552e46005c
BLAKE2b-256 checksum
How to use checksums
dea33bc23453afc785bb04d711e5c7c1a2e1b9f16d541b578eb52bcee9b0914a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.10.6 Linux/5.19.17-051917-generic

Release files / lcmlog_py-0.1.0-py3-none-any.whl

Download URL lcmlog_py-0.1.0-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d64d5974516128301919fff9fc995ba715172b2060e7faab7a79834b3a5aded
BLAKE2b-256 checksum
How to use checksums
40b606d212a03f8b21db9ffcdd7cc9ff950da22e35d644ce6d9a85d5484e2f92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.10.6 Linux/5.19.17-051917-generic

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page