Skip to main content

Library for reading AIM XRK files from AIM automotive data loggers

Project description

libxrk

A Python library for reading AIM XRK and XRZ files from AIM automotive data loggers.

Features

  • Read AIM XRK files (raw data logs)
  • Read AIM XRZ files (zlib-compressed XRK files)
  • Parse track data and telemetry channels
  • GPS coordinate conversion and lap detection
  • High-performance Cython implementation
  • Supports Python 3.10 - 3.14

Installation

Install from PyPI

pip install libxrk

Install from Source

Prerequisites

On Ubuntu/Debian:

sudo apt install build-essential python3-dev

Install with Poetry

poetry install

The Cython extension will be automatically compiled during installation.

Usage

from libxrk import aim_xrk

# Read an XRK file
log = aim_xrk('path/to/file.xrk')

# Read an XRZ file (automatically decompressed)
log = aim_xrk('path/to/file.xrz')

# Access channels (each channel is a PyArrow table with 'timecodes' and value columns)
for channel_name, channel_table in log.channels.items():
    print(f"{channel_name}: {channel_table.num_rows} samples")

# Get all channels merged into a single PyArrow table
# (handles different sample rates with interpolation/forward-fill)
merged_table = log.get_channels_as_table()
print(merged_table.column_names)

# Convert to pandas DataFrame
df = merged_table.to_pandas()

# Access laps (PyArrow table with 'num', 'start_time', 'end_time' columns)
print(f"Laps: {log.laps.num_rows}")
for i in range(log.laps.num_rows):
    lap_num = log.laps.column("num")[i].as_py()
    start = log.laps.column("start_time")[i].as_py()
    end = log.laps.column("end_time")[i].as_py()
    print(f"Lap {lap_num}: {start} - {end}")

# Access metadata
print(log.metadata)

Development

Quick Check

# Run all quality checks (format check, type check, tests)
poetry run poe check

Code Formatting

This project uses Black for code formatting.

# Format all Python files
poetry run black .

Type Checking

This project uses mypy for static type checking.

# Run type checker on all Python files
poetry run mypy .

Running Tests

This project uses pytest for testing.

# Run all tests
poetry run pytest

# Run tests with verbose output
poetry run pytest -v

# Run specific test file
poetry run pytest tests/test_xrk_loading.py

# Run tests with coverage
poetry run pytest --cov=libxrk

Testing with Pyodide (WebAssembly)

You can test the library in a WebAssembly environment using Pyodide. This requires Node.js to be installed.

# Build and run tests in Pyodide (installs Emscripten SDK to build/emsdk if needed)
poetry run poe pyodide-test

Note: Pyodide tests run automatically in CI via GitHub Actions.

Building

# Build CPython wheel and sdist
poetry build

# Build all wheels (CPython, Pyodide/WebAssembly, and sdist)
poetry run poe build-all

Clean Build

# Clean all build artifacts and rebuild
rm -rf build/ dist/ src/libxrk/*.so && poetry install

Testing

The project includes end-to-end tests that validate XRK and XRZ file loading and parsing.

Test files are located in tests/test_data/ and include real XRK and XRZ files for validation.

Credits

This project incorporates code from TrackDataAnalysis by Scott Smith, used under the MIT License.

License

MIT License - See LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libxrk-0.4.0.tar.gz (24.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

libxrk-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

libxrk-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

libxrk-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

File details

Details for the file libxrk-0.4.0.tar.gz.

File metadata

  • Download URL: libxrk-0.4.0.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for libxrk-0.4.0.tar.gz
Algorithm Hash digest
SHA256 7ddd77336e8152402ad306ab56883aa4c389be80e8dce0b208cd12c0e681242f
MD5 5acb0dab8a66a136124a89f5744cd5d1
BLAKE2b-256 10b5515503f907a1d0bbb483264494760fdfdce71b952314ca8cd8a2acc3b92a

See more details on using hashes here.

Provenance

The following attestation bundles were made for libxrk-0.4.0.tar.gz:

Publisher: publish.yml on m3rlin45/libxrk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file libxrk-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for libxrk-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7409ecfdfadd3d5ff49a4f7fcdbeb5e803c3a01698cd6d752d0430237befef8c
MD5 662558d350b7260d1dc0b2fa6933b346
BLAKE2b-256 2796382b37e212769def2303e6fd477fcc4007c5cae66e09bbc4e3fb7d600480

See more details on using hashes here.

Provenance

The following attestation bundles were made for libxrk-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on m3rlin45/libxrk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file libxrk-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for libxrk-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d3054555748752119561788f1e5b1214e9ada303bce1f2da8deb73d279380743
MD5 78a7b0c04677594fc4236e8a174a6308
BLAKE2b-256 686205e14c07984adbacefbd5ec2e6a4f475036da15a85d17dd48f49b84d050e

See more details on using hashes here.

Provenance

The following attestation bundles were made for libxrk-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on m3rlin45/libxrk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file libxrk-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for libxrk-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bb46460389b474a9d0b847462feab4937a1412d1a621384ac55d4b569e9ad3a9
MD5 a823fa6d06b63e66e7c32c9da470da58
BLAKE2b-256 04137b6ce9fe2c56cb8ffd0b3398e5b234e21bd292e76e98757d567d89c08ccc

See more details on using hashes here.

Provenance

The following attestation bundles were made for libxrk-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on m3rlin45/libxrk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page