Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Python module for OceanOptics spectrometers - Updated for ST-VIS

License

Notifications You must be signed in to change notification settings

roboticsmick/python-seabreeze

 
 

Repository files navigation

Python module for Ocean Optics ST-VIS spectrometer for Ubuntu

Python-seabreeze is the easy way to access your Ocean Optics spectrometers from python. It wraps the SeaBreeze library provided by Ocean Optics to communicate with the spectrometer. It also provides a pyUSB based reimplementation of SeaBreeze for easy extension. This software is not associated with Ocean Optics. Use it at your own risk.

Changelog

Jetson Orin USB Stability & Python 3.8 Support

  • Safe 6-step USB device opening with explicit interface claiming/releasing
  • Skip device probing during discovery (fixes USB controller stress on Jetson Orin)
  • Automatic USB timeout increase (10 seconds, configurable for long integrations)
  • Ocean ST spectrometer stabilization delay (500ms for OBP2 parser)
  • External timeout control via _usb_device property
  • Sysfs-based device recovery for stale claims (manual, not called during normal operation)
  • Fixed "interface 0 claimed" errors on Jetson Orin with tegra-xusb controller
  • Fixed Errno 110 timeouts on long integration times
  • Fixed USB disconnects during extended use
  • Fixed device interface not being properly released on close
  • Fixed Python 3.8 compatibility issues (type annotations)
  • Changed ST integration_time_base from 10 to 1
  • Removed device classes (HR6, FX)
  • Updated all type annotations for Python 3.8 compatibility

Tested on:

  • Jetson Orin with tegra-xusb USB controller
  • Ocean ST spectrometer
  • Python 3.8+

Files Updated (15 total):

  • Core: pyseabreeze/api.py, pyseabreeze/transport.py, pyseabreeze/devices.py
  • Type annotations: backends.py, types.py, spectrometers.py, pyseabreeze/config.py, pyseabreeze/types.py
  • Features: pyseabreeze/features/spectrometer.py, introspection.py, nonlinearity.py, straylightcoefficients.py, temperature.py
  • Minor: pyseabreeze/__init__.py, cseabreeze/__init__.py

Install

# via pypi
pip install seabreeze
seabreeze_os_setup

Using the backend pyseabreeze in Windows

The backend pyseabreeze requires the libraries pyusb and libusb

# via pypi
pip install seabreeze[pyseabreeze]  # this ensures installation of pyusb

Usage

The following example shows how simple it is to acquire a spectrum with python-seabreeze through the model independent Spectrometer class. For a more detailed description read the documentation:

>>> from seabreeze.spectrometers import Spectrometer
>>> spec = Spectrometer.from_first_available()
>>> spec.integration_time_micros(20000)
>>> spec.wavelengths()
array([  340.32581   ,   340.70321186,   341.08058305, ...,  1024.84940994,
        1025.1300678 ,  1025.4106617 ])
>>> spec.intensities()
array([  1.58187931e+01,   2.66704852e+04,   6.80208103e+02, ...,
         6.53090172e+02,   6.35011552e+02,   6.71168793e+02])

To use the pyseabreeze backend (requires pyusb) simply run this before importing seabreeze.spectrometers.

>>> import seabreeze
>>> seabreeze.use('pyseabreeze')
>>> import seabreeze.spectrometers as sb

License

Files in this repository are released under the MIT license.

About

Python module for OceanOptics spectrometers - Updated for ST-VIS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C++ 57.6%
  • Python 19.9%
  • Cython 12.4%
  • C 10.1%