How can I install the TMSi Python Interface for SAGA?

TMSi's Python Interface can be downloaded for free and can be installed easily.

The TMSi Python Interface is a library for Python written by TMSi to interface the 
SAGA and APEX Device Driver to Python. It is possible to acquire data, change 
device configurations and write and read .Poly5 or .XDF files via Python, as well as 
writing to an LSL stream outlet (for SAGA only).

The Interface can be downloaded on our TMSi's Python Interface Gitlab page.

What are the installation requirements?

Before installing the interface, make sure the following requirements are met:

  • A computer with Windows 10, 64bit.
  • SAGA Device Driver 2.0.0.
  • Python version 3.9 or higher
    Python for Windows: https://www.python.org/downloads/release/python-3912/
    Other Python versions have not been tested with the latest release.

How do I install the Python Interface?

Before using the library, copy the folder (including TMSiSDK and examples, etc) to the working directory and start by having a look at the example code provided in the ‘examples_SAGA’ or 'examples_APEX' folder.

The installers can be used to install additional Python libraries using virtual environments. In order to run this script, you need to ensure that Python is available on the system’s path, which can be confirmed during Python installation or manually via Windows’ Environment Variables. To use the installers simply double click on the installer corresponding to your Python version. A window will open showing feedback regarding the installation process. Wait for the installation to finish completely and press any key to exit. The installation process can take a couple of minutes.

NOTE When the Spyder IDE is used, please use v5.2.2 (as the virtual environment uses the accompanying libraries). Alternatively, you could upgrade the spyder-kernels library to the version mentioned by Spyder.

When the Spyder IDE is used, it’s needed to change the Python interpreter to the virtual environment’s Python installation. The custom environment can be configured in Preferences →  Python interpreter. The specific file to select can be found in the following path: .../tmsi_python_interface/.venv/Scripts/python.exe

A final step in using Spyder is to configure the IPython Graphics Backed to ‘inline’. This can be configured from Spyder’s menu bar as follows: ‘Tools → Preferences → IPython Console → Graphics → Graphics backend → Inline’. Plots can be made interactive again, for instance for analysis purposes, using the ipython library that comes with Spyder. This can be done using the two lines of code below:

ipython = get_ipython()

ipython.magic("matplotlib qt") 

Do you have further questions on this topic?

Contact ✉️ support@tmsi.com, 📞+31 (0)541 539 013 or 📄 request support.