Compare commits
17 Commits
v2.0.14
...
befda072e5
Author | SHA1 | Date | |
---|---|---|---|
befda072e5 | |||
0b1cb2f230 | |||
ce444814c2 | |||
eec3853af9 | |||
25e114dbea | |||
740116c7ba | |||
5899bd646b | |||
1d33a81ad2 | |||
b58efae107 | |||
cc0dd9978f | |||
4834f63a67 | |||
1be78a2c5e | |||
f5581557bc | |||
8cde88848b | |||
0799513ea2 | |||
effeee105c | |||
ed5b366341 |
8
.github/workflows/pypi-deploy.yml
vendored
8
.github/workflows/pypi-deploy.yml
vendored
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
name: Build Python Wheels
|
name: CI Build Wheel
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -40,12 +40,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: wheel-config
|
name: wheel-config
|
||||||
path: python/
|
path: python/
|
||||||
- name: Install libiconv for windows
|
|
||||||
if: matrix.os == 'windows-2019'
|
|
||||||
run: |
|
|
||||||
git clone https://github.com/Microsoft/vcpkg.git
|
|
||||||
.\vcpkg\bootstrap-vcpkg.bat
|
|
||||||
vcpkg install libiconv
|
|
||||||
- name: Build wheels
|
- name: Build wheels
|
||||||
run: python -m cibuildwheel --output-dir wheelhouse
|
run: python -m cibuildwheel --output-dir wheelhouse
|
||||||
working-directory: python/
|
working-directory: python/
|
||||||
|
21
README.md
21
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/license/RecordEvolution/IMCtermite)
|
||||||
[](https://img.shields.io/github/stars/RecordEvolution/IMCtermite)
|
[](https://img.shields.io/github/stars/RecordEvolution/IMCtermite)
|
||||||

|

|
||||||
|
[](https://pypi.org/project/IMCtermite/)
|
||||||
|
|
||||||
# IMCtermite
|
# IMCtermite
|
||||||
|
|
||||||
_IMCtermite_ provides access to the proprietary data format
|
_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
|
[imc Test & Measurement GmbH](https://www.imc-tm.de/). This data format is
|
||||||
employed i.a. by the measurement hardware
|
employed i.a. by the measurement hardware
|
||||||
[imc CRONOSflex](https://www.imc-tm.de/produkte/messtechnik-hardware/imc-cronosflex/ueberblick/)
|
[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
|
the extracted measurement data can be stored in any open-source file format
|
||||||
accessible by Python like i.a. _csv_, _json_ or _parquet_.
|
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
|
## Overview
|
||||||
|
|
||||||
@@ -31,12 +31,11 @@ On the [Record Evolution Platform](https://www.record-evolution.de/en/home-en/),
|
|||||||
|
|
||||||
## File format
|
## 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 file of the _IMC2 Data Format_ type with extension _.raw_ (or .dat) is a _mixed text/binary
|
||||||
|
|
||||||
A data file of the _IMC Bus Format_ type with the extension _.raw_ is a _mixed text/binary
|
|
||||||
file_ featuring a set of markers (keys) that indicate the start of various blocks
|
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
|
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
|
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
|
`";" = 0x 3b`. For instance, the header - first 600 bytes - of a raw file may
|
||||||
look like this (in UTF-8 encoding):
|
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-software/imc-famos/funktionen/im-und-export/
|
||||||
- https://www.imc-tm.de/produkte/messtechnik-hardware/imc-cronosflex/ueberblick/
|
- 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://cython.readthedocs.io/en/latest/src/userguide/wrapping_CPlusPlus.html
|
||||||
- https://github.com/Apollo3zehn/ImcFamosFile
|
- https://github.com/Apollo3zehn/ImcFamosFile
|
||||||
- https://apollo3zehn.github.io/ImcFamosFile/api/ImcFamosFile.FamosFileKeyType.html
|
- https://apollo3zehn.github.io/ImcFamosFile/api/ImcFamosFile.FamosFileKeyType.html
|
||||||
|
@@ -12,6 +12,8 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
|
#elif defined(__WIN32__) || defined(_WIN32)
|
||||||
|
#define timegm _mkgmtime
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------//
|
//---------------------------------------------------------------------------//
|
||||||
@@ -146,13 +148,12 @@ namespace imc
|
|||||||
return sumstr;
|
return sumstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
// convert encoding of any descriptions, channel-names, units etc.
|
// convert encoding of any descriptions, channel-names, units etc.
|
||||||
class iconverter
|
class iconverter
|
||||||
{
|
{
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
|
||||||
iconv_t cd_;
|
|
||||||
#endif
|
|
||||||
std::string in_enc_, out_enc_;
|
std::string in_enc_, out_enc_;
|
||||||
|
iconv_t cd_;
|
||||||
size_t out_buffer_size_;
|
size_t out_buffer_size_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -160,7 +161,6 @@ namespace imc
|
|||||||
iconverter(std::string in_enc, std::string out_enc, size_t out_buffer_size = 1024) :
|
iconverter(std::string in_enc, std::string out_enc, size_t out_buffer_size = 1024) :
|
||||||
in_enc_(in_enc), out_enc_(out_enc), out_buffer_size_(out_buffer_size)
|
in_enc_(in_enc), out_enc_(out_enc), out_buffer_size_(out_buffer_size)
|
||||||
{
|
{
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
|
||||||
// allocate descriptor for character set conversion
|
// allocate descriptor for character set conversion
|
||||||
// (https://man7.org/linux/man-pages/man3/iconv_open.3.html)
|
// (https://man7.org/linux/man-pages/man3/iconv_open.3.html)
|
||||||
cd_ = iconv_open(out_enc.c_str(), in_enc.c_str());
|
cd_ = iconv_open(out_enc.c_str(), in_enc.c_str());
|
||||||
@@ -174,12 +174,10 @@ namespace imc
|
|||||||
throw std::runtime_error(errmsg);
|
throw std::runtime_error(errmsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void convert(std::string &astring)
|
void convert(std::string &astring)
|
||||||
{
|
{
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
|
||||||
if ( astring.empty() ) return;
|
if ( astring.empty() ) return;
|
||||||
|
|
||||||
std::vector<char> in_buffer(astring.begin(),astring.end());
|
std::vector<char> in_buffer(astring.begin(),astring.end());
|
||||||
@@ -221,8 +219,15 @@ namespace imc
|
|||||||
std::string outstring(out_buffer.begin(),out_buffer.end()-outbytes);
|
std::string outstring(out_buffer.begin(),out_buffer.end()-outbytes);
|
||||||
astring = outstring;
|
astring = outstring;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
#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
|
// channel
|
||||||
struct channel
|
struct channel
|
||||||
@@ -527,6 +532,7 @@ namespace imc
|
|||||||
<<std::setw(width)<<std::left<<"name:"<<name_<<"\n"
|
<<std::setw(width)<<std::left<<"name:"<<name_<<"\n"
|
||||||
<<std::setw(width)<<std::left<<"comment:"<<comment_<<"\n"
|
<<std::setw(width)<<std::left<<"comment:"<<comment_<<"\n"
|
||||||
<<std::setw(width)<<std::left<<"origin:"<<origin_<<"\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<<"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-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"
|
<<std::setw(width)<<std::left<<"trigger-time:"<<std::put_time(std::gmtime(&att),"%FT%T")<<"\n"
|
||||||
@@ -565,6 +571,7 @@ namespace imc
|
|||||||
<<"\",\"name\":\""<<name_
|
<<"\",\"name\":\""<<name_
|
||||||
<<"\",\"comment\":\""<<comment_
|
<<"\",\"comment\":\""<<comment_
|
||||||
<<"\",\"origin\":\""<<origin_
|
<<"\",\"origin\":\""<<origin_
|
||||||
|
<<"\",\"origin-comment\":\""<<origin_comment_
|
||||||
<<"\",\"description\":\""<<text_
|
<<"\",\"description\":\""<<text_
|
||||||
<<"\",\"trigger-time-nt\":\""<<std::put_time(std::gmtime(&tt),"%FT%T")
|
<<"\",\"trigger-time-nt\":\""<<std::put_time(std::gmtime(&tt),"%FT%T")
|
||||||
<<"\",\"trigger-time\":\""<<std::put_time(std::gmtime(&att),"%FT%T")
|
<<"\",\"trigger-time\":\""<<std::put_time(std::gmtime(&att),"%FT%T")
|
||||||
|
@@ -1 +1 @@
|
|||||||
2.0.14
|
2.0.20
|
||||||
|
Reference in New Issue
Block a user