Skip to main content

Python C extension to read IPG CarMaker ERG files

Project description

Pyerg

Pyerg is a C++ library with a Python wrapper for reading the ERG files produced by IPG CarMaker program. The library implements the specifications of the ERG file format described in the IPG CarMaker reference manual.

Henesis s.r.l. is not affiliated with IPG, the developer of CarMaker program.

Requisites

Python library

  • Linux, Windows (tested within Anaconda)
  • Python >=3.7
  • Numpy >= 1.14
  • GCC >= 4.7

C++ library

  • CMake
  • Google test library (optional, for building the C++ library)

Install Python extension

Run python setup.py install to install the pyerg module.

Build C++ library

Create a build directory in the current folder and from that directory run:

cmake ..

And then

make

The default behavior is to build a static (erg_s) and a shared (erg) version of the Erg parser library.

CMake options:

  • BUILD_PYTHON_MODULE enable the building of the pyerg Python module. When building the Python module using CMake, please check that the NUMPY_INCLUDE_DIR in the pyerg/CMakeLists.txt contains the right path to the Numpy headers.
  • BUILD_TESTS enable the building test program for the C++ library. Data for testing is not included.

Use:

cmake .. -DBUILD_PYTHON_MODULE=ON -DBUILD_TESTS=ON

To build the C++ library, the Python pyerg module and the C++ tests.

Examples of use

C++

#include <erg.h>

...

erg::Reader parser;

// Read all erg format
parser.open("my_file.erg");

// Allocate the destination memory using vector<byte> as container
std::vector<std::vector<uint8_t>> data(parser.numQuanities());
for(int i=0; i<data.size(); ++i)
    data[i].assign(parser.quantitySize(i), 0);

// Create a vector of pointer to the allocated memory to
// store the data
std::vector<uint8_t*> dataPtrList;
std::vector<size_t> dataPtrListSize;
for(std::vector<uint8_t>& v: data)
{
    dataPtrList.push_back(v.data());
    dataPtrListSize.push_back(v.size());
}

size_t numRows = parser.readAll(dataPtrList, dataWrapperSize);

// data is a vector of vector<byte> with all the quantities from
// the erg file.

Python

import pyerg

parser = pyerg.Reader()
parser.open("my_file.erg")
data = parser.readAll()

# data is a dict of numpy.ndarray with all the quantities from
# the erg file.

See the test applications for more usage examples.

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

pyerg-0.6.1.tar.gz (24.2 MB view details)

Uploaded Source

Built Distribution

pyerg-0.6.1-cp37-cp37m-win_amd64.whl (38.7 kB view details)

Uploaded CPython 3.7m Windows x86-64

File details

Details for the file pyerg-0.6.1.tar.gz.

File metadata

  • Download URL: pyerg-0.6.1.tar.gz
  • Upload date:
  • Size: 24.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for pyerg-0.6.1.tar.gz
Algorithm Hash digest
SHA256 7c0d4d5ae0589d1356a0c6631af9f1401e8a5255efe83276964df6f56d682b36
MD5 54911398802c2bbebe753b33d94e0763
BLAKE2b-256 0e09a66b1cb24a86162d2858402e2b76bd1afd18ba078c8788da2fd7b457a5fd

See more details on using hashes here.

File details

Details for the file pyerg-0.6.1-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pyerg-0.6.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 38.7 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for pyerg-0.6.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 cdb612bf53c51dc79b912a4c546d64926c2a0e2b6731d19f792513ad81e35b8d
MD5 b9330eb8eccbb6363abaf41d5e073437
BLAKE2b-256 98389bc41ea0d02b047a3eb76ecdc05ba468c33e160018bc29c62351d6569c81

See more details on using hashes here.

Supported by

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