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.3.0.tar.gz (23.1 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.3.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.3.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.3.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.3.0.tar.gz.

File metadata

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

File hashes

Hashes for libxrk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 15549d40405ff9c4050958b42eec45c6b2f60b4953b4597bafb7829a80c15f44
MD5 3b9d69affd47d3aac243d17b1daf0151
BLAKE2b-256 aec0bd82b1fea220bcf9b5de8a3ed1583aacf5196c6cabfae7bf465d754eebff

See more details on using hashes here.

Provenance

The following attestation bundles were made for libxrk-0.3.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.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for libxrk-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d297f75943c05cf729d88ae54cf77b93bf0d6dd02de00c2434b907aedc0ddf00
MD5 a477c8c7127309dca99fdb9a06c5b541
BLAKE2b-256 1770ad79e2e45d9cb3e6c4c6eedcc7dabe51a91245ded9de25c967b4823731c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for libxrk-0.3.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.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for libxrk-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 de006898d3aab1c70b1cf3bdaafa136c9d1768a7e850009a11adcff582c65310
MD5 c76a4086bae8345be3325dac77f8b19c
BLAKE2b-256 3a02f9b94b4a9a418c4a12b4073d3996ec0b4c35c470906f164f02980cf99639

See more details on using hashes here.

Provenance

The following attestation bundles were made for libxrk-0.3.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.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for libxrk-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9958e9ca9ac5df10bb8bd270e52e78f2a599f0acd9b5bbb848c2c10d4bbe5984
MD5 539e54810b088fe747fb66e26aeb163e
BLAKE2b-256 e41ff5e1b26b5b1e4471808d243102759bd5fb55ef6a2b29db355b5241ee5a24

See more details on using hashes here.

Provenance

The following attestation bundles were made for libxrk-0.3.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