v0.1.6-alpha
🎉 v0.1.6 – “Solid Foundations” 🎉
Steady as she goes, canml enthusiasts! v0.1.6 shores up critical edge-cases, tightens resource handling, and guarantees rock-solid DataFrame outputs—now with 100% test coverage. Let’s see what’s new under the hood! 🚀
✨ New & Improved in v0.1.6
🛠 Bug Fixes & Stability
-
Logger handler deduplication
Clear any existing handlers on initialization to prevent duplicate log output when importing canmlio multiple times (#7). -
BLFReader resource safety
Wrapped BLFReader iteration in a try/finally so reader.stop() always runs—no more lingering file handles on error (#8). -
Empty-file resilience
load_blf now always returns an empty DataFrame pre-populated with a timestamp column (and any expected_signals), avoiding downstream errors when no messages are decoded (#9). -
Uniform-timing correctness
Switched to range(len(df)) for sequential timestamps and preserved originals in raw_timestamp, so your uniform spacing is rock-steady—and no more index gaps (#10).
🎨 Usability & API Tweaks
-
Consistent logging
Logging remains informative without flooding your console—major events only. -
DataFrame guarantees
Even in wildly filtered or empty scenarios, your schema stays intact: timestamp + expected signals. -
Safe dtype injection
Invalid or missing dtype mappings for injected signals now raise clear, immediate ValueErrors.
🧪 Testing & Coverage
-
100% unit-test coverage across the entire canmlio module
-
New tests for logger re-initialization, BLFReader errors, empty-BLF behavior, and uniform-timing logic.
📚 Docs & Examples
- Updated “End-to-End CAN ML” tutorial on ReadTheDocs reflects the new uniform-timing API and empty-File handling.
🔧 Quickstart
pip install canml==0.1.6from canml.canmlio import load_dbc_files, iter_blf_chunks, load_blf, to_csv
# 1️⃣ Merge multiple DBCs with safe signal prefixes
db = load_dbc_files(["vehicle.dbc", "chassis.dbc"], prefix_signals=True)
# 2️⃣ Stream-decode a BLF with guaranteed cleanup
for i, chunk in enumerate(iter_blf_chunks("drive.blf", db, chunk_size=5000)):
to_csv(chunk, f"drive_chunk_{i}.csv")
# 3️⃣ Full-load with uniform timing & raw timestamp backup
df = load_blf(
blf_path="session.blf",
db=db,
expected_signals=["Engine_RPM", "Brake_Active"],
force_uniform_timing=True,
interval_seconds=0.02
)
print(df.head())Huge thanks to everyone who filed issues, contributed fixes, and wrote tests—onwards to even smoother CAN-ML workflows! 🎉🎉