Skip to main content

Fast Rust/PyO3 parser for ZS2 files with Parquet export

Project description

zs2fast

A fast Python extension for converting Zwick ZS2 test machine files to Parquet format, written in Rust/PyO3.

Features

  • Fast gzip decompression and binary parsing of .zs2 files
  • Extracts channel time-series data with automatic unit resolution
  • Extracts evaluated parameters and test results with units
  • Converts to Parquet format using Apache Arrow
  • Built with PyO3 for seamless Python integration
  • Supports Python 3.9–3.12 on Linux, macOS, and Windows

Installation

From PyPI

pip install zs2fast

From Source

Requires Rust and Python 3.9+.

# Install maturin
pip install maturin

# Clone and build
git clone https://github.com/weltidom/zs2fast.git
cd zs2fast
maturin develop --release

Usage

import zs2fast
import polars as pl

# Convert a .zs2 file to raw long-format Parquet
# Useful for exploring binary structure and raw values
zs2fast.zs2_to_parquet("input.zs2", "output.parquet", include_u32=False)
# columns: series, subtype, index, value

# Export channel time-series with semantic names and units
zs2fast.zs2_channels_to_parquet("input.zs2", "channels.parquet")
# columns: sample_idx, channel_idx, channel_name, unit, timepoint, value, data_type
channels = pl.read_parquet("channels.parquet")
print(channels.filter(pl.col('unit').is_not_null()).head())

# Export calculated test results (Bruchbild, elongation, max force, etc.)
# Units are resolved from EinheitName → QS_ValSetting blob → UnitTables
zs2fast.zs2_evaluated_params_to_parquet("input.zs2", "evaluated_params.parquet")
# columns: sample_idx, param_id, short_name, param_name, unit, value, value_text
params = pl.read_parquet("evaluated_params.parquet")
print(params.filter(pl.col('value').is_not_null()).head())

# Extract per-sample test settings and parameters (not calculated results)
zs2fast.zs2_parameterliste_results_to_parquet("input.zs2", "sample_params.parquet")
# columns: sample_id, result_id, result_name, unit, value_text, value
sample_params = pl.read_parquet("sample_params.parquet")
print(sample_params.head())

Unit Resolution

The parser automatically resolves measurement units using a 3-tier strategy:

  1. Direct unit name (EinheitName field) — Direct unit symbol (mm, N, MPa, etc.)
  2. Unit table key (from QS_ValSetting binary blob) — References /UnitTables section (UT_Length → mm, UT_Force → N, etc.)
  3. Fallback inference — Attempts to infer units from table key name

Channels typically use tier 1–2, while evaluated parameters primarily use tiers 2–3. This ensures maximum unit coverage across different .zs2 file structures.

Development

Build

maturin build --release

Lint

cargo fmt
cargo clippy

Test

cargo test

License

See LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zs2fast-0.3.0.tar.gz (27.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

zs2fast-0.3.0-cp39-abi3-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.9+Windows x86-64

zs2fast-0.3.0-cp39-abi3-manylinux_2_34_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.34+ x86-64

zs2fast-0.3.0-cp39-abi3-macosx_11_0_arm64.whl (2.8 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file zs2fast-0.3.0.tar.gz.

File metadata

  • Download URL: zs2fast-0.3.0.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for zs2fast-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f4598a58849a7433fe8f2463b15d931f21dab5c7a1d2a75e547c8a1bbc115b5a
MD5 1652a7cc7f768f358e87854a5d687f89
BLAKE2b-256 f476ed6bef6bbf5d29a11b65c487a1be9703b269954f561a77ef2b6992b9731c

See more details on using hashes here.

Provenance

The following attestation bundles were made for zs2fast-0.3.0.tar.gz:

Publisher: publish.yml on weltidom/zs2fast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zs2fast-0.3.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: zs2fast-0.3.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for zs2fast-0.3.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 48c964b8f263c533e735bbd8c09e6a700f21927f059c64ba96cdafbf55ad4a6e
MD5 789c24b1ac2566d29af3d4f3556c3250
BLAKE2b-256 3634c98ba6134fd18dc4573523a9ec21fe8d2b997e3cceaa6a12019124e51f64

See more details on using hashes here.

Provenance

The following attestation bundles were made for zs2fast-0.3.0-cp39-abi3-win_amd64.whl:

Publisher: publish.yml on weltidom/zs2fast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zs2fast-0.3.0-cp39-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for zs2fast-0.3.0-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 21e34db16d6119c583e2bc82a09f7c18f0357a2a8389025dd8f21f361270f0e0
MD5 2c5471709e25812a4d01f75f901e84f5
BLAKE2b-256 9bc7ee915265011f43802b4500d8ee1d0e1ee4b00ea3ceab8be81eb98840c527

See more details on using hashes here.

Provenance

The following attestation bundles were made for zs2fast-0.3.0-cp39-abi3-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on weltidom/zs2fast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zs2fast-0.3.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for zs2fast-0.3.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12f43bd86ed894dfff3449bce058c53db8c5a0f8d7c48b507d9c649ed8bdd544
MD5 946648f55b2c1b8a51a700584f6535ef
BLAKE2b-256 aebf189f42e0c9b533ace6635f2596515c9dacac1421a21b333c8790bddb6e21

See more details on using hashes here.

Provenance

The following attestation bundles were made for zs2fast-0.3.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on weltidom/zs2fast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page