Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
06b4c4f870 | |||
a2f61f7405 | |||
bb10d80489 | |||
1eea219361 | |||
400b6eaab9 | |||
6f4511e1c2 | |||
fe042b531f | |||
9d5f0cff01 | |||
720acd3b62 | |||
8ca6ee3ddc |
13
.github/workflows/pypi-deploy.yml
vendored
13
.github/workflows/pypi-deploy.yml
vendored
@ -29,8 +29,7 @@ jobs:
|
|||||||
needs: [build_setup]
|
needs: [build_setup]
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-24.04, windows-2022]
|
os: [ubuntu-latest, windows-latest]
|
||||||
arch: [auto32, auto64, aarch64]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@ -45,12 +44,10 @@ jobs:
|
|||||||
- 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/
|
||||||
# env:
|
|
||||||
# CIBW_BUILD: cp36-* cp37-* cp38-* cp39-* cp310-*
|
|
||||||
- name: Store binary wheels
|
- name: Store binary wheels
|
||||||
uses: actions/upload-artifact@v4.6.0
|
uses: actions/upload-artifact@v4.6.0
|
||||||
with:
|
with:
|
||||||
name: binary-wheels-${{matrix.os}}-${{matrix.arch}}
|
name: binary-wheels-${{matrix.os}}-${{ strategy.job-index }}
|
||||||
path: python/wheelhouse/*.whl
|
path: python/wheelhouse/*.whl
|
||||||
|
|
||||||
build_sdist:
|
build_sdist:
|
||||||
@ -79,7 +76,7 @@ jobs:
|
|||||||
|
|
||||||
|
|
||||||
upload_pypi:
|
upload_pypi:
|
||||||
name: Upload binary wheels to PyPI
|
name: Upload wheels to PyPI
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
needs: [build_wheels, build_sdist]
|
needs: [build_wheels, build_sdist]
|
||||||
|
|
||||||
@ -92,8 +89,8 @@ jobs:
|
|||||||
- name: Get binary wheels
|
- name: Get binary wheels
|
||||||
uses: actions/download-artifact@v4.1.7
|
uses: actions/download-artifact@v4.1.7
|
||||||
with:
|
with:
|
||||||
path: dist/binary-wheels
|
path: dist/
|
||||||
pattern: dist/binary-wheels-*
|
pattern: binary-wheels-*
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
- name: Display files
|
- name: Display files
|
||||||
run: ls -lR
|
run: ls -lR
|
||||||
|
17
README.md
17
README.md
@ -2,7 +2,7 @@
|
|||||||
[](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/)
|
[](https://pypi.org/project/imctermite/)
|
||||||
|
|
||||||
# IMCtermite
|
# IMCtermite
|
||||||
|
|
||||||
@ -131,24 +131,21 @@ which may require root permissions.
|
|||||||
|
|
||||||
### Python
|
### Python
|
||||||
|
|
||||||
To integrate the library into a customized ETL toolchain, several cython targets
|
To integrate the library into a customized ETL toolchain, several python targets
|
||||||
are available. For a local build that enables you to run the examples, use:
|
are available. For a local build that enables you to run the examples, use:
|
||||||
|
|
||||||
```
|
```
|
||||||
make cython-build
|
make python-build
|
||||||
```
|
```
|
||||||
|
|
||||||
However, in a production environment, a proper installation of the module with
|
|
||||||
`make cython-install` is recommended for system-wide availability of the module.
|
|
||||||
|
|
||||||
#### Installation with pip
|
#### Installation with pip
|
||||||
|
|
||||||
The package is also available in the [Python Package Index](https://pypi.org)
|
The package is also available in the [Python Package Index](https://pypi.org)
|
||||||
at [IMCtermite](https://pypi.org/project/IMCtermite/).
|
at [imctermite](https://pypi.org/project/imctermite/).
|
||||||
To install the latest version simply do
|
To install the latest version simply do
|
||||||
|
|
||||||
```Shell
|
```Shell
|
||||||
python3 -m pip install IMCtermite
|
python3 -m pip install imctermite
|
||||||
```
|
```
|
||||||
|
|
||||||
which provides binary wheels for multiple architectures on _Windows_ and _Linux_
|
which provides binary wheels for multiple architectures on _Windows_ and _Linux_
|
||||||
@ -195,9 +192,9 @@ Given the `IMCtermite` module is available, we can import it and declare an inst
|
|||||||
of it by passing a _raw_ file to the constructor:
|
of it by passing a _raw_ file to the constructor:
|
||||||
|
|
||||||
```Python
|
```Python
|
||||||
import IMCtermite
|
import imctermite
|
||||||
|
|
||||||
imcraw = IMCtermite.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:
|
||||||
|
@ -314,10 +314,11 @@ namespace imc
|
|||||||
std::vector<unsigned char>* buffer_;
|
std::vector<unsigned char>* buffer_;
|
||||||
|
|
||||||
imc::origin_data NO_;
|
imc::origin_data NO_;
|
||||||
|
imc::language NL_;
|
||||||
imc::text CT_;
|
imc::text CT_;
|
||||||
imc::groupobj CB_;
|
imc::groupobj CB_;
|
||||||
imc::datafield CG_;
|
imc::datafield CG_;
|
||||||
|
imc::channelobj CN_;
|
||||||
|
|
||||||
// collect meta-data of channels according to env,
|
// collect meta-data of channels according to env,
|
||||||
// just everything valueable in here
|
// just everything valueable in here
|
||||||
@ -349,7 +350,7 @@ namespace imc
|
|||||||
double xoffset_, yoffset_;
|
double xoffset_, yoffset_;
|
||||||
|
|
||||||
// group reference the channel belongs to
|
// group reference the channel belongs to
|
||||||
int group_index_;
|
unsigned long int group_index_;
|
||||||
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
|
||||||
@ -362,6 +363,22 @@ namespace imc
|
|||||||
// use uuid from CN block
|
// use uuid from CN block
|
||||||
uuid_ = chnenv_.CNuuid_;
|
uuid_ = chnenv_.CNuuid_;
|
||||||
|
|
||||||
|
// extract associated NO data
|
||||||
|
if ( blocks_->count(chnenv_.NOuuid_) == 1 )
|
||||||
|
{
|
||||||
|
NO_.parse(buffer_, blocks_->at(chnenv_.NOuuid_).get_parameters());
|
||||||
|
origin_ = NO_.generator_;
|
||||||
|
comment_ = NO_.comment_;
|
||||||
|
}
|
||||||
|
|
||||||
|
// extract associated NL data
|
||||||
|
if ( blocks_->count(chnenv_.NLuuid_) == 1 )
|
||||||
|
{
|
||||||
|
NL_.parse(buffer_, blocks_->at(chnenv_.NLuuid_).get_parameters());
|
||||||
|
codepage_ = NL_.codepage_;
|
||||||
|
language_code_ = NL_.language_code_;
|
||||||
|
}
|
||||||
|
|
||||||
// extract associated CB data
|
// extract associated CB data
|
||||||
if ( blocks_->count(chnenv_.CBuuid_) == 1 )
|
if ( blocks_->count(chnenv_.CBuuid_) == 1 )
|
||||||
{
|
{
|
||||||
@ -377,6 +394,15 @@ namespace imc
|
|||||||
+ CT_.comment_;
|
+ CT_.comment_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// extract associated CN data
|
||||||
|
if ( blocks_->count(chnenv_.CNuuid_) == 1 )
|
||||||
|
{
|
||||||
|
CN_.parse(buffer_, blocks_->at(chnenv_.CNuuid_).get_parameters());
|
||||||
|
group_index_ = CN_.group_index_;
|
||||||
|
group_name_ = CN_.name_;
|
||||||
|
group_comment_ = CN_.comment_;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !chnenv_.compenv1_.uuid_.empty() && chnenv_.compenv2_.uuid_.empty() )
|
if ( !chnenv_.compenv1_.uuid_.empty() && chnenv_.compenv2_.uuid_.empty() )
|
||||||
{
|
{
|
||||||
// normal dataset (single component)
|
// normal dataset (single component)
|
||||||
@ -451,8 +477,9 @@ namespace imc
|
|||||||
// start converting binary buffer to imc::datatype
|
// start converting binary buffer to imc::datatype
|
||||||
if ( !chnenv_.CSuuid_.empty() ) convert_buffer();
|
if ( !chnenv_.CSuuid_.empty() ) convert_buffer();
|
||||||
|
|
||||||
// convert any non-UTF-8 codepage to UTF-8
|
// convert any non-UTF-8 codepage to UTF-8 and cleanse any text
|
||||||
convert_encoding();
|
convert_encoding();
|
||||||
|
cleanse_text();
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert buffer to actual datatype
|
// convert buffer to actual datatype
|
||||||
@ -602,6 +629,35 @@ namespace imc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cleanse_text()
|
||||||
|
{
|
||||||
|
escape_backslash(name_);
|
||||||
|
escape_backslash(comment_);
|
||||||
|
escape_backslash(origin_);
|
||||||
|
escape_backslash(origin_comment_);
|
||||||
|
escape_backslash(text_);
|
||||||
|
escape_backslash(language_code_);
|
||||||
|
escape_backslash(yname_);
|
||||||
|
escape_backslash(yunit_);
|
||||||
|
escape_backslash(xname_);
|
||||||
|
escape_backslash(xunit_);
|
||||||
|
escape_backslash(group_name_);
|
||||||
|
escape_backslash(group_comment_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void escape_backslash(std::string &text)
|
||||||
|
{
|
||||||
|
char backslash = 0x5c;
|
||||||
|
std::string doublebackslash("\\\\");
|
||||||
|
for ( std::string::iterator it = text.begin(); it != text.end(); ++it )
|
||||||
|
{
|
||||||
|
if ( int(*it) == backslash ) {
|
||||||
|
text.replace(it,it+1,doublebackslash);
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// get info string
|
// get info string
|
||||||
std::string get_info(int width = 20)
|
std::string get_info(int width = 20)
|
||||||
{
|
{
|
||||||
|
4
makefile
4
makefile
@ -88,11 +88,11 @@ docker-run:
|
|||||||
|
|
||||||
python-build: check-tags $(GVSN)
|
python-build: check-tags $(GVSN)
|
||||||
make -C python/ build-inplace
|
make -C python/ build-inplace
|
||||||
cp python/IMCtermite*.so ./ -v
|
cp python/imctermite*.so ./ -v
|
||||||
|
|
||||||
python-clean:
|
python-clean:
|
||||||
make -C python/ clean
|
make -C python/ clean
|
||||||
rm -vf IMCtermite*.so
|
rm -vf imctermite*.so
|
||||||
|
|
||||||
python-test:
|
python-test:
|
||||||
PYTHONPATH=./ python python/examples/usage.py
|
PYTHONPATH=./ python python/examples/usage.py
|
||||||
|
@ -1 +1 @@
|
|||||||
2.1.10
|
2.1.18
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
import IMCtermite
|
import imctermite
|
||||||
import pandas
|
import pandas
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ def add_trigger_time(trigger_time, add_time) :
|
|||||||
if __name__ == "__main__" :
|
if __name__ == "__main__" :
|
||||||
|
|
||||||
# read file and extract data
|
# read file and extract data
|
||||||
imctm = IMCtermite.imctermite(b"Measurement.raw")
|
imctm = imctermite.imctermite(b"Measurement.raw")
|
||||||
chns = imctm.get_channels(True)
|
chns = imctm.get_channels(True)
|
||||||
|
|
||||||
# prepare abscissa
|
# prepare abscissa
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
import IMCtermite
|
import imctermite
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# 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 = IMCtermite.imctermite(b"samples/exampleB.raw")
|
imcraw = imctermite.imctermite(b"samples/exampleB.raw")
|
||||||
except RuntimeError as e :
|
except RuntimeError as e :
|
||||||
raise Exception("failed to load/parse raw-file: " + str(e))
|
raise Exception("failed to load/parse raw-file: " + str(e))
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
import IMCtermite
|
import imctermite
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ for fl in rawlist1:
|
|||||||
|
|
||||||
# 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 = IMCtermite.imctermite(fl.encode())
|
imcraw = imctermite.imctermite(fl.encode())
|
||||||
except RuntimeError as e :
|
except RuntimeError as e :
|
||||||
raise Exception("failed to load/parse raw-file: " + str(e))
|
raise Exception("failed to load/parse raw-file: " + str(e))
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
import IMCtermite
|
import imctermite
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
# 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 = IMCtermite.imctermite(b"samples/sampleB.raw")
|
imcraw = imctermite.imctermite(b"samples/sampleB.raw")
|
||||||
except RuntimeError as e :
|
except RuntimeError as e :
|
||||||
raise Exception("failed to load/parse raw-file: " + str(e))
|
raise Exception("failed to load/parse raw-file: " + str(e))
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
from IMCtermite import imctermite
|
import imctermite import imctermite
|
||||||
|
|
||||||
def show_results(imcraw) :
|
def show_results(imcraw) :
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# distutils: language = c++
|
# distutils: language = c++
|
||||||
# cython: language_level = 3
|
# cython: language_level = 3
|
||||||
|
|
||||||
from IMCtermite cimport cppimctermite
|
from imctermite cimport cppimctermite
|
||||||
|
|
||||||
import json as jn
|
import json as jn
|
||||||
import decimal
|
import decimal
|
@ -29,6 +29,7 @@ build-clean:
|
|||||||
rm -vf imctermite*.so imctermite*.cpp
|
rm -vf imctermite*.so imctermite*.cpp
|
||||||
rm -vf IMCtermite*.so IMCtermite*.cpp
|
rm -vf IMCtermite*.so IMCtermite*.cpp
|
||||||
rm -rvf dist/ IMCtermite.egg-info/
|
rm -rvf dist/ IMCtermite.egg-info/
|
||||||
|
rm -rvf dist/ imctermite.egg-info/
|
||||||
|
|
||||||
cibuildwheel-build: setup
|
cibuildwheel-build: setup
|
||||||
cibuildwheel --platform linux
|
cibuildwheel --platform linux
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
name = IMCtermite
|
name = imctermite
|
||||||
description = Enables extraction of measurement data from binary files with extension 'raw' used by proprietary software imcFAMOS and imcSTUDIO and facilitates its storage in open source file formats
|
description = Enables extraction of measurement data from binary files with extension 'raw' used by proprietary software imcFAMOS and imcSTUDIO and facilitates its storage in open source file formats
|
||||||
long_description = file: README.md
|
long_description = file: README.md
|
||||||
# long_description_content_type = text/x-rst
|
# long_description_content_type = text/x-rst
|
||||||
|
@ -11,8 +11,8 @@ cmpArgs = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension = Extension(
|
extension = Extension(
|
||||||
"IMCtermite",
|
"imctermite",
|
||||||
sources=["IMCtermite.pyx"],
|
sources=["imctermite.pyx"],
|
||||||
extra_compile_args=cmpArgs[sys.platform]
|
extra_compile_args=cmpArgs[sys.platform]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user