Compare commits

..

12 Commits

Author SHA1 Message Date
bd9135820a add non-critical key NT version 2, issue #16 2022-12-01 00:29:15 +01:00
Marko Petzold
4404590c44 put warning into readme 2022-03-03 20:52:00 +01:00
441110afd6 fix spelling in makefile 2021-10-19 17:20:25 +02:00
a81e18eebc some fixes in README e.g. nomenclature of python module 2021-10-19 15:33:25 +02:00
8f1046632c bump VERSION 2.0.3 2021-10-19 15:08:05 +02:00
37ee82037e bump VERSION 2.0.2 2021-10-19 15:05:44 +02:00
028deaa2ce * deal with any extra quotes in xunit,xname,yunit,yname => issue #13
* rename CLI binary to lowercase version
* IMCtermite.pyx: rename boolean data flag
* insert some double quotes in sampleA.raw for testing
* version 2.0.1
2021-10-19 13:48:02 +02:00
ce4a106921 * github workflow: only trigger on pushed tag
* README.md: update python installation
2021-09-22 15:08:57 +02:00
ef5aaac254 github-workflow: flatten directory structure for download artifacts for PyPI upload 2021-09-22 13:45:15 +02:00
86eb20a33b github-workflow: fix relative directory for upload source/binary artifacts 2021-09-22 13:28:16 +02:00
ba275dd62a github-workflow: fix mixed up upload/download source vs. binary wheel artifacts 2021-09-22 13:23:42 +02:00
c2a28fc333 github-workflow: upload/download wheel artifacts for PyPi deployment 2021-09-22 13:20:46 +02:00
8 changed files with 65 additions and 17 deletions

View File

@@ -3,7 +3,8 @@ name: Build Python Wheels
on: on:
push: push:
branches: [master] #branches: [master]
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
jobs: jobs:
@@ -44,6 +45,11 @@ jobs:
working-directory: python/ working-directory: python/
# env: # env:
# CIBW_BUILD: cp36-* cp37-* cp38-* cp39-* cp310-* # CIBW_BUILD: cp36-* cp37-* cp38-* cp39-* cp310-*
- name: Store binary wheels
uses: actions/upload-artifact@v2
with:
name: binary-wheels
path: python/wheelhouse/*.whl
build_sdist: build_sdist:
name: Build source distribution name: Build source distribution
@@ -61,6 +67,12 @@ jobs:
- name: Build sdist - name: Build sdist
run: python setup.py sdist run: python setup.py sdist
working-directory: python/ working-directory: python/
- name: Store source wheels
uses: actions/upload-artifact@v2
with:
name: source-wheels
path: python/dist/*.tar.gz
upload_pypi: upload_pypi:
name: Upload binary wheels to PyPI name: Upload binary wheels to PyPI
@@ -68,6 +80,17 @@ jobs:
needs: [build_wheels, build_sdist] needs: [build_wheels, build_sdist]
steps: steps:
- name: Get source wheels
uses: actions/download-artifact@v2
with:
name: source-wheels
path: dist/
- name: Get binary wheels
uses: actions/download-artifact@v2
with:
name: binary-wheels
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1 - uses: pypa/gh-action-pypi-publish@release/v1
with: with:
user: __token__ user: __token__

View File

@@ -31,6 +31,8 @@ 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 data file of the _IMC Bus Format_ type with the extension _.raw_ 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
@@ -150,8 +152,11 @@ To install the latest version simply do
python3 -m pip install IMCtermite python3 -m pip install IMCtermite
``` ```
Note, that _python3_setuptools_ and _gcc version >= 10.2.0_ are required to which provides binary wheels for multiple architectures on _Windows_ and _Linux_
successfully install and use it. and most _Python 3.x_ distributions. However, if your platform/architecture is
not supported you can still compile the source distribution yourself, which
requires _python3_setuptools_ and an up-to-date compiler supporting C++11
standard (e.g. _gcc version >= 10.2.0_).
## Usage ## Usage
@@ -187,23 +192,23 @@ options `imctermite sample-data.raw -b -c -s '|'`.
### Python ### Python
Given the `imctermite` module is available, we can import it and declare an instance Given the `IMCtermite` module is available, we can import it and declare an instance
of it by passing a _raw_ file to the constructor: of it by passing a _raw_ file to the constructor:
```Python ```Python
import imc_termite import IMCtermite
imcraw = imc_termite.imctermite(b"sample/sampleA.raw") imcraw = IMCtermite.imctermite(b"sample/sampleA.raw")
``` ```
An example of how to create an instance and obtain the list of channels is: An example of how to create an instance and obtain the list of channels is:
```Python ```Python
import imc_termite import IMCtermite
# declare and initialize instance of "imctermite" by passing a raw-file # declare and initialize instance of "imctermite" by passing a raw-file
try : try :
imcraw = imc_termite.imctermite(b"samples/sampleA.raw") imcraw = IMCtermite.imctermite(b"samples/sampleA.raw")
except RuntimeError as e : except RuntimeError as e :
print("failed to load/parse raw-file: " + str(e)) print("failed to load/parse raw-file: " + str(e))

View File

@@ -455,12 +455,12 @@ namespace imc
<<"\",\"trigger-time\":\""<<std::put_time(std::localtime(&att),"%FT%T") <<"\",\"trigger-time\":\""<<std::put_time(std::localtime(&att),"%FT%T")
<<"\",\"language-code\":\""<<language_code_ <<"\",\"language-code\":\""<<language_code_
<<"\",\"codepage\":\""<<codepage_ <<"\",\"codepage\":\""<<codepage_
<<"\",\"yname\":\""<<yname_ <<"\",\"yname\":\""<<prepjsonstr(yname_)
<<"\",\"yunit\":\""<<yunit_ <<"\",\"yunit\":\""<<prepjsonstr(yunit_)
<<"\",\"significantbits\":\""<<signbits_ <<"\",\"significantbits\":\""<<signbits_
<<"\",\"addtime\":\""<<addtime_ <<"\",\"addtime\":\""<<addtime_
<<"\",\"xname\":\""<<xname_ <<"\",\"xname\":\""<<prepjsonstr(xname_)
<<"\",\"xunit\":\""<<xunit_ <<"\",\"xunit\":\""<<prepjsonstr(xunit_)
<<"\",\"xstepwidth\":\""<<xstepwidth_ <<"\",\"xstepwidth\":\""<<xstepwidth_
<<"\",\"xoffset\":\""<<xoffset_ <<"\",\"xoffset\":\""<<xoffset_
<<"\",\"group\":{"<<"\"index\":\""<<group_index_ <<"\",\"group\":{"<<"\"index\":\""<<group_index_
@@ -477,6 +477,25 @@ namespace imc
return ss.str(); return ss.str();
} }
// prepare string value for usage in JSON dump
std::string prepjsonstr(std::string value)
{
std::stringstream ss;
ss<<quoted(value);
return strip_quotes(ss.str());
}
// remove any leading or trailing double quotes
std::string strip_quotes(std::string astring)
{
// head
if ( astring.front() == '"' ) astring.erase(astring.begin()+0);
// tail
if ( astring.back() == '"' ) astring.erase(astring.end()-1);
return astring;
}
// print channel // print channel
void print(std::string filename, const char sep = ',', int width = 25, int yprec = 9) void print(std::string filename, const char sep = ',', int width = 25, int yprec = 9)
{ {

View File

@@ -84,6 +84,7 @@ namespace imc
// noncritical keys // noncritical keys
key(false,"NO","origin of data",1), key(false,"NO","origin of data",1),
key(false,"NT","timestamp of trigger",1), key(false,"NT","timestamp of trigger",1),
key(false,"NT","timestamp of trigger",2),
key(false,"ND","(color) display properties",1), key(false,"ND","(color) display properties",1),
key(false,"NU","user defined key",1), key(false,"NU","user defined key",1),
key(false,"Np","property of channel",1), key(false,"Np","property of channel",1),

View File

@@ -3,7 +3,7 @@
SHELL := /bin/bash SHELL := /bin/bash
# name of executable and CLI tool # name of executable and CLI tool
EXE = IMCtermite EXE = imctermite
# directory names # directory names
SRC = src/ SRC = src/
@@ -31,7 +31,7 @@ INST := /usr/local/bin
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# C++ and CLI tool # C++ and CLI tool
# build exectuable # build executable
$(EXE): check-tags $(GVSN) main.o $(EXE): check-tags $(GVSN) main.o
$(CC) $(OPT) main.o -o $@ $(CC) $(OPT) main.o -o $@

View File

@@ -20,8 +20,8 @@ cdef class imctermite:
self.cppimc.set_file(rawfile) self.cppimc.set_file(rawfile)
# get JSON list of channels # get JSON list of channels
def get_channels(self, bool data): def get_channels(self, bool include_data):
chnlst = self.cppimc.get_channels(True,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(errors="ignore")) for chn in chnlst]
return chnlstjn return chnlstjn

View File

@@ -1 +1 @@
2.0.0 2.0.3

Binary file not shown.