**Crash test data analysis, visualization, and reporting.**
Impakt is a modular, scriptable Python toolkit for working with automotive crash test data. It reads ISO 13499 MME data natively, provides non-destructive signal processing, interactive web-based visualization, injury criteria calculation, and protocol-compliant report generation for Euro NCAP, US NCAP, and IIHS.
1.**Immutable raw data.** Original MME files are never modified. All state — sessions, cached computations, user overrides — lives in a `.impakt/` subfolder alongside the test data.
2.**Non-destructive transforms.** Filtering, alignment, and math operations produce new channel views. The transformation chain is stored and reproducible.
3.**Scriptable first.** Every operation available in the UI is accessible through a Python API. The web UI is a frontend to the same engine.
4.**Template-driven workflow.** Reusable templates define plot layouts, filter chains, channel selections, corridors, and report configurations. Templates live in a global library; sessions bind templates to specific test data.
5.**Protocol-aware.** Built-in knowledge of Euro NCAP, US NCAP, and IIHS injury criteria, scoring thresholds, and report formats.
6.**Plugin-extensible.** Custom readers, transforms, injury criteria, report templates, and UI components can be registered through a plugin API.
---
## Architecture Overview
```mermaid
graph TB
subgraph "Data Layer"
IO[impakt.io]
CH[impakt.channel]
end
subgraph "Processing Layer"
TR[impakt.transform]
CR[impakt.criteria]
PR[impakt.protocol]
end
subgraph "Presentation Layer"
PL[impakt.plot]
RP[impakt.report]
WB[impakt.web]
end
subgraph "Orchestration Layer"
TM[impakt.template]
SC[impakt.script]
PG[impakt.plugin]
end
IO -->|"parse MME/other"| CH
CH -->|"channel data"| TR
TR -->|"filtered/aligned"| CR
CR -->|"injury values"| PR
PR -->|"scores & ratings"| RP
CH -->|"raw & derived"| PL
TR -->|"processed"| PL
CR -->|"criteria results"| PL
PL -->|"figures"| RP
PL -->|"interactive plots"| WB
TM -->|"orchestrates"| IO
TM -->|"orchestrates"| TR
TM -->|"orchestrates"| PL
TM -->|"orchestrates"| CR
SC -->|"drives"| TM
SC -->|"drives"| IO
SC -->|"drives"| TR
SC -->|"drives"| PL
PG -.->|"extends"| IO
PG -.->|"extends"| TR
PG -.->|"extends"| CR
PG -.->|"extends"| PR
PG -.->|"extends"| RP
WB -->|"calls"| SC
```
---
## Module Breakdown
### impakt.io — Data IO
Responsible for reading crash test data from disk into the internal channel model.
**Architecture:** Reader classes implement a common `Reader` protocol, enabling future format support (TDMS, CSV, UDB) without changing downstream code.
- Read `.dat` files (ASCII or binary IEEE float) into NumPy arrays
- Reconstruct time vectors from `dt` and pre-trigger sample count
- Populate `TestData` and `Channel` objects
---
### impakt.channel — Channel Model
The core data model. Channels are immutable value objects wrapping time-series data with rich metadata.
```mermaid
classDiagram
class TestData {
+test_id: str
+metadata: TestMetadata
+channels: dict~str, Channel~
+path: Path
+get(name: str) Channel
+find(pattern: str) list~Channel~
+groups() dict~str, ChannelGroup~
}
class TestMetadata {
+test_number: str
+test_date: date
+test_type: str
+vehicle: VehicleInfo
+dummy: DummyInfo
+impact: ImpactConfig
}
class Channel {
+name: str
+code: ChannelCode
+data: ndarray
+time: ndarray
+unit: str
+sample_rate: float
+cfc_class: int | None
+metadata: dict
}
class ChannelCode {
+raw: str
+test_object: str
+main_location: str
+fine_location: str
+measurement: str
+direction: str
+sense: str
+filter_class: str
+group_key() str
+is_component() bool
+axis() str
}
class ChannelGroup {
+key: str
+x: Channel | None
+y: Channel | None
+z: Channel | None
+resultant() Channel
+components() list~Channel~
}
TestData *-- TestMetadata
TestData *-- Channel
Channel *-- ChannelCode
ChannelGroup o-- Channel
```
**ISO channel naming intelligence** is embedded in `ChannelCode`. Given a raw 16-character name like `11HEAD0000H3ACXA`, the parser extracts:
| Field | Positions | Example | Meaning |
|---|---|---|---|
| Test Object | 1-2 | `11` | Driver, Hybrid III |
| Main Location | 3-6 | `HEAD` | Head |
| Fine Location | 7-10 | `0000` | Center of gravity |
| Measurement | 11-12 | `AC` | Acceleration |
| Direction | 13 | `X` | Longitudinal axis |
| Sense | 14 | `A` | SAE sign convention A |
**Auto-grouping:** Channels sharing positions 1-12 + 14-16 (differing only at position 13: X/Y/Z) are automatically grouped into `ChannelGroup` objects for one-call resultant computation.
---
### impakt.transform — Signal Processing
Non-destructive signal processing pipeline. Each transform takes a `Channel` and returns a new `Channel` — the original is never mutated.
Maps computed injury criteria to protocol-specific scores and ratings.
```mermaid
graph TB
subgraph "Criteria Results"
HIC[HIC15: 423]
CHEST[Chest Defl: 34mm]
FEMUR[Femur: 4.2kN]
NIJ[Nij: 0.61]
TI[Tibia Index: 0.8]
end
subgraph "Protocol Engines"
ENCAP[Euro NCAP Scorer]
USNCAP[US NCAP Scorer]
IIHS_E[IIHS Evaluator]
end
subgraph "Outputs"
ENCAP_R["Euro NCAP\n4 stars\nAdult: 82%"]
USNCAP_R["US NCAP\n5 stars\nP(injury): 8%"]
IIHS_R["IIHS\nGood\nAll sub-ratings: G"]
end
HIC --> ENCAP & USNCAP & IIHS_E
CHEST --> ENCAP & USNCAP & IIHS_E
FEMUR --> ENCAP & USNCAP & IIHS_E
NIJ --> ENCAP & USNCAP & IIHS_E
TI --> ENCAP
ENCAP --> ENCAP_R
USNCAP --> USNCAP_R
IIHS_E --> IIHS_R
```
**Protocol scoring:**
| Protocol | Methodology | Output |
|---|---|---|
| **Euro NCAP** | Sliding-scale performance limits per body region, mapped to color codes (Green / Yellow / Orange / Brown / Red) and points. Area percentages determine star rating. | Stars (0-5), body region colors, area scores |
| **US NCAP** | Injury risk functions convert criteria to probability of AIS 3+ injury. Combined probability maps to stars. | Stars (1-5), injury probability |
| **IIHS** | Threshold-based per criterion: Good / Acceptable / Marginal / Poor. Overall = worst sub-rating with adjustment. | G/A/M/P per region, overall rating |
Protocol thresholds are versioned and configurable — scoring rules change every few years and Impakt stores these as versioned protocol definition files.
---
### impakt.plot — Visualization
Plotting engine built on Plotly for interactive web-based visualization.
**Capabilities:**
- Single channel time-history plots
- Multi-channel overlay (same test, different channels)
- Multi-test overlay (same channel, different tests)
- Dual X-axis cursors with value readout for all plotted channels
- Tolerance corridors (user-defined or from templates)
- Zoom, pan, box select
- Resultant plots auto-computed from grouped components
```mermaid
classDiagram
class PlotSpec {
+channels: list~ChannelRef~
+corridors: list~Corridor~
+x_cursors: tuple~float, float~ | None
+x_range: tuple~float, float~ | None
+y_range: tuple~float, float~ | None
+title: str
+x_label: str
+y_label: str
}
class ChannelRef {
+test_id: str
+channel_name: str
+transform_chain: TransformChain | None
+style: PlotStyle
}
class Corridor {
+name: str
+upper: ndarray
+lower: ndarray
+time: ndarray
+style: CorridorStyle
}
class PlotStyle {
+color: str
+line_width: float
+line_dash: str
+label: str
}
class PlotEngine {
+render(spec: PlotSpec) PlotlyFigure
+to_image(spec: PlotSpec, format: str) bytes
+to_html(spec: PlotSpec) str
}
PlotSpec *-- ChannelRef
PlotSpec *-- Corridor
ChannelRef *-- PlotStyle
PlotEngine --> PlotSpec
```
**Dual X-axis cursor** — the user selects two time points (click or explicit entry). A table displays the interpolated value of every plotted channel at both cursor positions, plus the delta.
---
### impakt.report — PDF and Report Generation
Generates single-page-per-plot PDFs and multi-section protocol reports.
```mermaid
graph LR
PLOTS[Plot Specs] --> RE[Report Engine]
CRITERIA[Criteria Results] --> RE
PROTOCOL[Protocol Scores] --> RE
META[Test Metadata] --> RE
TMPL[Report Template] --> RE
RE --> PDF[PDF Output]
RE --> HTML[HTML Output]
```
**Report types:**
- **Plot sheets** — one plot per page, with metadata header (test ID, channel info, filter state)
- **Injury summary** — tabular criteria results with color-coded pass/fail per protocol
- **Full protocol report** — Euro NCAP / US NCAP / IIHS formatted report with all required sections, body region diagrams, and scoring breakdowns
---
### impakt.template — Templates and Sessions
The template/session system enables reusable analysis workflows and per-test state persistence.
| Concept | **Template** | **Session** |
|---|---|---|
| Lives in | Global library (`~/.impakt/templates/`) | Alongside test data (`.impakt/` subfolder) |