GG Diagram: vehicle dynamics acceleration heatmap visualization (lateral vs longitudinal)
Project description
gg-diagram
Publication-quality GG diagrams for vehicle dynamics analysis.
Plot lateral vs longitudinal acceleration as distance-weighted heatmaps. Based on the GG diagram concept from Milliken & Milliken's Race Car Vehicle Dynamics (1995).
Real driving data (AEGIS dataset, 81 km, Graz, Austria). Left: raw IMU signal with gravity bias. Right: after in-field calibration -- the acceleration cloud is centered and aligned with the vehicle axes.
Installation
pip install gg-diagram
Quick Start
import pandas as pd
from gg_diagram import gg_heatmap
df = pd.read_parquet("my_driving_data.parquet")
fig = gg_heatmap(df, ax_col="ax_mps2", ay_col="ay_mps2", speed_col="speed_mps")
fig.show()
Features
- Distance-weighted heatmap -- bins weighted by
speed * dt, not sample count - Log scale -- reveals both high-density core and low-density tails
- Publication style -- directional axis labels (Braking/Acceleration, Right/Left Turn), external contour, automotive colorscale
- Before/After comparison --
gg_compare()with shared color axis - Two modes --
mode="interactive"(rich hover) ormode="paper"(compact for export) - Auto unit detection -- accepts m/s2, g, or mG
- Variable frequency -- computes dt from timestamps (handles multi-rate datasets)
API
gg_heatmap(df, ...)
Single GG diagram.
fig = gg_heatmap(
df,
ax_col="ax_mps2", # longitudinal acceleration column
ay_col="ay_mps2", # lateral acceleration column
speed_col="speed_mps", # speed in m/s (for distance weighting)
ts_col="ts", # timestamp column (for variable dt)
hz=10.0, # fallback frequency if no timestamps
title="My GG Diagram",
mode="interactive", # or "paper"
output_html="gg.html", # optional HTML export
)
gg_compare(df_before, df_after, ...)
Side-by-side comparison with shared color scale.
fig = gg_compare(
df_before, df_after,
title_before="Raw",
title_after="Calibrated",
main_title="IMU Rectification",
mode="paper",
output_html="compare.html",
)
gg_scatter(df, ...)
Scatter plot with optional speed coloring.
fig = gg_scatter(df, color_col="speed_mps")
Metrics
Each figure exposes severity metrics via fig._gg_meta:
fig._gg_meta["std_gx"] # Std of longitudinal acceleration (g)
fig._gg_meta["std_gy"] # Std of lateral acceleration (g)
fig._gg_meta["total_distance_km"] # Total distance (km)
Data Format
The package expects a pandas DataFrame with at minimum:
| Column | Unit | Description |
|---|---|---|
ax_mps2 |
m/s2 | Longitudinal acceleration |
ay_mps2 |
m/s2 | Lateral acceleration |
speed_mps |
m/s | Vehicle speed (for distance weighting) |
ts |
datetime | Timestamp (optional, for variable-rate data) |
Column names are configurable via ax_col, ay_col, speed_col, ts_col.
Links
- Research: research.roadsimulator3.fr
- Simulator: simulate.roadsimulator3.fr
- Author: Sebastien Edet
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gg_diagram-0.2.0.tar.gz.
File metadata
- Download URL: gg_diagram-0.2.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c03242b32ca552f72eaff01c05619b1ee96b379f06357a229c02448e3cc8444d
|
|
| MD5 |
ad1f02eea398d5e4d093bb87c94a3b0a
|
|
| BLAKE2b-256 |
95243dd259b8be72a50c9cbb01e40e151e7f6ef17590665791f51803db031705
|
File details
Details for the file gg_diagram-0.2.0-py3-none-any.whl.
File metadata
- Download URL: gg_diagram-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8655bca75d1dbf24afeda696e5fbfe3f4efbb24e79372a28c54d1000797fdd04
|
|
| MD5 |
c326a27fbe5c268a2366733e5c4e1d34
|
|
| BLAKE2b-256 |
79cfe998a12bac5dbf8a597d2f330afea2073ec3e89662f511b999c6506ae0fa
|