https://github.com/cpetrich/zs2decode
zs2decode decodes Zwick zs2 files
https://github.com/cpetrich/zs2decode
file-conversion file-format python xml
Last synced: 3 months ago
JSON representation
zs2decode decodes Zwick zs2 files
- Host: GitHub
- URL: https://github.com/cpetrich/zs2decode
- Owner: cpetrich
- License: mit
- Created: 2015-12-07T07:37:24.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-04-02T21:32:59.000Z (about 1 year ago)
- Last Synced: 2025-12-15T13:19:46.322Z (7 months ago)
- Topics: file-conversion, file-format, python, xml
- Language: Python
- Size: 188 KB
- Stars: 13
- Watchers: 4
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
README
zs2decode
#########
zs2decode is a Python (2.7, 3.4 - current) implementation of a
decoder for Zwick ``zs2`` files.
``zs2`` files contain measurements and meta data. zs2decode is able to
parse these files. It contains support functions to output the result as
text file or XML for further processing.
The following script converts a ``zs2`` file into XML::
import zs2decode.parser
import zs2decode.util
zs2_file_name = 'my_data_file.zs2'
xml_output_file = 'my_data_file.xml'
# load and decompress file
data_stream = zs2decode.parser.load(zs2_file_name)
# separate binary data stream into chunks
raw_chunks = zs2decode.parser.data_stream_to_chunks(data_stream)
# convert binary chunk data into lists of Python objects
chunks = zs2decode.parser.parse_chunks(raw_chunks)
# output as text file
with open(xml_output_file, 'wb') as f:
f.write( zs2decode.util.chunks_to_XML(chunks) )
An example script to extract measurement time series from the XML is
provided in the ``examples`` folder.
Documentation is available at ``_
and source code at ``_.