Spectrometer Python Application Driver (Windows, Linux, RasPi, Mac)
Python Driver and Demo ScriptsSpectrometer Python Application Driver
for Windows, Linux, RasPi, Mac, etc.
Popular Applications: All Spectrometer Systems
StellarNet also offers our new Python USB spectrometer driver and basic Application Development Kit (ADK) with each spectrometer. Our StellarNet Python Driver, stellarnet_driver, and stellarnet.hex files can be downloaded upon request once our Software License Agreement is filled out and returned (please provide details of your operating system and all requirements).
In addition, we also provide a simple data acquisition script written in python 2 & 3 (stellarnetdemo.py) that can communicate with stellarnet_driver and perform a simple operation to set device parameters and acquire spectrum. Methods and functions for driver callback are explained below.
StellarNet Python Driver Documentation
Methods and Functions for Driver Callback
Function name | How to call | Return | Description |
---|---|---|---|
print_info () | spectrometer[‘device’] .print_info () | -USB Vendor ID -USB product ID - Manufacture and model -Stored Coefficients | Provide USB device information. |
set_config ()) | spectrometer['device']. set_config (int_time=inttime, scans_to_avg=scansav g, x_smooth=smooth,x_ti ming =xtiming | Set device parameters Such as integration time, no of scans, smoothing level and digitizer rate. |
|
array_spectrum () | Stellarnet_drivers.arra y_spectrum (spectrometer, wav) | Raw Spectrum | Return spectrum for selected device and also applied calibration coefficients to spectrum |
array_get_spec( ) | Stellarnet_drivers.arra y_get_spec () | -selected spectrometer as device id -Array of wavelengths after applying coefficients. | Return the spectrometer as class object that need to get data from. -Computed wavelength for the spectrometer that has been selected. |
Example Data Acquisition Script written in Python
# import the usb driver
import stellarnet_driver as sn
# function to set device parameter and return spectrum
def getSpectrum(spectrometer, wav, inttime, scansavg, smooth):
spectrometer[‘device’].set_config(int_time=inttime, scans_to_avg=scansavg,
x_smooth=smooth, x_timing =xtiming)
spectrum = sn.array_spectrum(spectrometer, wav)
return spectrum
spectrometer, wav = sn.array_get_spec()
# Setting Device parameter
inttime = 10
scansavg = 1
smooth = 0
xtiming = 1
# Calling function to get spectrum
data=getSpectrum(spectrometer, wav, inttime, scansavg, smooth)
# printing data in terminal
print(data)
Software License Agreement (SLA)
All customizable source codes and programs require an executed Software License Agreement and proof of spectrometer purchase. Often a photo of the bottom label of your spectrometer is needed to ensure compatibility of your requested software with your hardware. A photo also provides fantastic proof of ownership. Please email your requests to Contactus@StellarNet.us and provide the required material in advance to expedite this process.
Customization & Compatibility Requests
We currently offer a variety of different “off the shelf” compilations of our stellarnet_driver.so to allow different to allow use on Windows, Linux, RasPi, Mac, and many other options. However, if your specific environment is not available then it can easily be made for you. Please fill out our SLA with your requirements and a technical sales agent will get back to you right away!
Typically recompilations or small modifications to currently available software is billed at our software engineers’ hourly rate of $250/hour with a minimum of 2 hours per project. Please don’t hesitate to contact our team of SpectraWizards for help 🙂
Other Software Options
Technical Information Request
The StellarNet Star
This holiday season, we received an incredible surprise from our StellarNet team—a star named in our honor! The star is located in the Andromeda constellation, close to the Pegasus constellation. Its coordinates, RA/DEC: 00H 49M 48.8S +41° 04' 44.2, place it near the...