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:
- The series can be ADDED to the "main graph" (default)
- A SECOND graph can be added to contain the plug-in output (has_other_graph=True)
- 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