Compare commits
24 Commits
v2.0.9
...
befda072e5
Author | SHA1 | Date | |
---|---|---|---|
befda072e5 | |||
0b1cb2f230 | |||
ce444814c2 | |||
eec3853af9 | |||
25e114dbea | |||
740116c7ba | |||
5899bd646b | |||
1d33a81ad2 | |||
b58efae107 | |||
cc0dd9978f | |||
4834f63a67 | |||
1be78a2c5e | |||
f5581557bc | |||
8cde88848b | |||
0799513ea2 | |||
effeee105c | |||
ed5b366341 | |||
9a520ddd9c | |||
2c43087d15 | |||
60ac1365a5 | |||
57027e234e | |||
887d5db635 | |||
ecbae3f79b | |||
b54979aa74 |
2
.github/workflows/pypi-deploy.yml
vendored
2
.github/workflows/pypi-deploy.yml
vendored
@@ -1,5 +1,5 @@
|
||||
|
||||
name: Build Python Wheels
|
||||
name: CI Build Wheel
|
||||
|
||||
on:
|
||||
push:
|
||||
|
24
README.md
24
README.md
@@ -1,15 +1,13 @@
|
||||
|
||||
[](https://lgtm.com/projects/g/RecordEvolution/IMCtermite/alerts/)
|
||||
[](https://lgtm.com/projects/g/RecordEvolution/IMCtermite/context:cpp)
|
||||
[](https://lgtm.com/projects/g/RecordEvolution/IMCtermite/context:python)
|
||||
[](https://img.shields.io/github/license/RecordEvolution/IMCtermite)
|
||||
[](https://img.shields.io/github/stars/RecordEvolution/IMCtermite)
|
||||

|
||||

|
||||
[](https://pypi.org/project/IMCtermite/)
|
||||
|
||||
# IMCtermite
|
||||
|
||||
_IMCtermite_ provides access to the proprietary data format
|
||||
_IMC Bus Format_ with the file extension _.raw_ introduced and developed by
|
||||
_IMC2 Data Format_ with the file extension _.raw_ (or .dat) introduced and developed by
|
||||
[imc Test & Measurement GmbH](https://www.imc-tm.de/). This data format is
|
||||
employed i.a. by the measurement hardware
|
||||
[imc CRONOSflex](https://www.imc-tm.de/produkte/messtechnik-hardware/imc-cronosflex/ueberblick/)
|
||||
@@ -20,7 +18,9 @@ for measurement data control and analysis. Thanks to the integrated Python modul
|
||||
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](https://www.record-evolution.de/en/home-en/), the library can be used both as a command line tool for interactive usage and as a Python module to integrate the _.raw_ format into any ETL workflow.
|
||||
On the [Record Evolution Platform](https://www.record-evolution.de/en/home-en/),
|
||||
the library can be used both as a command line tool for interactive usage and as a
|
||||
Python module to integrate the _.raw_ format into any ETL workflow.
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -31,12 +31,11 @@ On the [Record Evolution Platform](https://www.record-evolution.de/en/home-en/),
|
||||
|
||||
## File format
|
||||
|
||||
[Warning: Take a look at [this issue](https://github.com/RecordEvolution/IMCtermite/issues/14) when reading this section regarding the file format.]
|
||||
|
||||
A data file of the _IMC Bus Format_ type with the extension _.raw_ is a _mixed text/binary
|
||||
A file of the _IMC2 Data Format_ type with extension _.raw_ (or .dat) is a _mixed text/binary
|
||||
file_ featuring a set of markers (keys) that indicate the start of various blocks
|
||||
of data that provide meta information and the actual measurement data. Every single
|
||||
marker is introduced by the character `"|" = 0x 7c` followed by two uppercase letters that characterize the type of marker. Each block is further divided into several
|
||||
marker is introduced by the character `"|" = 0x 7c` followed by two uppercase letters that
|
||||
characterize the type of marker. Each block is further divided into several
|
||||
parameters separated by commata `"," = 0x 2c` and terminated by a semicolon
|
||||
`";" = 0x 3b`. For instance, the header - first 600 bytes - of a raw file may
|
||||
look like this (in UTF-8 encoding):
|
||||
@@ -225,6 +224,8 @@ can be found in the `python/examples` folder.
|
||||
|
||||
- https://www.imc-tm.de/produkte/messtechnik-software/imc-famos/funktionen/im-und-export/
|
||||
- https://www.imc-tm.de/produkte/messtechnik-hardware/imc-cronosflex/ueberblick/
|
||||
- https://www.imc-tm.de/download-center/produkt-downloads/imc-famos/handbuecher
|
||||
- https://www.imc-tm.de/fileadmin/Public/Downloads/Manuals/imc_FAMOS/imcGemeinsameKomponenten.pdf
|
||||
- https://cython.readthedocs.io/en/latest/src/userguide/wrapping_CPlusPlus.html
|
||||
- https://github.com/Apollo3zehn/ImcFamosFile
|
||||
- https://apollo3zehn.github.io/ImcFamosFile/api/ImcFamosFile.FamosFileKeyType.html
|
||||
@@ -233,3 +234,6 @@ can be found in the `python/examples` folder.
|
||||
- https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
- https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
|
||||
- https://cibuildwheel.readthedocs.io/en/stable/deliver-to-pypi/
|
||||
- https://www.gnu.org/software/libiconv/
|
||||
- https://vcpkg.io/en/packages.html
|
||||
- https://vcpkg.io/en/getting-started
|
||||
|
0
lib/half.hpp → lib/3rdparty/half.hpp
vendored
0
lib/half.hpp → lib/3rdparty/half.hpp
vendored
@@ -10,7 +10,11 @@
|
||||
#include <chrono>
|
||||
#include <ctime>
|
||||
#include <time.h>
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#include <iconv.h>
|
||||
#elif defined(__WIN32__) || defined(_WIN32)
|
||||
#define timegm _mkgmtime
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
@@ -144,6 +148,7 @@ namespace imc
|
||||
return sumstr;
|
||||
}
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
// convert encoding of any descriptions, channel-names, units etc.
|
||||
class iconverter
|
||||
{
|
||||
@@ -215,6 +220,14 @@ namespace imc
|
||||
astring = outstring;
|
||||
}
|
||||
};
|
||||
#elif defined(__WIN32__) || defined(_WIN32)
|
||||
class iconverter
|
||||
{
|
||||
public:
|
||||
iconverter(std::string in_enc, std::string out_enc, size_t out_buffer_size = 1024) {}
|
||||
void convert(std::string &astring) {}
|
||||
};
|
||||
#endif
|
||||
|
||||
// channel
|
||||
struct channel
|
||||
@@ -519,6 +532,7 @@ namespace imc
|
||||
<<std::setw(width)<<std::left<<"name:"<<name_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"comment:"<<comment_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"origin:"<<origin_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"origin-comment:"<<origin_comment_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"description:"<<text_<<"\n"
|
||||
<<std::setw(width)<<std::left<<"trigger-time-nt:"<<std::put_time(std::gmtime(&tt),"%FT%T")<<"\n"
|
||||
<<std::setw(width)<<std::left<<"trigger-time:"<<std::put_time(std::gmtime(&att),"%FT%T")<<"\n"
|
||||
@@ -557,6 +571,7 @@ namespace imc
|
||||
<<"\",\"name\":\""<<name_
|
||||
<<"\",\"comment\":\""<<comment_
|
||||
<<"\",\"origin\":\""<<origin_
|
||||
<<"\",\"origin-comment\":\""<<origin_comment_
|
||||
<<"\",\"description\":\""<<text_
|
||||
<<"\",\"trigger-time-nt\":\""<<std::put_time(std::gmtime(&tt),"%FT%T")
|
||||
<<"\",\"trigger-time\":\""<<std::put_time(std::gmtime(&att),"%FT%T")
|
||||
|
9
makefile
9
makefile
@@ -10,8 +10,11 @@ SRC = src/
|
||||
LIB = lib/
|
||||
PYT = python/
|
||||
|
||||
# list headers
|
||||
# list headers and include directories
|
||||
HPP = $(wildcard $(LIB)/*.hpp)
|
||||
IPP = $(shell find $(LIB) -type f -name '*.hpp')
|
||||
KIB = $(shell find $(LIB) -type d)
|
||||
MIB = $(foreach dir,$(KIB),-I $(dir))
|
||||
|
||||
# choose compiler and its options
|
||||
CC = g++ -std=c++17
|
||||
@@ -36,12 +39,12 @@ $(EXE): check-tags $(GVSN) main.o
|
||||
$(CC) $(OPT) main.o -o $@
|
||||
|
||||
# build main.cpp and include git version/commit tag
|
||||
main.o: src/main.cpp $(HPP)
|
||||
main.o: src/main.cpp $(IPP)
|
||||
@cp $< $<.cpp
|
||||
@sed -i 's/TAGSTRING/$(GTAG)/g' $<.cpp
|
||||
@sed -i 's/HASHSTRING/$(GHSH)/g' $<.cpp
|
||||
@sed -i 's/TIMESTAMPSTRING/$(TMS)/g' $<.cpp
|
||||
$(CC) -c $(OPT) -I $(LIB) $<.cpp -o $@
|
||||
$(CC) -c $(OPT) $(MIB) $<.cpp -o $@
|
||||
@rm $<.cpp
|
||||
|
||||
install: $(EXE)
|
||||
|
@@ -5,6 +5,16 @@ from IMCtermite cimport cppimctermite
|
||||
|
||||
import json as jn
|
||||
import decimal
|
||||
import platform
|
||||
|
||||
# auxiliary function for codepage conversion
|
||||
def get_codepage(chn) :
|
||||
if platform == 'Windows' :
|
||||
chndec = jn.loads(chn.decode(errors="ignore"))
|
||||
chncdp = chndec["codepage"]
|
||||
return 'utf-8' if chncdp is None else chncdp
|
||||
else :
|
||||
return 'utf-8'
|
||||
|
||||
cdef class imctermite:
|
||||
|
||||
@@ -22,7 +32,7 @@ cdef class imctermite:
|
||||
# get JSON list of channels
|
||||
def get_channels(self, bool include_data):
|
||||
chnlst = self.cppimc.get_channels(True,include_data)
|
||||
chnlstjn = [jn.loads(chn.decode(errors="ignore")) for chn in chnlst]
|
||||
chnlstjn = [jn.loads(chn.decode(get_codepage(chn),errors="ignore")) for chn in chnlst]
|
||||
return chnlstjn
|
||||
|
||||
# print single channel/all channels
|
||||
|
@@ -1 +1 @@
|
||||
2.0.9
|
||||
2.0.20
|
||||
|
Reference in New Issue
Block a user