FLIR Science File SDK for Python - Getting started

Updated Date
12/01/2024 07.52 PM

How can I use the FLIR Science File SDK in Python?

Science File SDK Download

You can download it at Software downloads section.

Python Version

You need to use python 3.6 or newer with this SDK. On macOS and Linux whereever you see python and pip in examples use python3 and pip3. On macOS and Linux you typically have python 2 installed as python and python 3 installed as python3. On Windows you can only have one version of python in the system path at a time, so make sure you are using python 3.

The default version of python included with macOS is 2.7, which is too old. You will need to install Python 3. To do this we reccomend installing homebrew from https://brew.sh and then installing python 3 with "brew install python3".

Example files

See the bottom of this answer page for example scripts that will help get you started.

Multiple SDKs

The FLIR Science Camera SDK is a superset of the FLIR Science File SDK. Since both SDKs include common fnv modules you can only have one of the Python extensions installed at a time. Since the Camera SDK is a superset, you don't need the File SDK if you have the Camera SDK. Before installing the SDK you need to first uninstall the old version of both the FileSDK and CameraSDK with pip.

How to use Science File SDK

Wheel files are included for multiple Python versions in the python/dist folder under the SDK installation directory. Before installing the wheel file uninstall the old version with pip using:

pip uninstall FileSDK

Then install the wheel file with pip using:

pip install /path/to/FileSDK.whl

A typical pip install command example would look like this:

pip install "C:\Program Files\FLIR Systems\sdks\file\python\dist\FileSDK-4.1.1-cp38-cp38-win_amd64.whl"

 
That would be to install the Science File SDK extension for Python version 3.8. In the same folder above are whl files for Python 3.6, 3.7 and  3.9. It depends on what version of Python you have installed.
 
If you are using a version of Python that doesn't have a pre-buit wheel file, you can install the extension by building it instead. Refer to the Building section below for more details.

 

Optional libraries
Some of the example files provided at the end of this page make use of common libraries such as matplotlib, numpy, tkinter. You may want to install these separately. 

The easiest way to redistribute the extension is to install the wheel file on the target computer. If you are using a version of Python that doesn't have a pre-built wheel file you can build a wheel file using the instructions in the Building Wheel section below.

Note: You should uninstall the extension before installing a new version.

To build the extension modules you need setuptools and Cython. To install and uninstall the extension with pip wheel is reccomended. The easiest way to get these is through pip with:

pip install setuptools cython wheel

Next you need a sane build environment compatible with python. Refer to the python documentation for how to setup a build environment. In particular you may need to install the particular version of the compiler used to compile python. Once your build evironment is sane you can build and install the extension with:

python setup.py install --shadow-dir /path/to/temp/folder/filesdk

Note: You must include the --shadow-dir option becaus the folder containing setup.py is typically not writable. Change /path/to/temp/folder to a folder on your computer that you can write to e.g. C:\temp on Windows and /tmp on Linux/macOS.

And finally you can uninstall the extension with pip using:

pip uninstall FileSDK

Note: You should uninstall the extension before installing a new version.

Just as when building you need to have setuptools, cython, and wheel instead as per the instructions above. Then to build the wheel file use the following command in the python folder.

python setup.py bdist_wheel --shadow-dir /path/to/temp/folder/filesdk

Note: You must include the --shadow-dir option becaus the folder containing setup.py is typically not writable. Change /path/to/temp/folder to a folder on your computer that you can write to e.g. C:\temp on Windows and /tmp on Linux/macOS.

This will create a wheel (whl) file in the dist directory under the shadow directory given.

Still have questions?

The FLIR Advantage