Spectral Workbench Operations
A major change in Spectral Workbench 2.0 is a system called Operations (previously known as PowerTags). When you save a spectrum, you usually have to perform additional operations, sometimes setting a cross section, certainly calibrati ng, and sometimes then smoothing or otherwise manipulating the data. But for various reasons, you often want to record and even revert some of those changes. Maybe you want to do them differently, or to recalibrate.
Operations are the new way to do this. Each time you apply an Operation, the resulting dataset is saved in a Snapshot, so that a copy is archived and available in the database without having to run each calculation every time. Operations typically
feature a key:value
pair. Creating operations is easy; the Tools pane below each spectrum guides you through creating them with a simple form, and adds your Operation when you click Apply. Some Operations reference other spectra, for comparison or su
btraction. You'll be presented with a menu and search form to find the right spectrum to use.
Operations include:
calibrate
calibrate:<id>
- Copies calibration from spectrum with given
linearCalibration
linearCalibration:<b2>,<g2>
- Manually calibrated with two reference points
range
range:<min>-<max>
- Limits wavelength range to specified
smooth
smooth:<amount>
- Rolling average smoothing by given #
forked
forked:<id>
- Spectrum is a forked copy of the Spectrum with given
subtract
subtract:<id>
- Subtracts spectrum with given subtract:<id>#<snapshot_id>
crossSection
crossSection:<height>
- Sets the row of pixels, counting crossSection:0
, whereas crossSection:20
would measure the brightness of each pixel in the 21st row down from the top (since we begin counting at 0).
flip
flip
- Indicates that the spectrum image has been flipped horizontally. This can be necessary if your spectrometer webcam is installed backwards, which would place the red end of the spectrum (with higher wavelengths) to the left, instead of to the right, as is the standard in Spectral Workbench. flip
is also copied over if a spectum marked with it is used as a calibration for another spectrum, with the calibrate:<id>
Operation, below.
transform
transform:<expression>
- Filters this spectrum with a math
blend
blend:<expression>
- Filters this spectrum with a math transform:
, but in combination with data from a given second spectrum. This allows for, for example, multiplying or dividing two spectra.
Passive Operations
Some Operations don't affect the data at all; it's not clear if we're going to make these appear in the Tags listing instead. For now, these two are generated along with calibrationQuality
and provide metadata about the spectrum, but aren't used to change the data:
error
error:<amount>
- Scores a calibration 'fit' by comparison to a known reference; lower is better, zero is perfect.
calibrationQuality
calibrationQuality:<quality>
- Roughly indicates how good a calibration 'fit' is, in qualitative terms good
for <12, medium
for <16 and poor
for anything higher/worse.
else response += ", which has no snapshots -- this is not recommended.";
Contributing
The Operations framework is designed to be flexible and extensible, as we add more abilities to Spectral Workbench. Please contact the developers list with ideas and suggestions for new features and future versions, and check out Spectral Workbench on Github at https://github.com/publiclab/spectral-workbench.
Also check out our Contributing to Public Lab Software page.