Spectrometer
Spectrometer is a device module in SweepMe!. It reads optical spectra from spectrometers and can calculate the peak wavelength, the total intensity, and the CIE 1931 color coordinates of each spectrum.
Available drivers can be found at sweep-me.net/devices. For electrical spectrum analyzers, use the Spectrum Analyzer module.
Overview
The Spectrometer module returns one spectrum per measurement point, i.e. a list of wavelengths and a list of intensities. Many fields are optional and only enabled if the selected driver supports them. Fields that a driver does not support are disabled. Further driver-specific settings appear in the Parameter box.
The module itself can subtract a reference spectrum that is taken at the start of the run, and it calculates the post-processing variables. All other options, e.g. averaging, triggering, or automatic integration time, are carried out by the driver and the instrument.
The module has two tabs: "Setup" with all fields described below and "SweepEditor" to define a list of sweep values, e.g. integration times.
Usage
- Add the Spectrometer module to your sequence (called setting in version 1.5) and select the driver of your spectrometer.
- Press "Find Ports" and select your instrument in the field "Port:".
- If the driver supports calibrations, press "Find Calibrations" and select a calibration.
- Set the integration time and the number of averages. Use a short integration time for bright light sources and a longer one for weak signals.
- Optionally, check "Initial reference spectrum:" to subtract a background spectrum that is taken before the first measurement point, e.g. with the light source switched off.
- Select the post-processing variables you need.
- Run the measurement and display the spectrum, e.g. in a Plot widget with "Wavelength" on the x-axis and "Intensity" on the y-axis.
GUI parameters
General
- Driver: The driver of the spectrometer. "Open driver" opens the code of the driver in an editor.
- Port: The instrument to use. Press "Find Ports" to let the driver search for connected instruments.
- Calibration: Calibration used by the driver, e.g. a calibration file to return calibrated spectra. Press "Find Calibrations" to list the calibrations that the driver can find. If no calibration is found, the field shows "None" and a message appears. Calibration files are searched in the folder "CalibrationFiles" of the public SweepMe! folder, see Folder system.
Sweep
- Sweep mode: The quantity that is varied, as offered by the driver. Most drivers offer "None" and "Integration time in s" (older drivers "Integration time [s]"). If the driver only offers "None", the field is disabled.
- Sweep value: The source of the sweep values, e.g. "SweepEditor" for the values of the SweepEditor tab, a variable of another module, or the sweep value of a parent module in the Sequencer. The field is disabled if the Sweep mode is "None".
Options
- Integration time in s: Exposure time per spectrum in seconds, default 0.1. It is used if the integration time is not varied with the Sweep mode.
- Filter: Optical filter to place in the beam path. The options depend on the driver. The default entry is "Not supported".
- Average: Number of spectra that are acquired and averaged per measurement point. Leave empty to disable averaging.
- Shutter: Shutter state or mode. The options depend on the driver.
Trigger
- Trigger: Trigger source and edge, e.g. "Internal", "External Rising", or "External Falling". The options depend on the driver. The default entry is "Not supported".
- Trigger delay in s: Time to wait after the trigger before the acquisition starts, default 0.0.
- Trigger timeout in s: Maximum time to wait for a trigger before the acquisition is stopped, default 0.0. Use 0 to wait indefinitely.
Automatic integration time
The spectrometer or the driver selects an integration time that keeps the signal within the saturation range.
- Integrate automatically: If checked, the integration time is adjusted at each measurement point.
- Maximum time in s: Upper limit of the automatically selected integration time, default 10.0.
- Saturation, min. in %: Lower limit of the target saturation range, default 50.0. If the peak signal is below this value, the integration time is increased.
- Saturation, max. in %: Upper limit of the target saturation range, default 85.0. If the peak signal is above this value, the integration time is reduced.
Reference spectrum
- Initial reference spectrum: If checked, the module acquires a reference spectrum once before the first measurement point and subtracts it from every measured spectrum. This option is always available and only works with a constant integration time. If "Integrate automatically:" is checked, a message appears and no reference spectrum is used. If the reference spectrum cannot be acquired, a message appears and the run continues without reference spectrum.
- Use spectrum from file: Path of a file with a reference spectrum that is subtracted from every measured spectrum. Click the folder icon to select the file. The supported file formats depend on the driver.
- Custom procedure: Runs a driver-specific reference procedure, e.g. the acquisition of a dark spectrum. The options depend on the driver.
The sections Options, Trigger, Automatic integration time, and Reference spectrum can be expanded and collapsed with their check boxes.
Parameter
Further driver-specific settings are shown in the Parameter box. The box is only visible if the driver defines such parameters. It is disabled while a measurement is running. The Parameter box is available from version 1.5.8.5.
Post processing
The three check boxes add calculated variables to the module. They are always available. The calculations use the spectrum after the subtraction of the initial reference spectrum.
- Peak wavelength (checked by default): Adds the variable "Peak wavelength", the wavelength at which the spectrum has its maximum. The unit is the unit of the wavelength. Requires that the first variable of the driver is "Wavelength".
- Total intensity (checked by default): Adds the variable "Total intensity", the intensity integrated over the wavelength. If the driver returns "Flux" instead of "Intensity", the variable is called "Total flux". Requires that the second variable of the driver is "Intensity" or "Flux".
- CIE 1931 (unchecked by default): Adds the color coordinates "CIEx" and "CIEy" according to the CIE 1931 standard. Requires that the first variable of the driver is "Wavelength" in nm. If the spectrum does not overlap with the wavelength range of the CIE 1931 color matching functions, both values are NaN.
If a requirement is not met, the variable is not added and the Debug widget shows a message.
Variables
The variables are defined by the driver. The first two variables are always the wavelength and the spectrum. Many drivers return further variables, e.g. the integration time or the temperature of the detector.
| Variable | Unit | Description |
|---|---|---|
| Wavelength | nm | Wavelengths of the spectrum (list) |
| Intensity | driver-dependent, e.g. counts/s or a.u. | Measured spectrum (list). Some drivers call it "Flux". |
| Integration time | s | Integration time of the spectrum, returned by most drivers |
| Peak wavelength | unit of the wavelength, e.g. nm | Optional, see Post processing |
| Total intensity or Total flux | a.u | Optional, see Post processing |
| CIEx, CIEy | none | Optional, see Post processing |
Applications
- Characterization of LEDs and other light sources: spectrum, peak wavelength, and color coordinates
- Emission, absorption, and fluorescence spectroscopy
- Transmission measurements of optical filters
Driver programming
This section is for developers of Spectrometer drivers. See Driver Programming for the general concept. The driver Spectrometer-Simulation_Driver in the instrument-drivers repository is a good template.
GUI parameter keys
A driver enables a field by returning its key in set_GUIparameter() or update_gui_parameters(). A list creates the options of a drop-down menu, a single value sets the default value. The values selected by the user are handed over in get_GUIparameter() or apply_gui_parameters().
| Field | Key | Typical value in the driver |
|---|---|---|
| Port: | Port |
handed over only, ports come from find_ports()
|
| Calibration: | Calibration |
list of str (optional), always enabled |
| Sweep mode: | SweepMode |
list of str, e.g. ["None", "Integration time in s"]
|
| Integration time in s: | IntegrationTime |
float, e.g. 0.1 |
| Filter: | Filter |
list of str |
| Average: | Average |
int, e.g. 1 |
| Shutter: | Shutter |
list of str |
| Trigger: | Trigger |
list of str |
| Trigger delay in s: | TriggerDelay |
float |
| Trigger timeout in s: | TriggerTimeout |
float |
| Integrate automatically: | IntegrationTimeAutomatic |
bool |
| Maximum time in s: | IntegrationTimeMax |
float |
| Saturation, min. in %: | SaturationMinimum |
float |
| Saturation, max. in %: | SaturationMaximum |
float |
| Initial reference spectrum: | ReferenceStart |
bool, always enabled, handled by the module |
| Use spectrum from file: | ReferenceFile |
str, path of the file |
| Custom procedure: | ReferenceCustom |
list of str |
| Peak wavelength | PostProcessingPeakWavelength |
bool, always enabled, handled by the module |
| Total intensity | PostProcessingTotalIntensity |
bool, always enabled, handled by the module |
| CIE 1931 | PostProcessingCIE1931 |
bool, always enabled, handled by the module |
Any other key is shown in the Parameter box. The type of the default value defines the input field: bool creates a check box, int and float a number field, str a text field, list an editable drop-down menu, and pathlib.Path a button to select a file or folder.
Variables
call()must return the wavelengths as the first value and the spectrum as the second value, followed by any further variables.- Name the first variable "Wavelength" (unit "nm" for CIE 1931) and the second variable "Intensity" or "Flux", so that the post-processing options work.
Functions
apply(): if the user selects the Sweep mode "Integration time in s", the current integration time is available asself.value.get_wavelengths(): returns the wavelengths in nm. Required for the option "CIE 1931". The older nameread_Wavelengths()is still supported.get_reference_spectrum()(optional): returns the spectrum used by "Initial reference spectrum:". If the function is not defined, the module acquires the reference spectrum itself by calling the functions of a measurement point fromconfigure()tocall()and uses the second returned value.get_calibrationfile_properties(port)(optional, older nameget_CalibrationFile_properties): returns two lists, the file extensions and the strings that the file name must contain. "Find Calibrations" then lists all matching files in the folder "CalibrationFiles" of the public SweepMe! folder.find_calibrations()(optional, older namefind_Calibrations): returns a list of calibrations, e.g. calibrations stored in the instrument. The module connects to the instrument to call this function.- The selected calibration is handed over with the key
Calibration. For calibration files, it is the path relative to the folder "CalibrationFiles".
See also
- Monochromator: wavelength selection, e.g. for spectral response measurements
- Spectrum Analyzer: spectra of electrical signals
- Camera: image acquisition