ENLIGHTEN
Cross-platform desktop GUI for Wasatch Photonics spectrometers
Loading...
Searching...
No Matches
EnlightenPlugin.EnlightenPluginConfiguration Class Reference

This class specifies the configuration of an entire EnlightenPlugin. More...

Public Member Functions

 __init__ (self, name, fields=None, has_other_graph=False, x_axis_label=None, y_axis_label=None, is_blocking=True, block_enlighten=False, auto_enable=None, streaming=True, process_requests=True, lock_enable=False, series_names=None, multi_devices=False, graph_type="line")
 

Public Attributes

 auto_enable = auto_enable
 
 block_enlighten = block_enlighten
 
 fields = fields
 
 graph_type = graph_type
 
 has_other_graph = has_other_graph
 
 is_blocking = is_blocking
 
 lock_enable = lock_enable
 
 multi_devices = multi_devices
 
 name = name
 
 process_requests = process_requests
 
 series_names = series_names
 
 streaming = streaming
 
 x_axis_label = x_axis_label
 
 y_axis_label = y_axis_label
 

Detailed Description

This class specifies the configuration of an entire EnlightenPlugin.


Graph Output

A plug-in can return series to be graphed in ENLIGHTEN. There are three options:

  1. The series can be ADDED to the "main graph" (default)
  2. A SECOND graph can be added to contain the plug-in output (has_other_graph=True)
  3. The plugin can REPLACE the existing "processed" series in the original ProcessedReading via overrides (requires block_enlighten=True)

All the graph series from your plugin should be either "line" (default) or "xy", configured via "graph_type". Processing for both graph types is the same; it only changes whether datapoints are displayed via markers or line segments.

In both graph types, you can supply multiple data series to be graphed. In the EnlightenPluginConfiguration object, you should declare the name of each series in the series_names array. When processing EnlightenPluginResponses, only series declared in series_names will be displayed.

Graph data is returned from the plugin to ENLIGHTEN via the Response's 'series' dictionary. Each series to be updated should have a dict key matching the series name, pointing to either:

  • a one-dimensional array of y-values, or
  • a dict with 'y' and optional 'x' arrays

That is, these are equivalent:

response = EnlightenPluginResponse(request, series = { 'Foo': y_values })
response = EnlightenPluginResponse(request, series = { 'Foo': { 'y': y_values }})

If no 'x' element is provided, a default will be inferred using the following rules:

  • IF an x_axis_label is defined, AND the series length matches the request's processed spectrum length, THEN case-insensitive regular expressions are used to check for the following key terms and units:
    • r"wavelength|nm": use current spectrometer's wavelength axis
    • r"wavenumber|cm|shift": use current spectrometer's wavenumber axis
    • r"pixel|px": use current spectrometer's pixel axis
  • if NO x_axis_label is defined AND the length of returned data matches the length of the request spectrum, it is assumed returned data should be graphed against the same x_axis as the "live" ENLIGHTEN data, and will use whatever x-axis the user has currently selected in ENLIGHTEN.
  • otherwise the x-axis will default to integral datapoints (0, 1, 2...). Note that this will not "look good" on the ENLIGHTEN "main graph" unless the user has set the x-axis to "pixel".

Examples: BlockNullOdd, MakeOddNegative, PeakFinding, SegmentSpectrum, SimpleScaling, SineAndScale, StripChart


Streaming

By default, all plug-ins support "streaming" spectra, where they receive and process each new measurement read from the spectrometer.

However, some plug-ins may not be designed or intended for that data rate and prefer to be individually triggered by the "Process" button or other events.

Examples: Demo.SaveAsAngstrom

Other plugins may not be designed to process spectra at all. In that case, set process_requests to false.

Examples: Network.WISP

See also
EnlightenPluginField

Constructor & Destructor Documentation

◆ __init__()

EnlightenPlugin.EnlightenPluginConfiguration.__init__ ( self,
name,
fields = None,
has_other_graph = False,
x_axis_label = None,
y_axis_label = None,
is_blocking = True,
block_enlighten = False,
auto_enable = None,
streaming = True,
process_requests = True,
lock_enable = False,
series_names = None,
multi_devices = False,
graph_type = "line" )
Parameters
namea string for labeling and debugging
fieldsordered list of EnlightenPluginField to display on the GUI
has_other_graphwhether ENLIGHTEN should display a second graph solely to contain the processed results of the plug-in
x_axis_labelgraph axis label (ignored unless has_other_graph).
y_axis_labelgraph axis label (ignored unless has_other_graph)
series_namesordered list of legend labels for graph series (must match series names in EnlightenPluginReponse.data)
graph_type"line" or "xy" (scatter)
auto_enableautomatically check Enabled (DEPRECATED – see streaming)
streamingwhether plugin should automatically process every new spectrum
process_requestswhether plugin is designed to process spectra (if false, process_requests will not be called and "Process" button won't be added)
lock_enableprevent disabling the plugin (provides "kiosk mode")
is_blockingENLIGHTEN should not send any further requests to the plug-in until the Response to the previous Request is received
block_enlightenthis is much more severe than is_blocking (which merely blocks THE PLUGIN until a request is processed); if true, this will let the plugin BLOCK ENLIGHTEN until a request is done. ENLIGHTEN currently enforces a hard 1sec timeout on blocking plugins.
multi_devicesTrue if the plug-in is designed to handle spectra from multiple spectrometers (tracks requests by serial_number etc)

Member Data Documentation

◆ auto_enable

EnlightenPlugin.EnlightenPluginConfiguration.auto_enable = auto_enable

◆ block_enlighten

EnlightenPlugin.EnlightenPluginConfiguration.block_enlighten = block_enlighten

◆ fields

EnlightenPlugin.EnlightenPluginConfiguration.fields = fields

◆ graph_type

EnlightenPlugin.EnlightenPluginConfiguration.graph_type = graph_type

◆ has_other_graph

EnlightenPlugin.EnlightenPluginConfiguration.has_other_graph = has_other_graph

◆ is_blocking

EnlightenPlugin.EnlightenPluginConfiguration.is_blocking = is_blocking

◆ lock_enable

EnlightenPlugin.EnlightenPluginConfiguration.lock_enable = lock_enable

◆ multi_devices

EnlightenPlugin.EnlightenPluginConfiguration.multi_devices = multi_devices

◆ name

EnlightenPlugin.EnlightenPluginConfiguration.name = name

◆ process_requests

EnlightenPlugin.EnlightenPluginConfiguration.process_requests = process_requests

◆ series_names

EnlightenPlugin.EnlightenPluginConfiguration.series_names = series_names

◆ streaming

EnlightenPlugin.EnlightenPluginConfiguration.streaming = streaming

◆ x_axis_label

EnlightenPlugin.EnlightenPluginConfiguration.x_axis_label = x_axis_label

◆ y_axis_label

EnlightenPlugin.EnlightenPluginConfiguration.y_axis_label = y_axis_label

The documentation for this class was generated from the following file: