Skip to main content

This Python Package allows interfacing with dotThz files.

Project description

Interface with dotThz files using Python

This crate provides an easy way to interface with dotThz files in Python.

Install it

pip install pydotthz

and then use like specified in the following example:

from pathlib import Path
import numpy as np

from dotthz import DotthzFile, DotthzMeasurement, DotthzMetaData

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

    file = DotthzFile()

    measurement = DotthzMeasurement()
    # for thzVer 1.00, we need to transpose the array!
    measurement.datasets = {"Sample": np.array([time, data]).T}

    # set meta_data
    meta_data = DotthzMetaData()
    meta_data.user = "John Doe"
    meta_data.version = "1.00"
    meta_data.instrument = "Toptica TeraFlash Pro"
    meta_data.mode = "THz-TDS/Transmission"

    measurement.meta_data = meta_data

    file.groups["Measurement"] = measurement

    # save the file
    file.save(Path("test.thz"))

    # open the file again
    path = Path("test.thz")
    file = DotthzFile.load(path)

    # read the first group (measurement)
    key = list(file.groups.keys())[0]
    print(file.groups.get(key).meta_data)
    print(file.groups.get(key).datasets)

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-0.1.2.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

pydotthz-0.1.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pydotthz-0.1.2.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for pydotthz-0.1.2.tar.gz
Algorithm Hash digest
SHA256 134728e8c749f34733535decdbaa9c553183be9f972400e3f564f45d882e8e16
MD5 b9f703b220f27274618e1dda2167f9ee
BLAKE2b-256 b54c2bfcc77ab1c1c16d99297822711103a23ad1c17b5338b3d3ba0659577f9b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydotthz-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for pydotthz-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 97b64bc9f2a83815378743a2159f79f398c70bfbb64f3ec1df2053c485559083
MD5 07f567195438ac05bfdc31792f0d77fb
BLAKE2b-256 7a3b372c19f610a2e3e33e1e78b2da75664368716d793014b4db1067299778e7

See more details on using hashes here.

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