Read and extract spectra, images, and metadata from WITec Project (.wip) / Data (.wid) files
Project description
witio
Read WITec Project (.wip) and Data (.wid) files directly in Python — spectra, hyperspectral maps, images, and calibrated axes as NumPy arrays.
witio is a pure-Python port of the read/import/extract core of
wit_io (WITio), the reference MATLAB
toolbox for WITec's binary file formats. No MATLAB required, no proprietary
license — just pip install and go.
import witio
project = witio.read("sample.wip")
for entry in project.find(class_name="TDGraph"):
spectra = entry.array() # (SizeX, SizeY, SizeGraph)
raman_shift, unit = entry.x_axis("rel. 1/cm") # calibrated axis, unit == 'rel. 1/cm'
Contents
- Why this exists
- Installation
- Quick start
- Supported data
- Scope & limitations
- Validation
- Development
- License & credits
Why this exists
There was no Python package that reads WITec's native .wip/.wid binary
format directly under a permissive license:
| Package | Reads .wip/.wid directly? |
License |
|---|---|---|
| wit_io / WITio (MATLAB) | ✅ Yes (reference implementation) | MIT-0, but MATLAB-only |
| RamanSPy | ❌ Only pre-exported .mat files |
Open source |
wip_loader (photonicdata-files-wip) |
✅ Yes | ⚠️ Proprietary, non-redistributable |
| py-wdf-reader | ❌ Different format (Renishaw .wdf) |
Open source |
| witio | ✅ Yes | MIT-0 |
witio follows the WIT-tag binary format spec that wit_io documents and
reverse-engineers, reimplemented from scratch in Python — no MATLAB source was
copied. See License & credits.
Installation
pip install witio
Legacy (WITec software v0-v5) bitmap images are embedded as raw BMP files and need Pillow to decode:
pip install "witio[bitmap]"
Quick start
import witio
project = witio.read("sample.wip")
print(project) # <WitProject file='sample.wip' version=7 n_data=42>
# List everything in the file
for entry in project.data:
print(entry.id, entry.class_name, entry.caption)
# Hyperspectral / line / point Raman data
for graph in project.find(class_name="TDGraph"):
spectra = graph.array() # shape (SizeX, SizeY, SizeGraph)
raman_shift, unit = graph.x_axis("rel. 1/cm") # or "nm", "1/cm", "eV", ...
x_um, y_um = graph.position_grid("um") # physical stage coordinates
# Video / camera images
for image in project.find(class_name="TDBitmap"):
rgb = image.array() # shape (SizeX, SizeY, 3)
# Per-entry metadata
entry = project.find(class_name="TDGraph")[0]
print(entry.caption, entry.id, entry.history)
A runnable version of this lives in examples/read_example.py.
Supported data
| WITec class | Extraction | Notes |
|---|---|---|
TDGraph |
.array() → (SizeX, SizeY, SizeGraph) |
Spectra, line scans, hyperspectral area scans. Incomplete scan lines auto-masked to NaN (matches wit_io's wip_AutoNanInvalid). |
TDImage |
.array() → (SizeX, SizeY) |
|
TDBitmap |
.array() → (SizeX, SizeY, 3) RGB |
Raw RGBA (v6/v7+) or embedded BMP (legacy, needs Pillow). |
TDText |
.text() |
Best-effort RTF → plaintext (legacy TDStream layout only). |
Any TDGraph/TDImage/TDBitmap |
.x_axis(unit) / .position_grid(unit) |
Resolves linked TD*Transformation/TD*Interpretation entries by ID and converts units. |
TData (all entries) |
.id, .caption, .history, .metadata |
Spectral axis units: nm, um, 1/cm, rel. 1/cm (Raman shift), eV, meV,
rel. eV, rel. meV. Spatial units: m, mm, um, nm, A, pm.
Scope & limitations
This is a read/extract library, not a full wit_io replacement. Intentionally not ported (GUI/MATLAB-only concerns that don't matter once your data is in NumPy):
- Writing/saving
.wip/.widproject files (the low-level tag tree can round-trip for testing, but doesn't regenerate the ID/NumberOfDatabookkeeping a real project file needs). - Curve fitting, image filtering, plotting, the interactive mask editor, and
Viewertags — all GUI-only in the original toolbox. - Live instrument control (that's what WITec's own
WITecSDKis for). TDTexton WITec Suite SIX (v7): that layout was never fully reverse-engineered upstream either.- Format versions v0-v1 and v3-v4 were only partially analyzed even by wit_io itself ("file donations welcome" — same applies here).
Validation
No real .wip file was available while writing the initial port, so the test
suite validates the reader against hand-built synthetic WIT-tag binaries: a
tag-tree round-trip test, unit/transform math checked against hand
calculations, and a full synthetic project exercising Data enumeration, ID
cross-referencing, and spectral calibration end-to-end.
It has since been run against a real 679 MB WITec Suite v8 project (126 Data
entries: point spectra, line scans, several hyperspectral area scans including
one incomplete scan, and video-image bitmaps) with zero errors — spectra
reshaped correctly, incomplete-scan lines came out as NaN, bitmap frames
decoded to sane-looking RGB images, and axis/position calibration correctly
cross-referenced different TD*Interpretation entries (some in eV, some in
Raman shift) per spectrum.
If you hit a file this doesn't handle, please open an issue with as much detail as you can share (WITec software version, what part failed).
Development
git clone https://github.com/iCalculate/witio.git
cd witio
pip install -e ".[test,bitmap]"
pytest
License & credits
MIT-0 (MIT No Attribution) — see LICENSE.
witio is an independent Python reimplementation of the file-format knowledge
documented by wit_io (WITio) by
Joonas T. Holmi, also MIT-0 licensed. No MATLAB source was copied; its binary
format specification and reverse-engineered calibration formulas (spectral
grating equation, space transformations, unit conversions) were used as a
reference and are re-derived in witio/transform.py and
witio/units.py. If you use this in published research,
please cite the original wit_io paper:
J. T. Holmi, "WITio: A MATLAB data evaluation toolbox to script broader insights into big data from WITec microscopes," SoftwareX, 2022.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file witio-0.1.0.tar.gz.
File metadata
- Download URL: witio-0.1.0.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57cfef16a53965ef982451ba7843d9d26738c68d68b9eaa62049a2f0afce08cf
|
|
| MD5 |
60aaa3e90abf1e4d2bdf5434b0401ee7
|
|
| BLAKE2b-256 |
99d796bfe8f037fbd1abbf95efe4bcf25ca054e9b3b1226a5e6672b5f8570d61
|
Provenance
The following attestation bundles were made for witio-0.1.0.tar.gz:
Publisher:
publish.yml on iCalculate/witio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
witio-0.1.0.tar.gz -
Subject digest:
57cfef16a53965ef982451ba7843d9d26738c68d68b9eaa62049a2f0afce08cf - Sigstore transparency entry: 2038479510
- Sigstore integration time:
-
Permalink:
iCalculate/witio@89f5767cbe93134db15a77f8572468e5aff74314 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/iCalculate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@89f5767cbe93134db15a77f8572468e5aff74314 -
Trigger Event:
push
-
Statement type:
File details
Details for the file witio-0.1.0-py3-none-any.whl.
File metadata
- Download URL: witio-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4cc2d6a403f77e25276f1fc49bc8a909689e853cd3a7bc4bb3a7c78a2f884dd
|
|
| MD5 |
bef1fe06eadedd8faa3633c4b6a84698
|
|
| BLAKE2b-256 |
f2c92d7c836650e1a7fde69dfbe3cd260b236d8b10c74ad795263a23398dffea
|
Provenance
The following attestation bundles were made for witio-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on iCalculate/witio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
witio-0.1.0-py3-none-any.whl -
Subject digest:
d4cc2d6a403f77e25276f1fc49bc8a909689e853cd3a7bc4bb3a7c78a2f884dd - Sigstore transparency entry: 2038479626
- Sigstore integration time:
-
Permalink:
iCalculate/witio@89f5767cbe93134db15a77f8572468e5aff74314 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/iCalculate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@89f5767cbe93134db15a77f8572468e5aff74314 -
Trigger Event:
push
-
Statement type: