This is an unofficial Python library for NIRScanner Nano produced by Texas Instruments.
- 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
- 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.
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
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.
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>
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>
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>
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.
TBD
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.