Package: seatease
SeaTeaseA software emulator for thepython-seabreeze: Python module for Ocean Optics spectrometers.The purpose of this library is to create an all-software emulator of thepython-seabreezelibrary, so that developers (like the authors) who wish create packages which utilize
seabreeze need not have a physical spectrometer on-hand to test their software.Currently only parts of theseabreeze.cseabreezebackend and parts of theseabreeze.spectrometersmodules are emulated (here asseatease.cseateaseandseatease.spectrometersrespectively), but more functionality is planned in
later versions. Additionally, the hardware emulator currently assumes only a single USB2000-like
spectrometer is connected (though this can be changed, seeseatease.cseatease.hardware).This USB2000-like device is treated like it is constantly measuring a 500nm spectral feature
with constant photon flux, so changing the integration time will change the peak's apparent
number of counts.InstallingTo install the current stable version:$pip3installseateaseBasic UseIt is highly advised that one references thepython-seabreezedocumentatation, as many of the quirks ofseateaseare intended so as to mimic the
actualpython-seabreezepackage.Also see the examples folder for slightly more details.Frontend functionalityThe main frontend functionality provided is theseatease.spectrometers.Spectrometerclass, which hosts all the main calls to the underlying (emulated) hardware device,
instances can be created three ways:# Get any spectrometerimportseatease.spectrometersassspec=s.Spectrometer.from_first_available()# Get a specific spectrometerspec=s.Spectrometer.from_serial_number("your-serial-number")# List the devices, and instantiate one of themdev_list=s.list_devices()print(dev_list)# Prints list of available devicesspec=s.Spectrometer(dev_list[0])With the spectrometer instance, the exposed methods allow retrial of emulated
hardware attributes:# Print wavelengthsprint(spec.wavelengths())# Set integration timespec.integration_time_micros(10*1000)# 10 ms# Print intensitiesprint(spec.intensities())Have fun!Backend functionalityAgain, theBackend APIfor theseabreeze.cseabreezepackage is helpful in understanding the following:SeaTeaseDeviceThe main backend functionality provided is theseatease.cseatease.SeaTeaseDeviceclass, which hosts all the main calls to the underlying (emulated) hardware device.
However, it cannot (or rather, should not when trying to faithfully emulateseabreeze)
be instantiated directly, but rather the instances are instantiated when the module is
imported, and a reference to these instances are kept in theseatease.cseatease.SeaTeaseAPIinstances. So, to actually get aSeaTeaseDeviceinstance:fromseatease.cseateaseimportSeaTeaseAPIdev_list=SeaTeaseAPI().list_devices()print(dev_list)# Prints available devicesdev=dev_list[0].fFunctionalityAll the features of the device are stored as attributes of thedev.f, for example:# Get wavelengthsdev.f.spectrometer.get_wavelengths()# Set integration timedev.f.spectrometer.set_integration_time_micros(100*1000)# 100 ms# Get intensitiesdev.f.spectrometer.get_intensities().featuresFunctionalityAlternatively, the same attributes are exposed in dictionary form indev.features# Get wavelengthsdev.features["spectrometer"][0].get_wavelengths()# Set integration timedev.features["spectrometer"][0].set_integration_time_micros(100*1000)# 100 ms# Get intensitiesdev.features["spectrometer"][0].get_intensities()DevelopmentWe are happy for any contributions from others! In particular, those with experience
using other Ocean Optics spectrometers (besides just the USB2000) withpython-seabreezewho can shed light on the expected features and functionality from those devices.
Also, just fleshing out the rest of the backend API.For development, clone this directory, setup a python
virtual environment in the main directory and install:$python3-mvenvvenv$sourcevenv/bin/activate(venv)$python3setup.pyinstallAfter making changes to the source, re-run that last line to re-install.Usingvenvin Jupyter LabIf you want to use jupyter lab to edit and test, add the venv kernel to jupyter's local
files so that you can run the .ipynb files:(venv)$pip3installipykernel(venv)$python3-mipykernelinstall--user--name=venvTo remove the kernel when you are done:(venv)$jupyterkernelspecuninstallvenvPyPICreate the source files and upload:(venv)$python3setup.pysdistbdist_wheel(venv)$python3-mtwineuploaddist/*See:herefor more details.AcknowledgementsThe authors would like to thankAndreas Poehlmannand collaborators for creating the originalpython-seabreezepackage, which this library emulates in software. His package has been indispensable to ourresearch.The authors would also like to thank Caylee Van Schenck for the excellent pun after which this
library is named.