Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
04d523d9be | |||
48580caab0 | |||
32e36aae00 | |||
f531b0fe90 | |||
511b665643 | |||
5b6ca45f18 | |||
3dd3cf1446 | |||
b91f273cb8 | |||
fe741b698c | |||
d53e057dca | |||
6c1fd021c2 | |||
![]() |
177f368fdf | ||
![]() |
73ff748ff4 | ||
193d9ac010 | |||
b4136c0b03 | |||
![]() |
759c88dfb4 | ||
![]() |
dec58d4668 | ||
![]() |
e0e293c4d4 | ||
![]() |
050256763c |
41
.github/workflows/pypi-deploy.yml
vendored
41
.github/workflows/pypi-deploy.yml
vendored
@ -1,25 +1,26 @@
|
||||
|
||||
name: Build Python Wheels
|
||||
name: CI Build Wheel
|
||||
|
||||
on:
|
||||
push:
|
||||
#branches: [master]
|
||||
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
|
||||
|
||||
jobs:
|
||||
|
||||
build_setup:
|
||||
name: Prepare environment for wheel builds
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Prepare wheel build
|
||||
run: make -C python/ setup
|
||||
- name: Store wheel configuration files
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v4.6.0
|
||||
with:
|
||||
name: wheel-config
|
||||
path: python/
|
||||
- name: Display files
|
||||
run: ls -lR
|
||||
|
||||
build_wheels:
|
||||
name: Build binary wheels on ${{ matrix.os }}
|
||||
@ -27,8 +28,7 @@ jobs:
|
||||
needs: [build_setup]
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-20.04, windows-2019]
|
||||
arch: [auto32, auto64, aarch64]
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -36,31 +36,29 @@ jobs:
|
||||
- name: Install cibuildwheel
|
||||
run: python -m pip install cibuildwheel==2.1.2
|
||||
- name: Get wheel configuration files
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v4.1.7
|
||||
with:
|
||||
name: wheel-config
|
||||
path: python/
|
||||
- name: Build wheels
|
||||
run: python -m cibuildwheel --output-dir wheelhouse
|
||||
working-directory: python/
|
||||
# env:
|
||||
# CIBW_BUILD: cp36-* cp37-* cp38-* cp39-* cp310-*
|
||||
- name: Store binary wheels
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v4.6.0
|
||||
with:
|
||||
name: binary-wheels
|
||||
name: binary-wheels-${{matrix.os}}-${{ strategy.job-index }}
|
||||
path: python/wheelhouse/*.whl
|
||||
|
||||
build_sdist:
|
||||
name: Build source distribution
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-24.04
|
||||
needs: [build_setup]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install cython
|
||||
run: python -m pip install cython==0.29.24
|
||||
- name: Get wheel configuration files
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v4.1.7
|
||||
with:
|
||||
name: wheel-config
|
||||
path: python/
|
||||
@ -68,28 +66,33 @@ jobs:
|
||||
run: python setup.py sdist
|
||||
working-directory: python/
|
||||
- name: Store source wheels
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v4.6.0
|
||||
with:
|
||||
name: source-wheels
|
||||
path: python/dist/*.tar.gz
|
||||
- name: Display files
|
||||
run: ls -lR
|
||||
|
||||
|
||||
upload_pypi:
|
||||
name: Upload binary wheels to PyPI
|
||||
runs-on: ubuntu-20.04
|
||||
name: Upload wheels to PyPI
|
||||
runs-on: ubuntu-24.04
|
||||
needs: [build_wheels, build_sdist]
|
||||
|
||||
steps:
|
||||
- name: Get source wheels
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v4.1.7
|
||||
with:
|
||||
name: source-wheels
|
||||
path: dist/
|
||||
- name: Get binary wheels
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v4.1.7
|
||||
with:
|
||||
name: binary-wheels
|
||||
path: dist/
|
||||
pattern: binary-wheels-*
|
||||
merge-multiple: true
|
||||
- name: Display files
|
||||
run: ls -lR
|
||||
|
||||
- uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -23,3 +23,10 @@ pip/*.cpp
|
||||
pip/*.pyx
|
||||
pip/*.pxd
|
||||
pip/LICENSE
|
||||
|
||||
python/3rdparty/
|
||||
python/LICENSE
|
||||
python/README.md
|
||||
python/TDMtermite.cpp
|
||||
python/lib/
|
||||
|
||||
|
21
README.md
21
README.md
@ -1,9 +1,8 @@
|
||||
|
||||
[](https://lgtm.com/projects/g/RecordEvolution/TDMtermite/alerts/)
|
||||
[](https://lgtm.com/projects/g/RecordEvolution/TDMtermite/context:cpp)
|
||||
[](https://lgtm.com/projects/g/RecordEvolution/TDMtermite/context:python)
|
||||
[](https://img.shields.io/github/license/RecordEvolution/TDMtermite)
|
||||
[](https://img.shields.io/github/stars/RecordEvolution/TDMtermite)
|
||||

|
||||
[](https://pypi.org/project/tdmtermite/)
|
||||
|
||||
# TDMtermite
|
||||
|
||||
@ -165,10 +164,10 @@ which makes the module available for import by `import tdm_termite` .
|
||||
#### Installation with pip
|
||||
|
||||
The package is also available via the [Python Package Index](https://pypi.org) at
|
||||
[TDMtermite](https://pypi.org/project/TDMtermite/). To install the latest version simply do
|
||||
[TDMtermite](https://pypi.org/project/tdmtermite/). To install the latest version simply do
|
||||
|
||||
```Shell
|
||||
python3 -m pip install TDMtermite
|
||||
python3 -m pip install tdmtermite
|
||||
```
|
||||
|
||||
##### Unix
|
||||
@ -225,7 +224,7 @@ To be able to use the Python module _tdm_termite_, it first has to be built loca
|
||||
or installed on the system. In the Python interpreter, simply do:
|
||||
|
||||
```Python
|
||||
import TDMtermite
|
||||
import tdmtermite
|
||||
```
|
||||
|
||||
This will import the module. The TDM files are provided by creating an instance of
|
||||
@ -234,7 +233,7 @@ the _tdmtermite_ class:
|
||||
```Python
|
||||
# create 'tdmtermite' instance object
|
||||
try :
|
||||
jack = TDMtermite.tdmtermite(b'samples/SineData.tdm',b'samples/SineData.tdx')
|
||||
jack = tdmtermite.tdmtermite(b'samples/SineData.tdm',b'samples/SineData.tdx')
|
||||
except RuntimeError as e:
|
||||
print("failed to load/decode TDM files: " + str(e))
|
||||
```
|
||||
@ -255,12 +254,12 @@ As a use case, we have a look at listing the ids of all channelgroups and printi
|
||||
their data to separate files:
|
||||
|
||||
```Python
|
||||
import TDMtermite
|
||||
import tdmtermite
|
||||
import re
|
||||
|
||||
# create 'tdmtermite' instance object
|
||||
try :
|
||||
jack = TDMtermite.tdmtermite(b'samples/SineData.tdm',b'samples/SineData.tdx')
|
||||
jack = tdmtermite.tdmtermite(b'samples/SineData.tdm',b'samples/SineData.tdx')
|
||||
except RuntimeError as e :
|
||||
print("failed to load/decode TDM files: " + str(e))
|
||||
|
||||
@ -294,8 +293,8 @@ to simply extract all data of the TDM datatset and dump it to files in a given
|
||||
(existing!) directory, do
|
||||
|
||||
```Python
|
||||
import TDMtermite
|
||||
jack = TDMtermite.tdmtermite(b'samples/SineData.tdm',b'samples/SineData.tdx')
|
||||
import tdmtermite
|
||||
jack = tdmtermite.tdmtermite(b'samples/SineData.tdm',b'samples/SineData.tdx')
|
||||
jack.write_all(b"./my_tdm_data_directory/")
|
||||
```
|
||||
|
||||
|
@ -194,12 +194,31 @@ void tdm_termite::process_include(bool showlog, pugi::xml_document& xml_doc)
|
||||
|
||||
// check endianness
|
||||
std::string endianness(tdmincl.child("file").attribute("byteOrder").value());
|
||||
endianness_ = endianness.compare("littleEndian") == 0 ? true : false;
|
||||
// endianness_ = endianness.compare("littleEndian") == 0 ? true : false;
|
||||
if ( endianness.compare("littleEndian") == 0 )
|
||||
{
|
||||
endianness_ = true;
|
||||
}
|
||||
else if ( endianness.compare("bigEndian") == 0 )
|
||||
{
|
||||
endianness_ = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error(std::string("unsupported endianness: ") + endianness);
|
||||
}
|
||||
|
||||
// obtain machine's endianness
|
||||
int num = 1;
|
||||
machine_endianness_ = ( *(char*)&num == 1 );
|
||||
if ( machine_endianness_ != endianness_ ) throw std::runtime_error("endianness mismatch");
|
||||
machine_endianness_ = this->detect_endianness();
|
||||
// if ( machine_endianness_ != endianness_ )
|
||||
// {
|
||||
// std::stringstream ss;
|
||||
// ss<<"endianness mismatch: "<<"TDM = "<<(endianness_?"little":"big")
|
||||
// <<" , "
|
||||
// <<"Arch = "<<(machine_endianness_?"little":"big");
|
||||
// // std::cout<<ss.str()<<"\n";
|
||||
// // throw std::runtime_error(ss.str());
|
||||
// }
|
||||
|
||||
// list block of massdata
|
||||
for (pugi::xml_node anode: tdmincl.child("file").children())
|
||||
@ -1051,9 +1070,17 @@ void tdm_termite::convert_data_to_type(std::vector<unsigned char> &buffer,
|
||||
uint8_t* dfcast = reinterpret_cast<uint8_t*>(&df);
|
||||
|
||||
for ( unsigned long int j = 0; j < sizeof(datatype); j++ )
|
||||
{
|
||||
// matching byte order between TDM/TDX and machine's architecture ?
|
||||
if ( machine_endianness_ == endianness_ )
|
||||
{
|
||||
dfcast[j] = (int)buffer[i*sizeof(datatype)+j];
|
||||
}
|
||||
else
|
||||
{
|
||||
dfcast[j] = (int)buffer[(i+1)*sizeof(datatype)-(j+1)];
|
||||
}
|
||||
}
|
||||
|
||||
// save number in channel
|
||||
channel[i] = df;
|
||||
|
@ -64,6 +64,29 @@ class tdm_termite
|
||||
std::vector<unsigned char> tdxbuffer_;
|
||||
std::ifstream *tdx_ifstream_;
|
||||
|
||||
// find machine's endianness at runtime
|
||||
// detect machine endianness (C++20 !!)
|
||||
// if ( std::endian::native == std::endian::little )
|
||||
// {
|
||||
// machine_endianness_ = true;
|
||||
// }
|
||||
// else if ( std::endian::native == std::endian::big )
|
||||
// {
|
||||
// machine_endianness_ = false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// throw std::runtime_error("mixed endianness architecture is not supported");
|
||||
// }
|
||||
bool detect_endianness()
|
||||
{
|
||||
// int num = 1;
|
||||
// machine_endianness_ = ( *(char*)&num == 1 );
|
||||
std::uint32_t num = 0x11223344;
|
||||
uint8_t* dfc = reinterpret_cast<uint8_t*>(&num);
|
||||
return ( dfc[0] == 0x44 );
|
||||
}
|
||||
|
||||
// extract list of identifiers from e.g. "#xpointer(id("usi12") id("usi13"))"
|
||||
std::vector<std::string> extract_ids(std::string idstring)
|
||||
{
|
||||
|
@ -1 +1 @@
|
||||
2.0.0
|
||||
2.1.3
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
import TDMtermite
|
||||
import tdmtermite
|
||||
import json
|
||||
import re
|
||||
|
||||
# create 'tdm_termite' instance object
|
||||
try :
|
||||
jack = TDMtermite.tdmtermite(b'samples/SineData.tdm',b'samples/SineData.tdx')
|
||||
jack = tdmtermite.tdmtermite(b'samples/SineData.tdm',b'samples/SineData.tdx')
|
||||
except RuntimeError as e :
|
||||
print("failed to load/decode TDM files: " + str(e))
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
import TDMtermite
|
||||
import tdmtermite
|
||||
|
||||
# create 'tdm_termite' instance object
|
||||
try :
|
||||
jack = TDMtermite.tdmtermite(b'samples/SineData.tdm',b'samples/SineData.tdx')
|
||||
jack = tdmtermite.tdmtermite(b'samples/SineData.tdm',b'samples/SineData.tdx')
|
||||
# list ids of channelgroups
|
||||
grpids = jack.get_channelgroup_ids()
|
||||
# iterate through groups
|
||||
|
@ -1,12 +1,12 @@
|
||||
|
||||
import TDMtermite
|
||||
import tdmtermite
|
||||
# import numpy as np
|
||||
import json
|
||||
import re
|
||||
|
||||
# create 'tdm_termite' instance object
|
||||
try :
|
||||
jack = TDMtermite.tdmtermite(b'samples/SineData.tdm',b'samples/SineData.tdx')
|
||||
jack = tdmtermite.tdmtermite(b'samples/SineData.tdm',b'samples/SineData.tdx')
|
||||
except RuntimeError as e :
|
||||
print("failed to load/decode TDM files: " + str(e))
|
||||
|
||||
|
@ -30,8 +30,8 @@ build-bdist: setup
|
||||
|
||||
build-clean:
|
||||
python setup.py clean --all
|
||||
rm -vf TDMtermite*.so TDMtermite*.cpp
|
||||
rm -rvf dist/ IMCtermite.egg-info/
|
||||
rm -vf tdmtermite*.so tdmtermite*.cpp
|
||||
rm -rvf dist/ tdmtermite.egg-info/
|
||||
|
||||
cibuildwheel-build: setup
|
||||
cibuildwheel --platform linux
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
[metadata]
|
||||
name = TDMtermite
|
||||
name = tdmtermite
|
||||
description = Extract and read data from National Instruments LabVIEW tdx/tdm files and export them as csv files
|
||||
long_description = file: README.md
|
||||
# long_description_content_type = text/x-rst
|
||||
|
@ -11,9 +11,9 @@ cmpArgs = {
|
||||
}
|
||||
|
||||
extension = Extension(
|
||||
"TDMtermite",
|
||||
"tdmtermite",
|
||||
language='c++',
|
||||
sources=["TDMtermite.pyx"],
|
||||
sources=["tdmtermite.pyx"],
|
||||
include_dirs=["lib","3rdparty/pugixml"],
|
||||
extra_compile_args=cmpArgs[sys.platform]
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# distutils: language = c++
|
||||
# cython: language_level = 3
|
||||
|
||||
from TDMtermite cimport cpptdmtermite
|
||||
from tdmtermite cimport cpptdmtermite
|
||||
|
||||
import json as jn
|
||||
|
369
samples/SineData-be.tdm
Executable file
369
samples/SineData-be.tdm
Executable file
@ -0,0 +1,369 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<usi:tdm xmlns:usi="http://www.ni.com/Schemas/USI/1_0" version="1.0">
|
||||
|
||||
<usi:documentation>
|
||||
<usi:exporter>National Instruments USI</usi:exporter>
|
||||
<usi:exporterVersion>1.5</usi:exporterVersion>
|
||||
</usi:documentation>
|
||||
|
||||
<usi:model modelName="National Instruments USI generated meta file" modelVersion="1.0">
|
||||
<usi:include nsUri="http://www.ni.com/DataModels/USI/TDM/1_0"/>
|
||||
</usi:model>
|
||||
|
||||
<usi:include>
|
||||
<file byteOrder="bigEndian" url="SineData-be.tdx">
|
||||
<block byteOffset="0" id="inc0" length="1000" valueType="eFloat64Usi"/>
|
||||
<block byteOffset="8000" id="inc1" length="1000" valueType="eFloat64Usi"/>
|
||||
<block byteOffset="16000" id="inc2" length="1000" valueType="eFloat64Usi"/>
|
||||
<block byteOffset="24000" id="inc3" length="1000" valueType="eFloat64Usi"/>
|
||||
<block byteOffset="32000" id="inc4" length="1000" valueType="eFloat64Usi"/>
|
||||
<block byteOffset="40000" id="inc5" length="1000" valueType="eFloat64Usi"/>
|
||||
<block byteOffset="48000" id="inc6" length="1000" valueType="eFloat64Usi"/>
|
||||
<block byteOffset="56000" id="inc7" length="1000" valueType="eFloat64Usi"/>
|
||||
<block byteOffset="64000" id="inc8" length="1000" valueType="eFloat64Usi"/>
|
||||
<block byteOffset="72000" id="inc9" length="1000" valueType="eFloat64Usi"/>
|
||||
</file>
|
||||
</usi:include>
|
||||
|
||||
<usi:data>
|
||||
<double_sequence id="usi1">
|
||||
<values external="inc0"/>
|
||||
</double_sequence>
|
||||
<double_sequence id="usi2">
|
||||
<values external="inc1"/>
|
||||
</double_sequence>
|
||||
<double_sequence id="usi3">
|
||||
<values external="inc2"/>
|
||||
</double_sequence>
|
||||
<double_sequence id="usi4">
|
||||
<values external="inc3"/>
|
||||
</double_sequence>
|
||||
<double_sequence id="usi5">
|
||||
<values external="inc4"/>
|
||||
</double_sequence>
|
||||
<double_sequence id="usi6">
|
||||
<values external="inc5"/>
|
||||
</double_sequence>
|
||||
<double_sequence id="usi7">
|
||||
<values external="inc6"/>
|
||||
</double_sequence>
|
||||
<double_sequence id="usi8">
|
||||
<values external="inc7"/>
|
||||
</double_sequence>
|
||||
<double_sequence id="usi9">
|
||||
<values external="inc8"/>
|
||||
</double_sequence>
|
||||
<double_sequence id="usi10">
|
||||
<values external="inc9"/>
|
||||
</double_sequence>
|
||||
<tdm_root id="usi11">
|
||||
<name>SineData.TDM</name>
|
||||
<description>Sine signals of various amplitudes and frequencies.</description>
|
||||
<title>SineData</title>
|
||||
<author>National Instruments</author>
|
||||
<datetime>2008-05-06T17:20:12.65074539184570313</datetime>
|
||||
<channelgroups>#xpointer(id("usi12") id("usi13"))</channelgroups>
|
||||
</tdm_root>
|
||||
<tdm_channelgroup id="usi12">
|
||||
<name>Amplitudes</name>
|
||||
<description>Sine Signals of various amplitudes.</description>
|
||||
<root>#xpointer(id("usi11"))</root>
|
||||
<instance_attributes>
|
||||
<double_attribute name="Frequency">1</double_attribute>
|
||||
</instance_attributes>
|
||||
<channels>#xpointer(id("usi14") id("usi15") id("usi16") id("usi17") id("usi18"))</channels>
|
||||
<submatrices>#xpointer(id("usi24") id("usi25") id("usi26") id("usi27") id("usi28"))</submatrices>
|
||||
</tdm_channelgroup>
|
||||
<tdm_channelgroup id="usi13">
|
||||
<name>Frequencies</name>
|
||||
<description>Sine signals of various frequencies.</description>
|
||||
<root>#xpointer(id("usi11"))</root>
|
||||
<instance_attributes>
|
||||
<double_attribute name="Amplitude">1</double_attribute>
|
||||
</instance_attributes>
|
||||
<channels>#xpointer(id("usi19") id("usi20") id("usi21") id("usi22") id("usi23"))</channels>
|
||||
<submatrices>#xpointer(id("usi29") id("usi30") id("usi31") id("usi32") id("usi33"))</submatrices>
|
||||
</tdm_channelgroup>
|
||||
<tdm_channel id="usi14">
|
||||
<name>A = 1</name>
|
||||
<group>#xpointer(id("usi12"))</group>
|
||||
<datatype>DT_DOUBLE</datatype>
|
||||
<minimum>-0.999997146387718</minimum>
|
||||
<maximum>0.999999682931835</maximum>
|
||||
<instance_attributes>
|
||||
<long_attribute name="NI_ArrayColumn">0</long_attribute>
|
||||
<long_attribute name="NI_ChannelLength">1000</long_attribute>
|
||||
<long_attribute name="NI_DataType">10</long_attribute>
|
||||
</instance_attributes>
|
||||
<local_columns>#xpointer(id("usi34"))</local_columns>
|
||||
</tdm_channel>
|
||||
<tdm_channel id="usi15">
|
||||
<name>A = 2</name>
|
||||
<group>#xpointer(id("usi12"))</group>
|
||||
<datatype>DT_DOUBLE</datatype>
|
||||
<minimum>-1.99999429277544</minimum>
|
||||
<maximum>1.99999936586367</maximum>
|
||||
<instance_attributes>
|
||||
<long_attribute name="NI_ArrayColumn">1</long_attribute>
|
||||
<long_attribute name="NI_ChannelLength">1000</long_attribute>
|
||||
<long_attribute name="NI_DataType">10</long_attribute>
|
||||
</instance_attributes>
|
||||
<local_columns>#xpointer(id("usi35"))</local_columns>
|
||||
</tdm_channel>
|
||||
<tdm_channel id="usi16">
|
||||
<name>A = 4</name>
|
||||
<group>#xpointer(id("usi12"))</group>
|
||||
<datatype>DT_DOUBLE</datatype>
|
||||
<minimum>-3.99998858555087</minimum>
|
||||
<maximum>3.99999873172734</maximum>
|
||||
<instance_attributes>
|
||||
<long_attribute name="NI_ArrayColumn">2</long_attribute>
|
||||
<long_attribute name="NI_ChannelLength">1000</long_attribute>
|
||||
<long_attribute name="NI_DataType">10</long_attribute>
|
||||
</instance_attributes>
|
||||
<local_columns>#xpointer(id("usi36"))</local_columns>
|
||||
</tdm_channel>
|
||||
<tdm_channel id="usi17">
|
||||
<name>A = 8</name>
|
||||
<group>#xpointer(id("usi12"))</group>
|
||||
<datatype>DT_DOUBLE</datatype>
|
||||
<minimum>-7.99997717110174</minimum>
|
||||
<maximum>7.99999746345468</maximum>
|
||||
<instance_attributes>
|
||||
<long_attribute name="NI_ArrayColumn">3</long_attribute>
|
||||
<long_attribute name="NI_ChannelLength">1000</long_attribute>
|
||||
<long_attribute name="NI_DataType">10</long_attribute>
|
||||
</instance_attributes>
|
||||
<local_columns>#xpointer(id("usi37"))</local_columns>
|
||||
</tdm_channel>
|
||||
<tdm_channel id="usi18">
|
||||
<name>A = 16</name>
|
||||
<group>#xpointer(id("usi12"))</group>
|
||||
<datatype>DT_DOUBLE</datatype>
|
||||
<minimum>-15.9999543422035</minimum>
|
||||
<maximum>15.9999949269094</maximum>
|
||||
<instance_attributes>
|
||||
<long_attribute name="NI_ArrayColumn">4</long_attribute>
|
||||
<long_attribute name="NI_ChannelLength">1000</long_attribute>
|
||||
<long_attribute name="NI_DataType">10</long_attribute>
|
||||
</instance_attributes>
|
||||
<local_columns>#xpointer(id("usi38"))</local_columns>
|
||||
</tdm_channel>
|
||||
<tdm_channel id="usi19">
|
||||
<name>F = 1</name>
|
||||
<group>#xpointer(id("usi13"))</group>
|
||||
<datatype>DT_DOUBLE</datatype>
|
||||
<minimum>-0.999997146387718</minimum>
|
||||
<maximum>0.999999682931835</maximum>
|
||||
<instance_attributes>
|
||||
<long_attribute name="NI_ArrayColumn">0</long_attribute>
|
||||
<long_attribute name="NI_ChannelLength">1000</long_attribute>
|
||||
<long_attribute name="NI_DataType">10</long_attribute>
|
||||
</instance_attributes>
|
||||
<local_columns>#xpointer(id("usi39"))</local_columns>
|
||||
</tdm_channel>
|
||||
<tdm_channel id="usi20">
|
||||
<name>F = 2</name>
|
||||
<group>#xpointer(id("usi13"))</group>
|
||||
<datatype>DT_DOUBLE</datatype>
|
||||
<minimum>-0.999999230697499</minimum>
|
||||
<maximum>0.999995986891472</maximum>
|
||||
<instance_attributes>
|
||||
<long_attribute name="NI_ArrayColumn">1</long_attribute>
|
||||
<long_attribute name="NI_ChannelLength">1000</long_attribute>
|
||||
<long_attribute name="NI_DataType">10</long_attribute>
|
||||
</instance_attributes>
|
||||
<local_columns>#xpointer(id("usi40"))</local_columns>
|
||||
</tdm_channel>
|
||||
<tdm_channel id="usi21">
|
||||
<name>F = 4</name>
|
||||
<group>#xpointer(id("usi13"))</group>
|
||||
<datatype>DT_DOUBLE</datatype>
|
||||
<minimum>-0.999999230697499</minimum>
|
||||
<maximum>0.99994907791452</maximum>
|
||||
<instance_attributes>
|
||||
<long_attribute name="NI_ArrayColumn">2</long_attribute>
|
||||
<long_attribute name="NI_ChannelLength">1000</long_attribute>
|
||||
<long_attribute name="NI_DataType">10</long_attribute>
|
||||
</instance_attributes>
|
||||
<local_columns>#xpointer(id("usi41"))</local_columns>
|
||||
</tdm_channel>
|
||||
<tdm_channel id="usi22">
|
||||
<name>F = 8</name>
|
||||
<group>#xpointer(id("usi13"))</group>
|
||||
<datatype>DT_DOUBLE</datatype>
|
||||
<minimum>-0.999999230697499</minimum>
|
||||
<maximum>0.999996490345607</maximum>
|
||||
<instance_attributes>
|
||||
<long_attribute name="NI_ArrayColumn">3</long_attribute>
|
||||
<long_attribute name="NI_ChannelLength">1000</long_attribute>
|
||||
<long_attribute name="NI_DataType">10</long_attribute>
|
||||
</instance_attributes>
|
||||
<local_columns>#xpointer(id("usi42"))</local_columns>
|
||||
</tdm_channel>
|
||||
<tdm_channel id="usi23">
|
||||
<name>F = 16</name>
|
||||
<group>#xpointer(id("usi13"))</group>
|
||||
<datatype>DT_DOUBLE</datatype>
|
||||
<minimum>-0.999999230697499</minimum>
|
||||
<maximum>0.999993076284592</maximum>
|
||||
<instance_attributes>
|
||||
<long_attribute name="NI_ArrayColumn">4</long_attribute>
|
||||
<long_attribute name="NI_ChannelLength">1000</long_attribute>
|
||||
<long_attribute name="NI_DataType">10</long_attribute>
|
||||
</instance_attributes>
|
||||
<local_columns>#xpointer(id("usi43"))</local_columns>
|
||||
</tdm_channel>
|
||||
<submatrix id="usi24">
|
||||
<name>Untitled</name>
|
||||
<measurement>#xpointer(id("usi12"))</measurement>
|
||||
<number_of_rows>1000</number_of_rows>
|
||||
<local_columns>#xpointer(id("usi34"))</local_columns>
|
||||
</submatrix>
|
||||
<submatrix id="usi25">
|
||||
<name>Untitled</name>
|
||||
<measurement>#xpointer(id("usi12"))</measurement>
|
||||
<number_of_rows>1000</number_of_rows>
|
||||
<local_columns>#xpointer(id("usi35"))</local_columns>
|
||||
</submatrix>
|
||||
<submatrix id="usi26">
|
||||
<name>Untitled</name>
|
||||
<measurement>#xpointer(id("usi12"))</measurement>
|
||||
<number_of_rows>1000</number_of_rows>
|
||||
<local_columns>#xpointer(id("usi36"))</local_columns>
|
||||
</submatrix>
|
||||
<submatrix id="usi27">
|
||||
<name>Untitled</name>
|
||||
<measurement>#xpointer(id("usi12"))</measurement>
|
||||
<number_of_rows>1000</number_of_rows>
|
||||
<local_columns>#xpointer(id("usi37"))</local_columns>
|
||||
</submatrix>
|
||||
<submatrix id="usi28">
|
||||
<name>Untitled</name>
|
||||
<measurement>#xpointer(id("usi12"))</measurement>
|
||||
<number_of_rows>1000</number_of_rows>
|
||||
<local_columns>#xpointer(id("usi38"))</local_columns>
|
||||
</submatrix>
|
||||
<submatrix id="usi29">
|
||||
<name>Untitled</name>
|
||||
<measurement>#xpointer(id("usi13"))</measurement>
|
||||
<number_of_rows>1000</number_of_rows>
|
||||
<local_columns>#xpointer(id("usi39"))</local_columns>
|
||||
</submatrix>
|
||||
<submatrix id="usi30">
|
||||
<name>Untitled</name>
|
||||
<measurement>#xpointer(id("usi13"))</measurement>
|
||||
<number_of_rows>1000</number_of_rows>
|
||||
<local_columns>#xpointer(id("usi40"))</local_columns>
|
||||
</submatrix>
|
||||
<submatrix id="usi31">
|
||||
<name>Untitled</name>
|
||||
<measurement>#xpointer(id("usi13"))</measurement>
|
||||
<number_of_rows>1000</number_of_rows>
|
||||
<local_columns>#xpointer(id("usi41"))</local_columns>
|
||||
</submatrix>
|
||||
<submatrix id="usi32">
|
||||
<name>Untitled</name>
|
||||
<measurement>#xpointer(id("usi13"))</measurement>
|
||||
<number_of_rows>1000</number_of_rows>
|
||||
<local_columns>#xpointer(id("usi42"))</local_columns>
|
||||
</submatrix>
|
||||
<submatrix id="usi33">
|
||||
<name>Untitled</name>
|
||||
<measurement>#xpointer(id("usi13"))</measurement>
|
||||
<number_of_rows>1000</number_of_rows>
|
||||
<local_columns>#xpointer(id("usi43"))</local_columns>
|
||||
</submatrix>
|
||||
<localcolumn id="usi34">
|
||||
<name>Untitled</name>
|
||||
<measurement_quantity>#xpointer(id("usi14"))</measurement_quantity>
|
||||
<submatrix>#xpointer(id("usi24"))</submatrix>
|
||||
<global_flag>15</global_flag>
|
||||
<independent>0</independent>
|
||||
<sequence_representation>explicit</sequence_representation>
|
||||
<values>#xpointer(id("usi1"))</values>
|
||||
</localcolumn>
|
||||
<localcolumn id="usi35">
|
||||
<name>Untitled</name>
|
||||
<measurement_quantity>#xpointer(id("usi15"))</measurement_quantity>
|
||||
<submatrix>#xpointer(id("usi25"))</submatrix>
|
||||
<global_flag>15</global_flag>
|
||||
<independent>0</independent>
|
||||
<sequence_representation>explicit</sequence_representation>
|
||||
<values>#xpointer(id("usi2"))</values>
|
||||
</localcolumn>
|
||||
<localcolumn id="usi36">
|
||||
<name>Untitled</name>
|
||||
<measurement_quantity>#xpointer(id("usi16"))</measurement_quantity>
|
||||
<submatrix>#xpointer(id("usi26"))</submatrix>
|
||||
<global_flag>15</global_flag>
|
||||
<independent>0</independent>
|
||||
<sequence_representation>explicit</sequence_representation>
|
||||
<values>#xpointer(id("usi3"))</values>
|
||||
</localcolumn>
|
||||
<localcolumn id="usi37">
|
||||
<name>Untitled</name>
|
||||
<measurement_quantity>#xpointer(id("usi17"))</measurement_quantity>
|
||||
<submatrix>#xpointer(id("usi27"))</submatrix>
|
||||
<global_flag>15</global_flag>
|
||||
<independent>0</independent>
|
||||
<sequence_representation>explicit</sequence_representation>
|
||||
<values>#xpointer(id("usi4"))</values>
|
||||
</localcolumn>
|
||||
<localcolumn id="usi38">
|
||||
<name>Untitled</name>
|
||||
<measurement_quantity>#xpointer(id("usi18"))</measurement_quantity>
|
||||
<submatrix>#xpointer(id("usi28"))</submatrix>
|
||||
<global_flag>15</global_flag>
|
||||
<independent>0</independent>
|
||||
<sequence_representation>explicit</sequence_representation>
|
||||
<values>#xpointer(id("usi5"))</values>
|
||||
</localcolumn>
|
||||
<localcolumn id="usi39">
|
||||
<name>Untitled</name>
|
||||
<measurement_quantity>#xpointer(id("usi19"))</measurement_quantity>
|
||||
<submatrix>#xpointer(id("usi29"))</submatrix>
|
||||
<global_flag>15</global_flag>
|
||||
<independent>0</independent>
|
||||
<sequence_representation>explicit</sequence_representation>
|
||||
<values>#xpointer(id("usi6"))</values>
|
||||
</localcolumn>
|
||||
<localcolumn id="usi40">
|
||||
<name>Untitled</name>
|
||||
<measurement_quantity>#xpointer(id("usi20"))</measurement_quantity>
|
||||
<submatrix>#xpointer(id("usi30"))</submatrix>
|
||||
<global_flag>15</global_flag>
|
||||
<independent>0</independent>
|
||||
<sequence_representation>explicit</sequence_representation>
|
||||
<values>#xpointer(id("usi7"))</values>
|
||||
</localcolumn>
|
||||
<localcolumn id="usi41">
|
||||
<name>Untitled</name>
|
||||
<measurement_quantity>#xpointer(id("usi21"))</measurement_quantity>
|
||||
<submatrix>#xpointer(id("usi31"))</submatrix>
|
||||
<global_flag>15</global_flag>
|
||||
<independent>0</independent>
|
||||
<sequence_representation>explicit</sequence_representation>
|
||||
<values>#xpointer(id("usi8"))</values>
|
||||
</localcolumn>
|
||||
<localcolumn id="usi42">
|
||||
<name>Untitled</name>
|
||||
<measurement_quantity>#xpointer(id("usi22"))</measurement_quantity>
|
||||
<submatrix>#xpointer(id("usi32"))</submatrix>
|
||||
<global_flag>15</global_flag>
|
||||
<independent>0</independent>
|
||||
<sequence_representation>explicit</sequence_representation>
|
||||
<values>#xpointer(id("usi9"))</values>
|
||||
</localcolumn>
|
||||
<localcolumn id="usi43">
|
||||
<name>Untitled</name>
|
||||
<measurement_quantity>#xpointer(id("usi23"))</measurement_quantity>
|
||||
<submatrix>#xpointer(id("usi33"))</submatrix>
|
||||
<global_flag>15</global_flag>
|
||||
<independent>0</independent>
|
||||
<sequence_representation>explicit</sequence_representation>
|
||||
<values>#xpointer(id("usi10"))</values>
|
||||
</localcolumn>
|
||||
</usi:data>
|
||||
|
||||
</usi:tdm>
|
BIN
samples/SineData-be.tdx
Normal file
BIN
samples/SineData-be.tdx
Normal file
Binary file not shown.
63
samples/swapbyteorder.cpp
Normal file
63
samples/swapbyteorder.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
for ( int i = 0; i < argc; i++ )
|
||||
{
|
||||
std::cout<<argv[i]<<"\n";
|
||||
}
|
||||
if ( argc < 3 )
|
||||
{
|
||||
std::cout<<"missing file argument\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::ifstream fin(argv[1],std::ifstream::binary);
|
||||
|
||||
std::vector<unsigned char> tdxbuf((std::istreambuf_iterator<char>(fin)),
|
||||
(std::istreambuf_iterator<char>()));
|
||||
|
||||
fin.close();
|
||||
|
||||
std::cout<<"length of buffer: "<<tdxbuf.size()<<"\n";
|
||||
|
||||
|
||||
unsigned long int dtsize = 8;
|
||||
|
||||
if ( tdxbuf.size()%dtsize != 0 )
|
||||
{
|
||||
std::cout<<"mismatch between datatype size and length of buffer\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
unsigned long int nums = tdxbuf.size()/dtsize;
|
||||
|
||||
std::cout<<"number of entities: "<<nums<<"\n";
|
||||
|
||||
std::vector<unsigned char> tdxbufrev(tdxbuf.size());
|
||||
|
||||
for ( unsigned long int i = 0; i < nums; i++ )
|
||||
{
|
||||
for ( unsigned long int j = 0; j < dtsize; j++ )
|
||||
{
|
||||
tdxbufrev[i*dtsize+j] = tdxbuf[(i+1)*dtsize-(j+1)];
|
||||
}
|
||||
}
|
||||
|
||||
std::ofstream fou(argv[2],std::ifstream::binary);
|
||||
|
||||
for ( unsigned char ch: tdxbufrev)
|
||||
{
|
||||
fou<<ch;
|
||||
}
|
||||
|
||||
fou.close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user