perda.utils.diff#

perda.utils.diff.diff(rpi_data, server_data, timestamp_tolerance_s=0.002, diff_rtol=0.001, diff_atol=0.001, diff_plot_config=DiffPlotConfig(bucket_size_s=1.0, color_base_extra='blue', color_incom_extra='darkorange', color_value_mismatch='crimson', color_total='gray'), layout_config=LayoutConfig(width=1200, height=700, margin={'l': 70, 'r': 50, 't': 90, 'b': 70}, plot_bgcolor='white', title_x=0.5, title_xanchor='center', title_yanchor='top', grid_width_per_col=400, grid_height_per_row=350, grid_horizontal_spacing=0.08, grid_vertical_spacing=0.12, max_display_resolution=50), font_config=FontConfig(large=20, medium=14, small=10))[source]#

Compare two SingleRunData objects and report differences.

Performs a three-stage comparison:

  1. Variable-name alignment: reports C++ names present in one run but not the other

  2. Point-level diff: for each common variable, classifies every data point as a base-only extra, incoming-only extra, value mismatch, or match.

  3. Summary + plot: prints a diff summary table and displays an interactive Plotly bar chart of per-bucket diff counts.

Timestamps from each run are converted to seconds using the run’s timestamp_unit metadata before comparison, so runs with different logging units are handled correctly.

Parameters:
  • rpi_data (SingleRunData) – The reference (baseline) run.

  • server_data (SingleRunData) – The incoming run to compare against the baseline.

  • timestamp_tolerance_s (float) – Maximum timestamp delta (seconds) to consider two points as matching. Defaults to 0.002 (2 ms).

  • diff_rtol (float) – Relative tolerance for value comparison via np.isclose. Defaults to 1e-3.

  • diff_atol (float) – Absolute tolerance for value comparison via np.isclose. Defaults to 1e-3.

  • diff_plot_config (DiffPlotConfig)

  • layout_config (LayoutConfig)

  • font_config (FontConfig)

Return type:

Figure