Skip to content

unibe-icelab/teraflash-ctrl-python

Repository files navigation

TeraFlash Pro Python Package

PEP8 PyPI PyPI - Downloads

“”

This code is developed by the University of Bern and is no official product of Toptica Photonics AG.
This Python Package allows the configuration and readout of the TeraFlash Pro THz spectrometer.
The TCP communication protocol is probably incomplete and features may be missing as it was reverse engineered using wireshark. The scanning stage is not supported but a list of other features is.

This is a simple library with no persistence settings (the configurations of the previous run will not be stored when the python session is closed). A complete GUI written in Rust is also available here.

Features:

  • Select begin time for the time window
  • Select range
  • Select average
  • Start/Stop Laser
  • Start/Stop Emitters
  • Start/Stop Acquisition
  • Set transmission
  • Set motion mode
  • Set channel
  • Get status
  • Get data (time domain and frequency domain)
  • auto pulse detection function
  • Set antenna range
  • ...

I. Installation

Download from PyPi:

pip install teraflash-ctrl

II. Taking a measurement

When connected to the device, you can turn on the laser and then the emitter. After starting the acquisition, new data should be continuously updated and the most recent dataset can be obtained using device.get_data():

from teraflash import TeraFlash

if __name__ == "__main__":
    ip = "169.254.84.101"
    with TeraFlash(ip) as device:
        print(device.get_status())
        device.set_laser(True)
        device.set_emitter(1, True)
        device.set_acq_start()
        print(device.get_data())

Always use the context manager to ensure that the connection is properly closed upon exiting!
Consult the example.py for usage.

Disclaimer: This package is provided on a best effort basis with no guarantee as to the functionality and correctness. Use at your own risk. Users are encouraged to contribute by submitting issues and/or pull requests for bug reporting or feature requests.

Copyright (c) 2026 University of Bern, Space Research & Planetary Sciences, Linus Leo Stöckli.

This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc/4.0/

About

A Python library to interface with the Toptica TeraFlash Pro THz time domain spectrometer. Use at own risk.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages