Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
fe042b531f | |||
9d5f0cff01 | |||
720acd3b62 | |||
8ca6ee3ddc | |||
379feaa85a | |||
cff2e913fc | |||
75d70a9521 | |||
![]() |
36cf0c9c18 | ||
![]() |
2326725756 | ||
![]() |
59de48424e | ||
![]() |
a44461cba6 | ||
cee146593b |
13
.github/workflows/pypi-deploy.yml
vendored
13
.github/workflows/pypi-deploy.yml
vendored
@@ -20,6 +20,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: wheel-config
|
name: wheel-config
|
||||||
path: python/
|
path: python/
|
||||||
|
- name: Display files
|
||||||
|
run: ls -lR
|
||||||
|
|
||||||
build_wheels:
|
build_wheels:
|
||||||
name: Build binary wheels on ${{ matrix.os }}
|
name: Build binary wheels on ${{ matrix.os }}
|
||||||
@@ -27,7 +29,7 @@ jobs:
|
|||||||
needs: [build_setup]
|
needs: [build_setup]
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-24.04, windows-2022]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
arch: [auto32, auto64, aarch64]
|
arch: [auto32, auto64, aarch64]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -72,10 +74,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: source-wheels
|
name: source-wheels
|
||||||
path: python/dist/*.tar.gz
|
path: python/dist/*.tar.gz
|
||||||
|
- name: Display files
|
||||||
|
run: ls -lR
|
||||||
|
|
||||||
|
|
||||||
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]
|
||||||
|
|
||||||
@@ -88,8 +92,11 @@ 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:
|
||||||
name: binary-wheels
|
|
||||||
path: dist/
|
path: dist/
|
||||||
|
pattern: binary-wheels-*
|
||||||
|
merge-multiple: true
|
||||||
|
- name: Display files
|
||||||
|
run: ls -lR
|
||||||
|
|
||||||
- uses: pypa/gh-action-pypi-publish@release/v1
|
- uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
|
15
README.md
15
README.md
@@ -222,18 +222,31 @@ can be found in the `python/examples` folder.
|
|||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
|
### IMC
|
||||||
|
|
||||||
- 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/download-center/produkt-downloads/imc-famos/handbuecher
|
||||||
- https://www.imc-tm.de/fileadmin/Public/Downloads/Manuals/imc_FAMOS/imcGemeinsameKomponenten.pdf
|
- 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://github.com/Apollo3zehn/ImcFamosFile
|
||||||
- https://apollo3zehn.github.io/ImcFamosFile/api/ImcFamosFile.FamosFileKeyType.html
|
- https://apollo3zehn.github.io/ImcFamosFile/api/ImcFamosFile.FamosFileKeyType.html
|
||||||
|
|
||||||
|
### Cython
|
||||||
|
|
||||||
|
- https://cython.readthedocs.io/en/latest/src/userguide/wrapping_CPlusPlus.html
|
||||||
|
|
||||||
|
### PyPI
|
||||||
|
|
||||||
- https://pypi.org/help/#apitoken
|
- https://pypi.org/help/#apitoken
|
||||||
- https://sgoel.dev/posts/uploading-binary-wheels-to-pypi-from-github-actions/
|
- https://sgoel.dev/posts/uploading-binary-wheels-to-pypi-from-github-actions/
|
||||||
- https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
- 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://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
|
||||||
- https://cibuildwheel.readthedocs.io/en/stable/deliver-to-pypi/
|
- https://cibuildwheel.readthedocs.io/en/stable/deliver-to-pypi/
|
||||||
|
- https://github.com/actions/download-artifact#download-all-artifacts
|
||||||
|
- https://github.com/actions/download-artifact?tab=readme-ov-file#download-multiple-filtered-artifacts-to-the-same-directory
|
||||||
|
|
||||||
|
### iconv
|
||||||
|
|
||||||
- https://www.gnu.org/software/libiconv/
|
- https://www.gnu.org/software/libiconv/
|
||||||
- https://vcpkg.io/en/packages.html
|
- https://vcpkg.io/en/packages.html
|
||||||
- https://vcpkg.io/en/getting-started
|
- https://vcpkg.io/en/getting-started
|
||||||
|
@@ -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)
|
||||||
@@ -393,7 +419,6 @@ namespace imc
|
|||||||
ybuffer_offset_ = comp_group1.Cb_.offset_buffer_;
|
ybuffer_offset_ = comp_group1.Cb_.offset_buffer_;
|
||||||
ybuffer_size_ = comp_group1.Cb_.number_bytes_;
|
ybuffer_size_ = comp_group1.Cb_.number_bytes_;
|
||||||
xstart_ = comp_group1.Cb_.x0_;
|
xstart_ = comp_group1.Cb_.x0_;
|
||||||
addtime_ = static_cast<long int>(comp_group1.Cb_.add_time_);
|
|
||||||
yfactor_ = comp_group1.CR_.factor_;
|
yfactor_ = comp_group1.CR_.factor_;
|
||||||
yoffset_ = comp_group1.CR_.offset_;
|
yoffset_ = comp_group1.CR_.offset_;
|
||||||
yunit_ = comp_group1.CR_.unit_;
|
yunit_ = comp_group1.CR_.unit_;
|
||||||
@@ -407,6 +432,10 @@ namespace imc
|
|||||||
std::time_t ts = timegm(&comp_group1.NT_.tms_); // std::mktime(&tms);
|
std::time_t ts = timegm(&comp_group1.NT_.tms_); // std::mktime(&tms);
|
||||||
trigger_time_ = std::chrono::system_clock::from_time_t(ts);
|
trigger_time_ = std::chrono::system_clock::from_time_t(ts);
|
||||||
trigger_time_frac_secs_ = comp_group1.NT_.trigger_time_frac_secs_;
|
trigger_time_frac_secs_ = comp_group1.NT_.trigger_time_frac_secs_;
|
||||||
|
// calculate absolute trigger-time
|
||||||
|
addtime_ = static_cast<long int>(comp_group1.Cb_.add_time_);
|
||||||
|
absolute_trigger_time_ = trigger_time_ + std::chrono::seconds(addtime_);
|
||||||
|
// + std::chrono::nanoseconds((long int)(trigger_time_frac_secs_*1.e9));
|
||||||
}
|
}
|
||||||
else if ( !chnenv_.compenv1_.uuid_.empty() && !chnenv_.compenv2_.uuid_.empty() )
|
else if ( !chnenv_.compenv1_.uuid_.empty() && !chnenv_.compenv2_.uuid_.empty() )
|
||||||
{
|
{
|
||||||
@@ -438,6 +467,7 @@ namespace imc
|
|||||||
std::time_t ts = timegm(&comp_group2.NT_.tms_); // std::mktime(&tms);
|
std::time_t ts = timegm(&comp_group2.NT_.tms_); // std::mktime(&tms);
|
||||||
trigger_time_ = std::chrono::system_clock::from_time_t(ts);
|
trigger_time_ = std::chrono::system_clock::from_time_t(ts);
|
||||||
trigger_time_frac_secs_ = comp_group2.NT_.trigger_time_frac_secs_;
|
trigger_time_frac_secs_ = comp_group2.NT_.trigger_time_frac_secs_;
|
||||||
|
absolute_trigger_time_ = trigger_time_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -447,12 +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();
|
||||||
|
|
||||||
// calculate absolute trigger-time
|
// convert any non-UTF-8 codepage to UTF-8 and cleanse any text
|
||||||
absolute_trigger_time_ = trigger_time_ + std::chrono::seconds(addtime_);
|
|
||||||
// + std::chrono::nanoseconds((long int)(trigger_time_frac_secs_*1.e9));
|
|
||||||
|
|
||||||
// convert any non-UTF-8 codepage to UTF-8
|
|
||||||
convert_encoding();
|
convert_encoding();
|
||||||
|
cleanse_text();
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert buffer to actual datatype
|
// convert buffer to actual datatype
|
||||||
@@ -508,6 +535,8 @@ namespace imc
|
|||||||
throw std::runtime_error("x and y data have different number of values");
|
throw std::runtime_error("x and y data have different number of values");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xprec_ = 9;
|
||||||
|
|
||||||
process_data(xdata_, xnum_values, xdatatp_, xCSbuffer);
|
process_data(xdata_, xnum_values, xdatatp_, xCSbuffer);
|
||||||
process_data(ydata_, ynum_values, ydatatp_, yCSbuffer);
|
process_data(ydata_, ynum_values, ydatatp_, yCSbuffer);
|
||||||
}
|
}
|
||||||
@@ -600,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)
|
||||||
{
|
{
|
||||||
@@ -624,7 +682,6 @@ namespace imc
|
|||||||
<<std::setw(width)<<std::left<<"significant bits:"<<ysignbits_<<"\n"
|
<<std::setw(width)<<std::left<<"significant bits:"<<ysignbits_<<"\n"
|
||||||
<<std::setw(width)<<std::left<<"buffer-offset:"<<ybuffer_offset_<<"\n"
|
<<std::setw(width)<<std::left<<"buffer-offset:"<<ybuffer_offset_<<"\n"
|
||||||
<<std::setw(width)<<std::left<<"buffer-size:"<<ybuffer_size_<<"\n"
|
<<std::setw(width)<<std::left<<"buffer-size:"<<ybuffer_size_<<"\n"
|
||||||
<<std::setw(width)<<std::left<<"add-time:"<<addtime_<<"\n"
|
|
||||||
<<std::setw(width)<<std::left<<"xname:"<<xname_<<"\n"
|
<<std::setw(width)<<std::left<<"xname:"<<xname_<<"\n"
|
||||||
<<std::setw(width)<<std::left<<"xunit:"<<xunit_<<"\n"
|
<<std::setw(width)<<std::left<<"xunit:"<<xunit_<<"\n"
|
||||||
<<std::setw(width)<<std::left<<"xstepwidth:"<<xstepwidth_<<"\n"
|
<<std::setw(width)<<std::left<<"xstepwidth:"<<xstepwidth_<<"\n"
|
||||||
@@ -660,7 +717,6 @@ namespace imc
|
|||||||
<<"\",\"yname\":\""<<prepjsonstr(yname_)
|
<<"\",\"yname\":\""<<prepjsonstr(yname_)
|
||||||
<<"\",\"yunit\":\""<<prepjsonstr(yunit_)
|
<<"\",\"yunit\":\""<<prepjsonstr(yunit_)
|
||||||
<<"\",\"significantbits\":\""<<ysignbits_
|
<<"\",\"significantbits\":\""<<ysignbits_
|
||||||
<<"\",\"addtime\":\""<<addtime_
|
|
||||||
<<"\",\"buffer-size\":\""<<ybuffer_size_
|
<<"\",\"buffer-size\":\""<<ybuffer_size_
|
||||||
<<"\",\"xname\":\""<<prepjsonstr(xname_)
|
<<"\",\"xname\":\""<<prepjsonstr(xname_)
|
||||||
<<"\",\"xunit\":\""<<prepjsonstr(xunit_)
|
<<"\",\"xunit\":\""<<prepjsonstr(xunit_)
|
||||||
|
@@ -482,7 +482,7 @@ namespace imc
|
|||||||
// construct members by parsing particular parameters from buffer
|
// construct members by parsing particular parameters from buffer
|
||||||
void parse(const std::vector<unsigned char>* buffer, const std::vector<parameter>& parameters)
|
void parse(const std::vector<unsigned char>* buffer, const std::vector<parameter>& parameters)
|
||||||
{
|
{
|
||||||
if ( parameters.size() < 7 ) throw std::runtime_error("invalid number of parameters in CD2");
|
if ( parameters.size() < 7 ) throw std::runtime_error("invalid number of parameters in NO");
|
||||||
origin_ = ( get_parameter(buffer,¶meters[2]) == std::string("1") );
|
origin_ = ( get_parameter(buffer,¶meters[2]) == std::string("1") );
|
||||||
generator_ = get_parameter(buffer,¶meters[4]);
|
generator_ = get_parameter(buffer,¶meters[4]);
|
||||||
comment_ = get_parameter(buffer,¶meters[6]);
|
comment_ = get_parameter(buffer,¶meters[6]);
|
||||||
@@ -508,7 +508,7 @@ namespace imc
|
|||||||
// construct members by parsing particular parameters from buffer
|
// construct members by parsing particular parameters from buffer
|
||||||
void parse(const std::vector<unsigned char>* buffer, const std::vector<parameter>& parameters)
|
void parse(const std::vector<unsigned char>* buffer, const std::vector<parameter>& parameters)
|
||||||
{
|
{
|
||||||
if ( parameters.size() < 8 ) throw std::runtime_error("invalid number of parameters in CD2");
|
if ( parameters.size() < 8 ) throw std::runtime_error("invalid number of parameters in NT1");
|
||||||
tms_ = std::tm();
|
tms_ = std::tm();
|
||||||
tms_.tm_mday = std::stoi( get_parameter(buffer,¶meters[2]) );
|
tms_.tm_mday = std::stoi( get_parameter(buffer,¶meters[2]) );
|
||||||
tms_.tm_mon = std::stoi( get_parameter(buffer,¶meters[3]) ) - 1;
|
tms_.tm_mon = std::stoi( get_parameter(buffer,¶meters[3]) ) - 1;
|
||||||
|
@@ -1 +1 @@
|
|||||||
2.1.5
|
2.1.14
|
||||||
|
Reference in New Issue
Block a user