Introduction

This Python SDK provides a Python 3 interface to the scTDC library. It has been tested with Python version 3.8.10. The products supported by this SDK are delay-line detectors (DLDs), stand-alone time-digital converters (TDCs), and ReconFlexTM cameras. In the current version, ReconFlexTM camera support does not cover reading of blob data.

SDK contents

This SDK comprises

  1. the Python module scTDC contained in the file scTDC.py

  2. code examples (files example_*.py)

  3. this document

For running applications based on this SDK, you will also need files from the regular (C/C++) scTDC SDK and from your demo software folder.

Prerequisites

The scTDC.py needs additional files, not included here, to work. At the point, where your Python code does import scTDC, none of these files are checked at first, so this step should always succeed. There are two further stages where your code may run into errors due to missing files:

  • At the point where your code creates an scTDClib object, either directly or by creating a Device object. During this stage, the following libraries are required:

    • scTDC1.dll

    • pthreadVC2.dll

    These libraries require that the Microsoft Visual C++ redistributable version 2015-2022 is installed, see

    or these direct permalinks:

    If these libraries cannot be loaded, an OSError exception is thrown.

  • At the point where your code initializes the device via one of the respective functions (such as Device.initialize):

    • libraries related to the hardware interface (one of the following combinations)

      • scDeviceClass60.dll, okFrontPanel.dll (for USB TDCs)

      • scDeviceClass450.dll (for Ethernet interface)

      • scDeviceClass6010.dll, FTD3XX.dll (for ReconFlexTM cameras)

    • if you have a ReconFlexTM camera product, the library para3.dll, (sometimes it must be renamed to para30.dll)

    • the configuration file tdc_gpx3.ini

    • USB TDCs that came with a scDeviceClass60.dll require a firmware file with the *.bit file name extension.

    • cal_i.tif, cal_xyt.txt, if any of these were present in the demo software folder shipped on USB pendrive together with your product

    Missing libraries from the above list result in an error code -12 (SC_TDC_ERR_DEVCLS_LD) returned by the initialization function.

  • We recommend to place all files mentioned in this section into one folder. The Python application can then use os.chdir(...) to change the current working directory to this folder, then create the object to the interface class of your choice (Device, Camera, or others), then initialize the device. Afterwards, the working directory can be changed back to the original location.

Linux notes

If you have placed dependent libraries into a folder somewhere under your home directory, you need to point the system linker to this folder using the LD_LIBRARY_PATH variable.

For example, if you have put the libraries into /home/user/abc, you can start your python application via:

LD_LIBRARY_PATH="/home/user/abc" python3 my_application.py

Python module dependencies

The scTDC Python module makes use of the following modules.

  • numpy (tested with version 1.21.4)

The examples additionally require

  • matplotlib (tested with version 3.1.2)

These dependencies can usually be installed as follows:

python -m pip install --user numpy
python -m pip install --user matplotlib

You may have to replace python by the full path to your Python interpreter executable on Windows, or by python3 on Linux. If you are using an Anaconda Python distribution, refer to the Anaconda documentation for installation of packages, instead.