cpetrich / zs2decode Goto Github PK
View Code? Open in Web Editor NEWzs2decode decodes Zwick zs2 files
License: MIT License
zs2decode decodes Zwick zs2 files
License: MIT License
Hello,
So far very happy with this library for extracting data from zs2 files exported from Zwick MFI tester.
Thank you for the hard work.
I am able to retrieve the data for position and temperature as function of time with the provided scripts in the example folder (after some tuning).
However I am not seeing some of the other (meta)data like the measured MVR, MFI, density, etc. which is actually the data I would like to export.
I tried going through the XML file and the HEX dump of the zs2 file.
I am having a hard time navigating through these huge files.
Do you know where the desired data is located and how I could extract them?
If you don't have time or don't feel like answering just delete this issue, but I'm trying to write a C# version of a zs2 decoder and I cant figure out these QS_ chunks.
I decoded one of my files with your tool, and I noticed that the QS_VarPar chunks are almost always EE11-BdSH9B
, in my case about 2700 times, but 7 times it's EE11-9BS38B
. I don't see any indicators for when I should expect the first vs the second format. How did you solve this problem? The only way I can think of is just trying each format until I get one that matches the length specified in the chunk.
Some chunk type names contain characters that are illegal in XML element names, resulting in illegal XML, e.g., chunk type names starting with nt&)m_
.
@NKlinke pointed out that xml generated with util.chunks_to_xml()
has encoding issues:
D:\temp\zs2_decode>python35 zs2_to_xml.py
D:\temp\zs2_decode>python35 raw_data_dump_from_xml.py
Reading XML
Parsing XML
Traceback (most recent call last):
File "raw_data_dump_from_xml.py", line 13, in <module>
root = ET.fromstring(data)
File "D:\TRB_CAE\Python\Anaconda3\lib\xml\etree\ElementTree.py", line 1333, in
XML
parser.feed(text)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 240740,
column 13
line 240740
<nt&)m_Type type='11' value='0' />
Correcting this manually leads to another conversion issue:
D:\temp\zs2_decode>python35 raw_data_dump_from_xml.py
Reading XML
Parsing XML
Traceback (most recent call last):
File "raw_data_dump_from_xml.py", line 13, in <module>
root = ET.fromstring(data)
File "D:\TRB_CAE\Python\Anaconda3\lib\xml\etree\ElementTree.py", line 1333, in
XML
parser.feed(text)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 243095,
column 12
line 243095
<VideoDirectory type='AA' value='C:\\ZWICK\\V3.2 B\\VIDEO\' />
I tried converting my .zs2 file into .xml unfortunetely I got this error in Terminal:
python zs2_to_xml.py
Traceback (most recent call last):
File "zs2_to_xml.py", line 13, in
chunks = zs2decode.parser.parse_chunks(raw_chunks)
File "/Library/Python/2.7/site-packages/zs2decode-0.2.dev0-py2.7.egg/zs2decode/parser.py", line 284, in parse_chunks
chunks = _parse_chunk_ee_subtypes(chunks, debug) # EE04, EE16, but return raw data for EE11
File "/Library/Python/2.7/site-packages/zs2decode-0.2.dev0-py2.7.egg/zs2decode/parser.py", line 336, in _parse_chunk_ee_subtypes
try: interpreted_data, type_code = _parse_data_ee_subtypes(data, debug)
File "/Library/Python/2.7/site-packages/zs2decode-0.2.dev0-py2.7.egg/zs2decode/parser.py", line 417, in _parse_data_ee_subtypes
interpreted_data=[_s2d(_unpack1('f',item)) for item in items]
File "/Library/Python/2.7/site-packages/zs2decode-0.2.dev0-py2.7.egg/zs2decode/parser.py", line 664, in _single_as_double
if _struct.pack('<f', float(value)) != start_code:
ValueError: could not convert string to float: .
Hello,
everytime I get the following error message when I´m trying to raw data dump my XML:
Reading XML
Parsing XML
Findig data
1
Traceback (most recent call last):
File "raw_data_dump_from_xml.py", line 142, in
channels.remove(data[sample_name]['time_channel_ID'])
ValueError: list.remove(x): x not in list
I´m using Python 2.7. btw great work man!
Hey. I got a bunch of testXpert III Data-files. It seems like Zwick altered something in their file format as the chucks-to-XML function quits stating 'something is wrong with the DD-segments count over the end-segments count'. I was able to alter your code to have an output of number DDs vs Ends. There are about 100 ends less than DDs.
Unfortunately I'm not that good as a programmer to understand what the issue is (beside the difference in numbers and (I assume) the resulting nesting of data that relates to some structure?).
Do you pan to update your code for zs2 files from testXpert III? Should it be working and there is something wrong with the data files? Do you have any clue where to start in my situation?
Best
Hi cpetrich,
I'm not abled to convert a .zs2 into a .xml with your program. It's returning an error.
Traceback (most recent call last):
File "C:\Users\martin\Desktop\WinPython-32bit-3.5.3.1Qt5\notebooks\docs\convert.py", line 11, in <module>
raw_chunks = zs2decode.parser.data_stream_to_chunks(data_stream)
File "C:\Users\martin\Desktop\WinPython-32bit-3.5.3.1Qt5\python-3.5.3\lib\site-packages\zs2decode\parser.py", line 82, in data_stream_to_chunks
next_start = _skip_past_data_aa(data_stream, cont)
File "C:\Users\martin\Desktop\WinPython-32bit-3.5.3.1Qt5\python-3.5.3\lib\site-packages\zs2decode\parser.py", line 180, in _skip_past_data_aa
raise TypeError('Unexpected block format for 0xAA (0x%x) with marger 0x%x at 0x%x.' % (_ord(data_stream[start]),start))
TypeError: not enough arguments for format string
Hi @cpetrich
I would be grateful if you could help me with my problem. I have a file (themis2.zse probably an old version textXpert file) from the Zwick machine which I can't open with textXpert. I try to open it with your script but I was unable to retrieve the measurements it contains. I am completely inexperienced with programming but I appreciate any help.
Thank you in advance for your time.
Themis
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.