Code Monkey home page Code Monkey logo

cmerg's Introduction

cmerg

Python parser for CarMaker ERG files with Pandas dataframe export.

Use and Examples

Moslty 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')

List 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.
# TODO: Make 'toPd()' call
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")

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

# 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_Road"], digits=5)

cmerg's People

Contributors

danielhrisca avatar j14x avatar kaipyroami avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cmerg's Issues

erg文件只会存储主车的信息吗?

请教一下,看了下解析出来的数据比如速度,加速度,距离等,貌似没有标识是哪个车的,都是主车的吗?erg文件里面存储了交通流车的数据吗,能解析出来吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.