Skip to main content

This Python Package allows interfacing with dotThz files.

Project description

Interface with dotTHz files using Python

PEP8 PyPI PyPI - Downloads

This library provides an easy way to interface with dotTHz files in Python.

Install it

pip install pydotthz

or

pip3 install pydotthz

and then use like specified in the following example:

from pathlib import Path
import numpy as np
from pydotthz import DotthzFile, DotthzMetaData

if __name__ == "__main__":
    # Sample data
    time = np.linspace(0, 1, 100)  # your time array
    data = np.random.rand(100)  # example 3D data array

    # save the file
    path1 = Path("test1.thz")
    with DotthzFile(path1, "w") as file:
        file.create_measurement("Measurement 1")

        # create meta-data
        metadata = DotthzMetaData()
        metadata.user = "John Doe"
        metadata.version = "1.00"
        metadata.instrument = "Toptica TeraFlash Pro"
        metadata.mode = "THz-TDS/Transmission"

        metadata.add_field("thickness_mm", 0.52)

        file["Measurement 1"].set_metadata(metadata)

        # for thzVer 1.00, we need to transpose the array!
        # important: do not manipulate keys on the `dataset` field, otherwise it won't be written to the file.
        file["Measurement 1"]["Sample"] = np.array([time, data]).T

Further examples (e.g. THz image scans) can be found in the examples directory.

Requirements

Requires hdf5 to be installed.

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

pydotthz-1.1.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

pydotthz-1.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file pydotthz-1.1.0.tar.gz.

File metadata

  • Download URL: pydotthz-1.1.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pydotthz-1.1.0.tar.gz
Algorithm Hash digest
SHA256 667b4f81999204287114ca79b0ca454e44158aed5ca7f916a4a3ca03b1d2e238
MD5 ac41692f96d70bdf09512483a060d7f8
BLAKE2b-256 17ee5a4c1bc5dc887491bd6db375ec4283df81fc94ec5cf5f7b76c0a997e117e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydotthz-1.1.0.tar.gz:

Publisher: publish.yml on dotTHzTAG/pydotthz

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

File details

Details for the file pydotthz-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pydotthz-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pydotthz-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c558255ff87a8a759c495e05b8255276c64ace338d7e1820a1e20e276a27d1b
MD5 5b892e61f4b075ad0ddacfd4c1a73fc1
BLAKE2b-256 af56cba7952d9e4ababd5244fdad6064e78a2dabec71204e5f2ea48c8e1d30e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydotthz-1.1.0-py3-none-any.whl:

Publisher: publish.yml on dotTHzTAG/pydotthz

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