Skip to main content

Python module for interfacing with EvoCortex IRImagerDirect SDK

Project description

nqm.irimager

Code style: black Linting: Pylint Imports: isort Managed by PDM

Python module for interfacing with EvoCortex IRImagerDirect SDK.

Setup

Installing libirimager

nqm.irimager requires the EvoCortex IRImagerDirect SDK (known as libirimager). Please follow the instructions on their webpage to install the package.

You will also need to

It's possible to install a mocked version of nqm.irimager for testing by defining SKBUILD_CMAKE_DEFINE='IRImager_mock=ON' whiling building nqm.irimager.

Install nqm.irimager

This repo uses PEP621 to manage dependencies. scikit-build-core is used to compile the project as a build-system.build-backend.

We recommend using PDM for local development.

pdm install

Usage example

See documentation for the full API reference, but using this library is as easy as:

import datetime
import logging
from nqm.irimager import IRImager, Logger

logging.basicConfig()
logging.getLogger().setLevel(1) # trace
logger = Logger()
# Your XML config,
# see http://documentation.evocortex.com/libirimager2/html/Overview.html#subsec_overview_config_file
XML_CONFIG = "tests/__fixtures__/382x288@27Hz.xml"
irimager = IRImager(XML_CONFIG)
with irimager:
    print(f"Started at {datetime.datetime.now()}")
    while True: # press CTRL+C to stop this program
        try:
          array, timestamp = irimager.get_frame()
        except error:
          print(f"Stopped at {datetime.datetime.now()}")
          raise error
        frame_in_celsius = array / (10 ** irimager.get_temp_range_decimal()) - 100
        print(f"At {timestamp}: Average temperature is {frame_in_celsius.mean()}")

del logger # to stop

Development

Pre-commit checks (linting and type checks)

This project uses pre-commit to check code. You may wish to run pdm run pre-commit install to automatically run checks before you run git commit.

Additionally, you can run pdm run pre-commit run --all to check all changes.

Tests

Tests are written using pytest, and can be run with:

pdm run pytest

C++ unit tests

Some C++ tests are written using GoogleTest and gMock.

As these tests need the [Development.Embed][FindPython3] Python3 embedding artifact (which aren't available on most systems), you must opt-in to building and running these tests by using:

SKBUILD_CMAKE_DEFINE="BUILD_TESTING=ON" pdm install && pdm run pytest

If you want to use both BUILD_TESTING=ON and IRImager_mock=ON, you can do the following:

SKBUILD_CMAKE_DEFINE='BUILD_TESTING=ON;IRImager_mock=ON' pdm install && pdm run pytest

Mypy stubtest

You can use Mypy's stubtest tool to automatically check whether the types in a stub file match the implementation.

For most Python code, we put the type information directly in the implementation, so we only need this for C/C++ Python extensions, like the nqm.irimager module.

Note

The error: nqm.irimager.IRImager is inconsistent, metaclass differs errors are expected, due to the inability to stub built-in pybind11 types.

me@user:~$ MYPYPATH=src .venv/bin/stubtest nqm.irimager
error: nqm.irimager.IRImager is inconsistent, metaclass differs
Stub: in file src/nqm/irimager/__init__.pyi:11
N/A
Runtime:
<class 'pybind11_builtins.pybind11_type'>

Found 1 error (checked 1 module)

Documentation

Sphinx is used to generate documentation in the docs/ directory.

sphinx.ext.napoleon automatically parses Google-style Python docstrings.

pdm run sphinx-build -M html docs/ build/

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

nqm_irimager-1.0.0.tar.gz (67.0 kB view details)

Uploaded Source

Built Distributions

nqm_irimager-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

nqm_irimager-1.0.0-cp311-cp311-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ ARM64

nqm_irimager-1.0.0-cp310-cp310-manylinux_2_28_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

nqm_irimager-1.0.0-cp310-cp310-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ ARM64

nqm_irimager-1.0.0-cp39-cp39-manylinux_2_28_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

nqm_irimager-1.0.0-cp39-cp39-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ ARM64

nqm_irimager-1.0.0-cp38-cp38-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ ARM64

File details

Details for the file nqm_irimager-1.0.0.tar.gz.

File metadata

  • Download URL: nqm_irimager-1.0.0.tar.gz
  • Upload date:
  • Size: 67.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for nqm_irimager-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b467fa50e90844643dca9d36cbdda34ecd429cad6640ee0b1230b8ea23ff4f48
MD5 12f823d2841e69e3ebb527b055cf922d
BLAKE2b-256 f8c9b17494f37e420fda25105497c6ae0086974f899f67e4e8ec60ea61b22543

See more details on using hashes here.

File details

Details for the file nqm_irimager-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nqm_irimager-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4f581c62f4a4a009bd1fc1af31e545195c04db041120c4ccdda2785781b068e9
MD5 ba8a04fbd6e416c24674a1f77c217830
BLAKE2b-256 00419468e3de265469f7b9e2b2c1a13e62df36f9c6d08bee22f7881e8a7f1a36

See more details on using hashes here.

File details

Details for the file nqm_irimager-1.0.0-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nqm_irimager-1.0.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 fc2201341b2a02abb58eff16dc1a90fa73830de1ab5468f19f634b18053cf406
MD5 b31b21657ef3b78214da006214224f8a
BLAKE2b-256 88db8e75013afc558c0e0cdd520c64825769689d5b1454d1feff0f62de332c93

See more details on using hashes here.

File details

Details for the file nqm_irimager-1.0.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nqm_irimager-1.0.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3db86050101001f2fc04a5c6df46fe8af462f84662ebd5dbac4b389048413507
MD5 cdd1bfcb0409cabab1968c77dbabdebb
BLAKE2b-256 9f4f3db3266dccc16bb71b06c323ff92ee24448125cc14fee1ca203c989316ca

See more details on using hashes here.

File details

Details for the file nqm_irimager-1.0.0-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nqm_irimager-1.0.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 56c799d349297307286e4a8e9546ad2923d2cea27ae4ea9dced1d5f38c62d91d
MD5 130aa72c35e32da9496d38069ec224f5
BLAKE2b-256 502f6d5273e61bdb235b033ef159172f33d5a6660193a0adf3b7232f4da0b0e0

See more details on using hashes here.

File details

Details for the file nqm_irimager-1.0.0-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nqm_irimager-1.0.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 06897b9d620b17cf6fe726af43d89b536ef5eedcb3be48b360d9d361b5440af9
MD5 d74615413ddf303312c3cac11b2524af
BLAKE2b-256 b763fa3375b90ad8fbc63f12d28e96f3b954811ed96f345fcc9391a2b90094e8

See more details on using hashes here.

File details

Details for the file nqm_irimager-1.0.0-cp39-cp39-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nqm_irimager-1.0.0-cp39-cp39-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8698c3331938d064982e03372a462c052ca713c0aeb8063f675e71388cdf348c
MD5 5ea3a91011f89d8ec6b56e1f51730ac9
BLAKE2b-256 b611985d10ea73840a377c75d84ccc311ee20c8c5d4f7fe5fce9e35c779d66df

See more details on using hashes here.

File details

Details for the file nqm_irimager-1.0.0-cp38-cp38-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for nqm_irimager-1.0.0-cp38-cp38-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a5c432b1bfc7754b0780b86dad09d673373b9e2a1840c08f3991df39d96385a6
MD5 f5a6d777c0218840ef1c886e8d07e3b0
BLAKE2b-256 413a862fe287435dad42c3f0f144755b7766ae8150eaaff9e3b56ab31cbd1883

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