An InterfaceDevice is the top-level interface to communicating with any
spectrometer supported by Wasatch.PY.
# Sub-Classes
These are the currently supported sub-classes at writing:
- WasatchDevice: all Wasatch-manufactured USB spectrometers using VID 0x24aa
and PID 0x1000 (FX2 with Hamamatsu CCD), 0x2000 (FX2 with Hamamamsu InGaAs)
or 0x4000 (ARM, typically IMX CMOS).
- FeatureInterfaceDevice (FID): a lower-level "hardware access layer"
(HAL) implementing the ENG-0001 USB protocol, used exclusively by
WasatchDevice. FID also inherits from InterfaceDevice for convenience.
Developers may choose to instantiate and communicate with FID directly,
bypassing WasatchDevice, but will miss out on some automated higher-
level functions (and sadly twisted logic) involving AutoRaman, scan
averaging, BatchCollections etc.
- BLEDevice: a Wasatch XS spectrometer communicating over Bluetooth®,
implementing the ENG-0120 Wasatch BLE GATT profile.
- AndorDevice: a Wasatch XL spectrometer using an Andor camera via Oxford
Instruments' SDK.
- IDSDevice: a prototype spectrometer using an IDS camera via their IDSPeak
SDK.
- TCPDevice: a Wasatch Ethernet-capable spectrometer implementing the
ENG-0196 WISP protocol.
- SPIDevice: a Wasatch SPI-based spectrometer implementing the ENG-0150
SPI spectrometer protocol.
- OceanDevice: an experimental wrapper to communicate with Ocean Optics
spectrometers using their SeaBreeze library.
# Request Handling
InterfaceDevices primarily communicate by receiving SpectrometerRequests
and returning SpectrometerResponses.
A SpectrometerRequest is basically a command name coupled with a few
positional or keyword arguments (in other words, a deconstructed Python
function call).
A SpectrometerResponse contains a .data object which could include a
requested spectrum or spectrometer setting, as well as a few fields
to indicate error conditions.
| wasatch.InterfaceDevice.InterfaceDevice.__init__ |
( |
| self, |
|
|
| device_id, |
|
|
| message_queue = None, |
|
|
| alert_queue = None ) |
Any class that communicates to a spectrometer should inherit this class.
It provides the common functions that avoid repeated code.
@param device_id either DeviceID or string equiv ("USB:0x24aa:0x1000:1:24")
@param message_queue if provided, used to send status back to caller
@param alert_queue if provided, used to receive hints and realtime
interrupts from caller, including cancellation of
long-running tasks like AutoRaman
@todo move scan averaging, TakeOneRequest logic upstream from
WasatchDevice, AndorDevice etc to here (simplify children of this
class while while increasing code-reuse and consistency across all
InterfaceDevice variants)
| wasatch.InterfaceDevice.InterfaceDevice.handle_cmd |
( |
| self, |
|
|
| cmd, |
|
|
| arg = None, |
|
|
| force = False ) |
handle_cmd("get_laser_temperature_deg_c")
is a shortcut to
handle_request(SpectrometerRequest("get_laser_temperature_deg_c"))
handle_cmd("select_adc", 1)
is a shortcut to
handle_request(SpectrometerRequest("select_adc", args=[1]))
handle_cmd("take_one_request", None, force=True)
is a shortcut to
handle_request(SpectrometerRequest("select_adc", args=[None]))