Compare commits
11 Commits
v1.2.4
...
fdd107fbb3
Author | SHA1 | Date | |
---|---|---|---|
fdd107fbb3 | |||
cd4ce55e7e | |||
27683cbbd6 | |||
25a51215a0 | |||
36c02089aa | |||
cd75689d32 | |||
57c7f6021b | |||
83922c343f | |||
72378877ec | |||
e7094d0125 | |||
16a77ecf1e |
18
README.md
18
README.md
@@ -1,13 +1,11 @@
|
|||||||
|
|
||||||
<p align="center">
|
[](https://lgtm.com/projects/g/RecordEvolution/IMCtermite/alerts/)
|
||||||
<a href="https://record-evolution.de/reswarm">
|
[](https://lgtm.com/projects/g/RecordEvolution/IMCtermite/context:cpp)
|
||||||
<img
|
[](https://lgtm.com/projects/g/RecordEvolution/IMCtermite/context:python)
|
||||||
alt="imctermite.svg"
|
[](https://img.shields.io/github/license/RecordEvolution/IMCtermite)
|
||||||
src="assets/imctermite.svg"
|
[](https://img.shields.io/github/stars/RecordEvolution/IMCtermite)
|
||||||
width="400"
|
|
||||||
/>
|
# IMCtermite
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
_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
|
_IMC Bus Format_ with the file extension _.raw_ introduced and developed by
|
||||||
@@ -219,3 +217,5 @@ in the Python folder.
|
|||||||
- https://www.imc-tm.de/produkte/messtechnik-hardware/imc-cronosflex/ueberblick/
|
- https://www.imc-tm.de/produkte/messtechnik-hardware/imc-cronosflex/ueberblick/
|
||||||
- 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://pypi.org/help/#apitoken
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ cdef class imctermite:
|
|||||||
# get JSON list of channels
|
# get JSON list of channels
|
||||||
def get_channels(self, bool data):
|
def get_channels(self, bool data):
|
||||||
chnlst = self.cpp_imc.get_channels(True,data)
|
chnlst = self.cpp_imc.get_channels(True,data)
|
||||||
chnlstjn = [jn.loads(chn.decode(errors="ignore"),parse_float=decimal.Decimal) for chn in chnlst]
|
chnlstjn = [jn.loads(chn.decode(errors="ignore")) for chn in chnlst]
|
||||||
return chnlstjn
|
return chnlstjn
|
||||||
|
|
||||||
# print channels
|
# print channels
|
||||||
@@ -32,7 +32,7 @@ cdef class imctermite:
|
|||||||
# print table including channels
|
# print table including channels
|
||||||
def print_table(self, string outputfile):
|
def print_table(self, string outputfile):
|
||||||
chnlst = self.cpp_imc.get_channels(True,True)
|
chnlst = self.cpp_imc.get_channels(True,True)
|
||||||
chnlstjn = [jn.loads(chn.decode(errors="ignore"),parse_float=decimal.Decimal) for chn in chnlst]
|
chnlstjn = [jn.loads(chn.decode(errors="ignore")) for chn in chnlst]
|
||||||
with open(outputfile.decode(),'w') as fout:
|
with open(outputfile.decode(),'w') as fout:
|
||||||
for chn in chnlstjn:
|
for chn in chnlstjn:
|
||||||
fout.write('#' +str(chn['xname']).rjust(19)+str(chn['yname']).rjust(20)+'\n')
|
fout.write('#' +str(chn['xname']).rjust(19)+str(chn['yname']).rjust(20)+'\n')
|
||||||
|
@@ -15,7 +15,7 @@ extensions = Extension(
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="imc_termite",
|
name="imc_termite",
|
||||||
version='1.2.3',
|
version='1.2.4',
|
||||||
description='IMCtermite cython extension',
|
description='IMCtermite cython extension',
|
||||||
author='Record Evolution GmbH',
|
author='Record Evolution GmbH',
|
||||||
author_email='mario.fink@record-evolution.de',
|
author_email='mario.fink@record-evolution.de',
|
||||||
|
@@ -147,8 +147,8 @@ namespace imc
|
|||||||
std::string group_uuid_, group_name_, group_comment_;
|
std::string group_uuid_, group_name_, group_comment_;
|
||||||
|
|
||||||
// constructor takes channel's block environment
|
// constructor takes channel's block environment
|
||||||
channel(channel_env chnenv, std::map<std::string,imc::block>* blocks,
|
channel(channel_env &chnenv, std::map<std::string,imc::block>* blocks,
|
||||||
std::vector<unsigned char>* buffer):
|
std::vector<unsigned char>* buffer):
|
||||||
chnenv_(chnenv), blocks_(blocks), buffer_(buffer),
|
chnenv_(chnenv), blocks_(blocks), buffer_(buffer),
|
||||||
factor_(1.), offset_(0.),
|
factor_(1.), offset_(0.),
|
||||||
group_index_(-1)
|
group_index_(-1)
|
||||||
|
@@ -70,6 +70,21 @@ namespace imc
|
|||||||
// identify type
|
// identify type
|
||||||
short int& dtype() { return dtidx_; }
|
short int& dtype() { return dtidx_; }
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
datatype(const datatype &num)
|
||||||
|
{
|
||||||
|
this->ubyte_ = num.ubyte_;
|
||||||
|
this->sbyte_ = num.sbyte_;
|
||||||
|
this->ushort_ = num.ushort_;
|
||||||
|
this->sshort_ = num.sshort_;
|
||||||
|
this->ulint_ = num.ulint_;
|
||||||
|
this->slint_ = num.slint_;
|
||||||
|
this->sfloat_ = num.sfloat_;
|
||||||
|
this->sdouble_ = num.sdouble_;
|
||||||
|
this->sdigital_ = num.sdigital_;
|
||||||
|
this->dtidx_ = num.dtidx_;
|
||||||
|
}
|
||||||
|
|
||||||
// overall assignment operator
|
// overall assignment operator
|
||||||
datatype& operator=(const datatype &num)
|
datatype& operator=(const datatype &num)
|
||||||
{
|
{
|
||||||
|
@@ -501,16 +501,16 @@ namespace imc
|
|||||||
second_ = std::stod( get_parameter(buffer,¶meters[7]) );
|
second_ = std::stod( get_parameter(buffer,¶meters[7]) );
|
||||||
|
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
struct tm* ts;
|
struct tm ts;
|
||||||
time(&rawtime);
|
time(&rawtime);
|
||||||
ts = localtime(&rawtime);
|
localtime_r(&rawtime,&ts);
|
||||||
ts->tm_mday = day_;
|
ts.tm_mday = day_;
|
||||||
ts->tm_mon = month_-1;
|
ts.tm_mon = month_-1;
|
||||||
ts->tm_year = year_-1900;
|
ts.tm_year = year_-1900;
|
||||||
ts->tm_hour = hour_;
|
ts.tm_hour = hour_;
|
||||||
ts->tm_min = minute_;
|
ts.tm_min = minute_;
|
||||||
ts->tm_sec = (int)second_;
|
ts.tm_sec = (int)second_;
|
||||||
timestamp_ = asctime(ts);
|
asctime_r(&ts,×tamp_[0]);
|
||||||
// timestamp_ = std::to_string(year_) + std::string("-") + std::to_string(month_)
|
// timestamp_ = std::to_string(year_) + std::string("-") + std::to_string(month_)
|
||||||
// + std::string("-") + std::to_string(day_)
|
// + std::string("-") + std::to_string(day_)
|
||||||
// + std::string("T") + std::to_string(hour_)
|
// + std::string("T") + std::to_string(hour_)
|
||||||
|
@@ -174,7 +174,7 @@ namespace imc
|
|||||||
// check consistency of blocks
|
// check consistency of blocks
|
||||||
void check_consistency()
|
void check_consistency()
|
||||||
{
|
{
|
||||||
for ( unsigned long int b = 0; b < this->rawblocks_.size()-1; b++ )
|
for ( unsigned long int b = 0; b < this->rawblocks_.size()-1 && this->rawblocks_.size() > 0; b++ )
|
||||||
{
|
{
|
||||||
if ( this->rawblocks_[b].get_end() >= this->rawblocks_[b+1].get_begin() )
|
if ( this->rawblocks_[b].get_end() >= this->rawblocks_[b+1].get_begin() )
|
||||||
{
|
{
|
||||||
@@ -300,7 +300,7 @@ namespace imc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// list a particular type of block
|
// list a particular type of block
|
||||||
std::vector<imc::block> list_blocks(imc::key mykey)
|
std::vector<imc::block> list_blocks(const imc::key &mykey)
|
||||||
{
|
{
|
||||||
std::vector<imc::block> myblocks;
|
std::vector<imc::block> myblocks;
|
||||||
for ( imc::block blk: this->rawblocks_ )
|
for ( imc::block blk: this->rawblocks_ )
|
||||||
|
6
makefile
6
makefile
@@ -53,6 +53,12 @@ cpp-clean :
|
|||||||
rm -vf $(EXE)
|
rm -vf $(EXE)
|
||||||
rm -vf *.o
|
rm -vf *.o
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------#
|
||||||
|
# linter and code check
|
||||||
|
|
||||||
|
check-code:
|
||||||
|
cppcheck --enable=all -I lib/ src/main.cpp
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------#
|
#-----------------------------------------------------------------------------#
|
||||||
# check version consistency of git tags and version string in package.json
|
# check version consistency of git tags and version string in package.json
|
||||||
|
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
#-----------------------------------------------------------------------------#
|
#-----------------------------------------------------------------------------#
|
||||||
|
|
||||||
import glob
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# find source files
|
# find source files
|
||||||
|
@@ -11,6 +11,9 @@ sdist: ../cython/py_imc_termite.pyx ../cython/imc_termite.pxd ../cython/py_imc_t
|
|||||||
cp -v ../LICENSE ./
|
cp -v ../LICENSE ./
|
||||||
python3 setup.py sdist
|
python3 setup.py sdist
|
||||||
|
|
||||||
|
# authentication:
|
||||||
|
# - username: __token__
|
||||||
|
# - password: <token value including pypi-prefix>
|
||||||
upload:
|
upload:
|
||||||
python3 -m twine upload dist/$(shell ls -t dist/ | head -n1)
|
python3 -m twine upload dist/$(shell ls -t dist/ | head -n1)
|
||||||
|
|
||||||
|
@@ -1,13 +1,12 @@
|
|||||||
|
|
||||||
from setuptools import setup, Extension
|
from setuptools import setup, Extension
|
||||||
import os
|
|
||||||
|
|
||||||
with open("README.md", "r", encoding="utf-8") as fh:
|
with open("README.md", "r", encoding="utf-8") as fh:
|
||||||
long_description = fh.read()
|
long_description = fh.read()
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="IMCtermite",
|
name="IMCtermite",
|
||||||
version="1.2.3",
|
version="1.2.4",
|
||||||
author="Record Evolution GmbH",
|
author="Record Evolution GmbH",
|
||||||
author_email="mario.fink@record-evolution.de",
|
author_email="mario.fink@record-evolution.de",
|
||||||
maintainer="Record Evolution GmbH",
|
maintainer="Record Evolution GmbH",
|
||||||
|
@@ -5,7 +5,6 @@ import raw_eater
|
|||||||
import raw_meat
|
import raw_meat
|
||||||
import pyarrow as pa
|
import pyarrow as pa
|
||||||
import pyarrow.parquet as pq
|
import pyarrow.parquet as pq
|
||||||
import glob
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
fileobj1 = Path("smp/Rangerover_Evoque_F-RR534_2019-05-07/").rglob("*.raw")
|
fileobj1 = Path("smp/Rangerover_Evoque_F-RR534_2019-05-07/").rglob("*.raw")
|
||||||
|
@@ -1,9 +1,7 @@
|
|||||||
|
|
||||||
import imc_termite
|
import imc_termite
|
||||||
import json
|
import json
|
||||||
import glob
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# list files in sample directory
|
# list files in sample directory
|
||||||
# fileobj1 = Path("samples/").rglob("*.raw")
|
# fileobj1 = Path("samples/").rglob("*.raw")
|
||||||
|
@@ -178,6 +178,13 @@ int main(int argc, char* argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// catch invalid or empty ".raw" file
|
||||||
|
if ( imcraw.blocks().size() == 0 )
|
||||||
|
{
|
||||||
|
std::cerr<<"this appears to be an empty/invalid '.raw' file since no blocks were found"<<"\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// list blocks
|
// list blocks
|
||||||
if ( cfgopts.count("listblocks") == 1 )
|
if ( cfgopts.count("listblocks") == 1 )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user