Skip to content

bagx.anomaly

bagx.anomaly

Anomaly detection for sensor data in rosbag files.

Detects outliers and anomalies in GNSS, IMU, and general message rate data. Also aggregates raw anomaly events into temporal :class:bagx.findings.Finding objects so downstream tooling (bagx diff, benchmark) can reason about segment-level readiness rather than individual events.

detect_anomalies(bag_path, topics=None, output_json=None)

Run anomaly detection on a bag file.

Parameters:

Name Type Description Default
bag_path str

Path to the bag file.

required
topics list[str] | None

Optional list of topics to analyze. If None, all topics are analyzed.

None
output_json TextIO | None

Optional file handle for JSON output.

None

Returns:

Type Description
AnomalyReport

AnomalyReport with detected anomaly events.

print_anomaly_report(report, console=None)

Pretty-print an anomaly detection report.