Skip to content

Latest commit

 

History

History
76 lines (66 loc) · 2.25 KB

README.md

File metadata and controls

76 lines (66 loc) · 2.25 KB

NIRScanner-Python

This is an unofficial Python library for NIRScanner Nano produced by Texas Instruments.

Prerequisite

  • Operating System
    • Only tested on Linux (Ubuntu & Noobs for Pi)
  • Dependencies
    • Python 2.7 or Python 3.5 above
    • Development packages for libudev, libusb. Debian/Ubuntu systems can run:
      sudo apt-get install libudev-dev libusb-1.0-0-dev python-dev python3-dev

Implemented features

  • Config the scanning pattern.
  • Perform a scan.
  • Get scanning result.
  • Set hibernation mode.
  • Keep the lamp on / off.

If you need / implemented a new feature, you may send me an email / pull request.

Quick Start

Compile

Already compiled for Debian/Ubuntu systems.

$ cd NIRScanner-Python

For compiling Python 2 library:

NIRScanner-Python$ ./src/scripts/compile_py2.sh

For compiling Python 3 library:

NIRScanner-Python$ ./src/scripts/compile_py3.sh

Deploy

You need _NIRScanner.so and NIRS.py to be in your project path, where _NIRScanner.so is the compiled Python libray, and NIRS.py is the Python Class wrapper.

Python 2

Use _NIRScanner.so.2

NIRScanner-Python$ cp ./lib/_NIRScanner.so.2 <your-project-path>/_NIRScanner.so
NIRScanner-Python$ cp ./lib/NIRS.py <your-project-path>

Python 3

Use _NIRScanner.so.3

NIRScanner-Python$ cp ./lib/_NIRScanner.so.3 <your-project-path>/_NIRScanner.so
NIRScanner-Python$ cp ./lib/NIRS.py <your-project-path>

Raspberry Pi with Python 2

Use _NIRScanner.so.2.pi

NIRScanner-Python$ cp ./lib/_NIRScanner.so.2.pi <your-project-path>/_NIRScanner.so
NIRScanner-Python$ cp ./lib/NIRS.py <your-project-path>

Run

You need root (sudo) permission. Otherwise you may need a workaround such as in [1].

from NIRS import NIRS
nirs = NIRS()
results = nirs.scan()

That's it.

For more features / examples please refer to test.ipynb (jupyter notebook, don't forget sudo) and NIRS.py.

[1] https://stackoverflow.com/questions/3738173/why-does-pyusb-libusb-require-root-sudo-permissions-on-linux

FAQ

TBD

License

This repository uses source codes from DLP NIRscan Nano GUI and DLP Spectrum Library, I didn't find any lisence within those repositories, please email me if there is.