Skip to content

v0.1.9-alpha

Choose a tag to compare

@CosminBMemetea CosminBMemetea released this 30 Apr 07:25
· 14 commits to main since this release

🎉 v0.1.9 – “Signal Security” 🎉

Tiny but mighty, v0.1.9 locks down edge-cases in load_blf and makes your config import painless—no more unhashable errors or hidden classes! 🚀

✨ What’s New in v0.1.9

🛠 Robust load_blf Enhancements

Unhashable-signal safety
Wrapped set(expected_signals) in a try/except block to gracefully handle cantools “NameSignalValue” objects and any other unhashables.

String-cast normalization
Coerces every entry in expected_signals to str up front and checks for duplicates immediately, preventing downstream surprises.

Error wrapping polish
Refined exception messages and logging around chunk decoding, so any BLF-stream errors surface as clear ValueErrors without stack-traces leaking.

📦 API & Packaging Tweaks

Expose CanmlConfig at package level
Now you can from canml import CanmlConfig without importing submodules.

Committer’s note
Shortened import path and cleaned up top-level all so IDEs pick up every public API immediately.

🔧 Quickstart

pip install canml==0.1.8
from canml.canmlio import (
    load_dbc_files, load_blf, to_csv, to_parquet, CanmlConfig
)

# 1️⃣ Merge & cache your DBC(s) safely
db = load_dbc_files(["vehicle.dbc", "chassis.dbc"], prefix_signals=True)

# 2️⃣ Configure BLF loading once
cfg = CanmlConfig(
    chunk_size=5000,
    progress_bar=True,
    force_uniform_timing=True,
    interval_seconds=0.02,
    interpolate_missing=True,
    dtype_map={"Engine_RPM": "int32"}
)

# 3️⃣ Full‐file decode with filters, injection, and enums
df = load_blf(
    blf_path="drive.blf",
    db=db,
    config=cfg,
    message_ids={0x100, 0x200},
    expected_signals=["Engine_RPM", "Brake_Active"]
)

print(df.head())
#    timestamp  Engine_RPM  Brake_Active  raw_timestamp
# 0       0.00        8000             0       162523.1
# 1       0.02        8050             0       162523.3

# 4️⃣ Export with metadata side-dump
to_csv(df, "drive_data.csv", metadata_path="drive_data_meta.json")
to_parquet(df, "drive_data.parquet", metadata_path="drive_data_meta.json")

Massive thanks to all contributors and issue reporters—enjoy the smoother, smarter CAN-ML! 🎉🎉