Skip to main content

Data analysis software tools for terahertz time-domain spectroscopy (THz-TDS)

Project description

THzTools logo.

THzTools is an open-source Python package for data analysis in terahertz time-domain spectroscopy (THz-TDS). As the name suggests, THz-TDS involves measurements of terahertz-frequency electromagnetic waveforms that are acquired as a function of time, which users typically represent as a function of frequency for analysis. THzTools makes it easier for researchers to use statistically optimal methods for doing this analysis, as described in L. Mohtashemi et al., Opt. Express 29, 4912 (2021).

This is beta software that is currently under development.

Information Links
Project Project Status: Active – The project has reached a stable, usable state and is being actively developed. GitHub PyPI - Status PyPI - Version Anaconda-Server Badge PyPI - Python Version Ruff Common Changelog Contributor Covenant DOI
Build GitHub Workflow Status GitHub Workflow Status GitHub Workflow Status codecov
Documentation https://dodge-research-group.github.io/thztools/
Cite L. Mohtashemi et al., Opt. Express 29, 4912 (2021). (DOI)

The original MATLAB code is available at Zenodo.

Installation

You can install THzTools with pip:

pip install thztools

THzTools is also available through conda-forge:

conda install -c conda-forge thztools

See the Getting started tutorial for additional information.

Usage

In the conventional approach to THz-TDS analysis, one transforms the time-domain measurements into the frequency domain for further analysis. This approach has well-known problems, however, which can be resolved by using a maximum-likelihood estimation procedure in the time domain. To support this mode of analysis, the THzTools package provides functionality and documentation that are unavailable in existing THz-TDS analysis software. It provides functions to simulate THz-TDS measurements (eg, timebase and wave), apply a frequency response function to a THz-TDS waveform (apply_frf), characterize the noise of a THz-TDS system (noisefit), and fit a parameterized frequency response function to a pair of input and output waveforms (fit).

With THzTools, you can:

For example, the following code creates an ideal waveform and applies a frequency response function to it.

import numpy as np
import thztools as thz

# Set the waveform parameters
n = 256  # Number of samples
dt = 0.05  # Sampling time [ps]
a = 0.5 # Scale factor
eta = 1.0 # Delay [ps]

# Simulate the waveform
t = thz.timebase(n, dt=dt)
mu = thz.wave(n, dt=dt)

# Define a frequency response function
def frfun(omega, _a, _eta):
    return _a * np.exp(-1j * omega * _eta)

# Apply the frequency response function to the waveform
psi = thz.apply_frf(frfun, mu, dt=dt, args=(a, eta))

Related software

Below is a list of other software projects that address related tasks in THz-TDS analysis, with summaries taken from the project documentation.

Citation

If you use THzTools, please consider citing the paper and/or the software package.

Paper

@article{Mohtashemi:21,
author = {Laleh Mohtashemi and Paul Westlund and Derek G. Sahota and 
Graham B. Lea and Ian Bushfield and Payam Mousavi and J. Steven Dodge},
journal = {Opt. Express},
number = {4},
pages = {4912--4926},
publisher = {Optica Publishing Group},
title = {Maximum-likelihood parameter estimation in terahertz time-domain 
spectroscopy},
volume = {29},
month = {Feb},
year = {2021},
url = {https://opg.optica.org/oe/abstract.cfm?URI=oe-29-4-4912},
doi = {10.1364/OE.417724},
}

Software Package

@software{Posada_Loaiza_THzTools_2024,
author = {Posada Loaiza, Jonathan and Higuera-Quintero, Santiago and Noori, 
Alireza and Mohtashemi, Laleh and Hall, R. P. and Yimam, Naod Ayalew and 
Dodge, J. Steven},
license = {MIT},
month = oct,
title = {{THzTools}},
url = {https://github.com/dodge-research-group/thztools},
version = {0.5.3},
year = {2024}
}

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

thztools-0.5.5.tar.gz (39.6 kB view details)

Uploaded Source

Built Distribution

thztools-0.5.5-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file thztools-0.5.5.tar.gz.

File metadata

  • Download URL: thztools-0.5.5.tar.gz
  • Upload date:
  • Size: 39.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for thztools-0.5.5.tar.gz
Algorithm Hash digest
SHA256 666a22d2b346c32d47f9abad6a628e096791897b9b351c71444452138448bd77
MD5 b8db68967ab33661d3abe922d60513f7
BLAKE2b-256 b93b4640de90f7ade62cb5b8f659fbdc4b7741b5e17c71e25de71c738f29dd58

See more details on using hashes here.

File details

Details for the file thztools-0.5.5-py3-none-any.whl.

File metadata

  • Download URL: thztools-0.5.5-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for thztools-0.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bb3773e17ddf5425a3b8e8fb331a95f222f7f6337206dd23c10de48ee9c737ec
MD5 2a37aabbde0e60fa380e925ec9fa3ab5
BLAKE2b-256 3fb9530418e7451956089c30e1557f0007341762ceecdbf1b5e9526c89d37341

See more details on using hashes here.

Supported by

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