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)

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.1.tar.gz (5.4 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.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pydotthz-0.1.1.tar.gz
  • Upload date:
  • Size: 5.4 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.1.tar.gz
Algorithm Hash digest
SHA256 9fffecd6365adecb0ffc566b348b0f031006a72076e6f243b81c36d6298b9b74
MD5 82eff3eda4a4eb56c8fc7b81732f288e
BLAKE2b-256 39eddc0b86ab83e8cbc994ebced8b13c4dcfedc8c501029997416a0559190621

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydotthz-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c466cf2182d79437047c91b6fe13a0e049a929eb87d2bd9a53a58dc9e2631971
MD5 be18b4d4aef39538d791da48e9ad62b0
BLAKE2b-256 2b4131c1b5ff4361652981298aae31f62b21ad63ceaadd109c89df6a1de55c59

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