Skip to content

About

Enables extraction of measurement data from binary files with extension 'raw' used by proprietary software imcFAMOS/imcSTUDIO and facilitates its storage in open source file formats

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

License Stars Tests Release PyPI Python versions

IMCtermite

IMCtermite provides access to proprietary IMC measurement file formats introduced and developed by imc Test & Measurement GmbH. The library currently supports both the legacy IMC2 Data Format and the newer IMC3 Data Format, which are commonly encountered with the file extensions .raw and .dat. These formats are employed i.a. by the measurement hardware imc CRONOSflex to dump and store data and the software packages imc Studio & imc FAMOS for measurement data control and analysis. Thanks to the integrated Python module, the extracted measurement data can be stored in any open-source file format accessible by Python like i.a. csv, json or parquet.

On the Record Evolution Platform, the library can be used both as a command line tool for interactive usage and as a Python module to integrate IMC measurement files into any ETL workflow.

Supported formats

Overview

Format reference

IMCtermite auto-detects the file format while loading a file. The same CLI and Python interfaces are used for both supported formats; no explicit format flag is required.

format typical extensions support status notes
IMC2 .raw, .dat supported Legacy marker-based stream format
IMC3 .raw, .dat supported Structured successor format; compressed IMC3 is currently rejected

Detailed format notes live in dedicated pages:

Installation

The IMCtermite library may be employed both as a CLI tool and a python module.

CLI tool

Building the CLI requires a compiler supporting C++17.

To build the CLI tool locally, use the default target make resulting in the binary imctermite. To ensure system-wide availability, the installation of the tool (in the default location /usr/local/bin) is done via

make install

which may require root permissions.

Python

To integrate the library into a customized ETL toolchain, several python targets are available. From the repository root, use a Python 3.10+ environment and a C++17 compiler. Install the build dependencies before building the extension in place:

python3 -m pip install "setuptools>=77.0.0" wheel Cython "numpy>=1.26.0"
make python-build

Installation with pip

This fork is distributed as imctermite3 on the Python Package Index. Once published, install it with

python3 -m pip install imctermite3

The Python import remains from imctermite import ImcTermite. The distribution targets binary wheels for Windows and Linux on x86-64 with CPython 3.10-3.14 and requires NumPy, which pip installs automatically.

Do not install imctermite and imctermite3 in the same environment: both provide the imctermite import package. To replace the original distribution:

python3 -m pip uninstall imctermite
python3 -m pip install imctermite3

If your platform/architecture has no compatible wheel, pip builds the source distribution instead. This requires Python 3.10+ and a compiler supporting C++17 (e.g. gcc version >= 10.2.0). Pip installs the declared build dependencies automatically in an isolated environment.

Usage

CLI

The usage of the imctermite binary looks like this:

imctermite <imc-file> [options]

You have to provide a single supported IMC file and any option to specify what to do with the data. All available options can be listed with imctermite --help:

Options:

 -c, --listchannels      list channels
 -b, --listblocks        list IMC key-blocks
 -d, --output            output directory to print channels
 -s, --delimiter         csv delimiter/separator char for output
 -h, --help              show this help message
 -v, --version           display version

For instance, to show a list of all channels included in sample-data.raw, you do imctermite sample-data.raw --listchannels. No output files are written by default. Output files are written only when an existing (!) directory is provided as argument to the --output option. By default, every output file is written using a , delimiter. You may provide any custom separator with the option --delimiter. For example, to export CSV files using |:

mkdir -p output
imctermite samples/sampleA.raw -b -c -d output -s '|'

Python

Given the IMCtermite module is available, we can import it and declare an instance of it by passing an IMC file to the constructor:

from imctermite import ImcTermite

imcraw = ImcTermite("samples/sampleA.raw")

An example of how to create an instance and obtain the list of channels is:

from imctermite import ImcTermite

try:
    imcraw = ImcTermite("samples/sampleA.raw")
except RuntimeError as error:
    print("failed to load/parse IMC file: " + str(error))
else:
    channels = imcraw.get_channels(False)
    print(channels)

Typed channel metadata

For integrations that need a stable metadata contract without loading sample data, use the typed API:

from imctermite import ImcTermite

imcraw = ImcTermite("samples/sampleA.raw")
for channel in imcraw.get_channels_metadata():
    print(channel.name, channel.y_unit, channel.sample_count)

ChannelMetadata.name is the canonical channel name and falls back to the IMC component-group name when the source channel name is empty. The literal source value remains available as ChannelMetadata.source_name. The existing get_channels() dictionary schema is unchanged.

File, group, standalone text-object, and typed channel-property metadata are available through separate typed getters:

metadata = imcraw.get_file_metadata()
groups = imcraw.get_groups_metadata()
text_objects = imcraw.get_text_objects_metadata()
channel = imcraw.get_channels_metadata()[0]

print(metadata.producer, metadata.comment)
print(channel.properties)

Numeric x-axis bounds

For recording-window inspection, use the compact bounds API instead of serializing every sample through get_channels(include_data=True):

channel = imcraw.get_channels(include_data=False)[0]
bounds = imcraw.get_channel_x_bounds(channel["uuid"])

For numeric channels, this returns (minimum_x, maximum_x), or None when empty. It scans bounded chunks, so non-monotonic axes are supported without exporting full sample arrays to Python. Bounds preserve the legacy dictionary API's decimal rounding; they are scaled x-values, not absolute timestamps. Non-finite sample data is rejected as it is by the legacy JSON API. Event channels are rejected: use the event APIs to retain their timestamp semantics.

TSA custom-decoder support

For native custom decoders, lib/imc_raw.hpp provides copied TSA container bytes and logical timestamped-record access. This supports application-specific frame decoding while IMCtermite remains responsible only for container parsing, metadata, and sample access; it does not decode proprietary protocol descriptions or write IMC files.

A more complete example, including the methods for obtaining the channels, i.a. their data and/or directly printing them to files, can be found in the python/examples folder.

Chunked NumPy export (fast path)

For large files, you can iterate over channel data in chunks as NumPy arrays. This avoids creating large Python lists and allows for streaming processing (e.g. writing to Parquet). See python/examples/usage_numpy_chunks.py for a complete example.

Testing

See tests/README.md for prerequisites, test commands, and coverage.

References

IMC

Cython

PyPI

iconv

About

Enables extraction of measurement data from binary files with extension 'raw' used by proprietary software imcFAMOS/imcSTUDIO and facilitates its storage in open source file formats

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages