Skip to main content

Python parser for CarMaker ERG files.

Project description

cmerg

Python parser for CarMaker ERG files with Pandas DataFrame export.

Use and Examples

Mostly these are notes for myself but hopefully someone else finds them useful.

Installation

This package is published on PyPI under the name cmerg.

Windows

> python -m pip install -U pip
> python -m pip install cmerg

Linux

$ python3 -m pip install -U pip
$ python3 -m pip install cmerg

Examples

Import the package folder.

import cmerg

Create ERG file object. (Using example file from repo)

log1 = cmerg.ERG('test-data/Test-Dataset-1_175937.erg')

Dictionary of the signals in the file.

log1.signals

Save the vehicle speed signal to a variable.

speed = log1.get('Vhcl.v')

Plot signal.

speed.plot()

Add signal to DataFrame.

# New easy call to return a pandas DataFrame.
df = log1.to_pd()
# Simple example of adding ERG data to pandas.
import cmerg
import pandas as pd
import numpy as np

log1 = cmerg.ERG('data-file.erg')

speed = log1.get('Vhcl.v')

t = np.array(speed.timestamps)
spd = np.array(speed.samples)

df = pd.DataFrame({'time': t, 'speed': spd})

Export ERG file to CarMaker compliant csv (e.g. for import using Import from File)

log1 = cmerg.ERG('data-file.erg')
log1.export_cm_csv("./target.csv")

# it's also possible to export only quantities that matches a namespace:
log1.export_cm_csv("./target.csv", columns_filter=["Car_"])

# CM's Import from File cannot handle many digits well, therefore the exported values are rounded. The number of digits can be sepcified:
log1.export_cm_csv("./target.csv", columns_filter=["Car_"], digits=5)

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

cmerg-0.4.tar.gz (24.2 MB view details)

Uploaded Source

Built Distribution

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

cmerg-0.4-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file cmerg-0.4.tar.gz.

File metadata

  • Download URL: cmerg-0.4.tar.gz
  • Upload date:
  • Size: 24.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for cmerg-0.4.tar.gz
Algorithm Hash digest
SHA256 e2d04c2bd4f8eeb73d1950797b88ae6b8eb09f0f723c2e32368556983bc965e6
MD5 b28f15d0e8c24c65e85bba4fc33c8c5c
BLAKE2b-256 30e3e544fa6e914b2d4e5f1655e84b5de7059cb425bb8aabf093737440bbfbd9

See more details on using hashes here.

File details

Details for the file cmerg-0.4-py3-none-any.whl.

File metadata

  • Download URL: cmerg-0.4-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for cmerg-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1c70295902b7eec6b4282fa6ccc45f0cea2b17d95f9f9bdda421b1e1006e18b6
MD5 7b94fe7c7aae32d1c3f3fb262810bd51
BLAKE2b-256 febc9b87761edc03ce0057a18ab2fca991f588ceeca77dea0319460bffc636b8

See more details on using hashes here.

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