Overview
This application is a tool to acquire and analyze optical spectra using a camera looking at your spectrometer’s spectral strip. It displays a real‑time spectrum with a nanometer‑calibrated X axis, supports automatic calibration with a mercury lamp, smile correction, spectral line identification via a line database, spectrum comparison, and multiple export options.
Quick start
- In Video input, choose Device and Mode, then click Connect.
- Adjust the ROI (StartY/SizeY and StartX/EndX) so it contains only the useful spectral strip.
- (Optional) Use AUTO ROI to get an automatic suggestion for the horizontal ROI.
- With a mercury lamp: run AUTO CALIB (Hg) to calibrate wavelength.
- (Optional) Run AMP CAL (Hg) and enable Response correction to compensate the system response.
- Switch to unknown sources and use Line DB + flags to identify lines.
Video acquisition & ROI
“Video input” panel
- Device: select the camera (UVC/DirectShow compatible).
- Mode: resolution / pixel format / frame‑rate.
- Connect / Disconnect: start/stop acquisition.
- Pause: freezes the last frame and spectrum (handy for calibration and measurements).
- Driver controls…: opens camera driver property pages (if available).
ROI and sampling
- StartY and SizeY: define the vertical sensor band used to extract the strip.
- StartX and EndX: horizontally limit the analyzed spectral region.
- Flip H: horizontal flip of the spectrum (useful if the optical path mirrors the image).
Filtering & display
Filters
- Spatial averaging: smoothing along X (higher = smoother, but less fine detail).
- Rising / Falling: temporal response to increases/decreases (100 = fastest).
- Average + N: average N frames before the temporal filter.
Log scale
- Log scale: logarithmic display (visualization only; exports keep linear data).
- Factor: controls log emphasis.
Strip preview
- Preview shows the sampled strip; Enhance strip preview applies extra gain only to the preview.
Wavelength calibration (Hg)
Calibration maps sensor bins to wavelength (nm). With a mercury lamp (Hg) you can do a quick point‑based calibration or a fully automatic multi‑line calibration.
1) Point calibration: “CALIB (Hg peak)…”
- Illuminate the spectrometer with the Hg lamp and optimize exposure/ROI.
- Click CALIB (Hg peak)….
- Select one of the suggested prominent peaks.
- Enter the wavelength in nm for that peak (use known Hg lines).
- Repeat on multiple peaks to improve accuracy.
2) Automatic calibration: “AUTO CALIB (Hg)”
- With the Hg lamp on, press AUTO CALIB (Hg).
- The software detects peaks, matches them to Hg lines, and builds the nm mapping.
- If Guided calibration is enabled, you may be asked to confirm the correct candidate when ambiguous.
Guided calibration (assisted refinement)
- Off: fully automatic.
- On demand: ask only when uncertain.
- Always: confirm every selected anchor.
Spectral range (nm)
The Spectral range (nm) fields define the full calibrated X axis span (e.g. 340..1050 nm), even if the calibration source does not cover the whole instrument range (typical for Hg in the NIR).
Calibration file management
- Edit…: manually edit points (Bin ↔ Nanometers).
- Load… / Save…: load/save calibration files (Theremino‑compatible format).
- Revert: undo the last auto‑calibration and restore the previous one.
Amplitude / response calibration (Hg)
In addition to the nm axis, the application can apply a response correction to compensate the wavelength‑dependent sensitivity of the system (optics + sensor).
Workflow: “AMP CAL (Hg)” + “Response correction”
- Acquire a well‑exposed Hg spectrum (avoid saturation).
- Click AMP CAL (Hg) to estimate a relative correction curve.
- Toggle Response correction to enable/disable applying it.
Viewing and exporting the curve
- View → Show Response Curve overlays the correction curve on the plot (diagnostic).
- File → Export Response Curve… exports
nm,factorto CSV.
Smile correction
“Smile” is the curvature of spectral lines across the strip height (lines are not perfectly vertical). The software can learn a correction from the current frame and apply it during spectrum extraction.
How to use
- Use a source with sharp lines (Hg is ideal) and focus the optics.
- Menu Process → Learn Smile Correction….
- Enable Process → Smile Correction to apply it.
- Optional: enable Show Smile Preview (raw + corrected) to see a diagnostic strip (RAW on top, corrected below).
Line identification & database
To identify emission/absorption lines you can load a CSV line database and browse it in a dedicated panel, run a peak detector, and/or place manual markers.
Loading a Line DB
- File → Load Line DB… loads a spectral line CSV database.
- Typical columns include: element, spectrum/series, wavelength_nm, intensity_rel, blend group (~1 nm), comment.
- View → Line DB Viewer opens the viewer and its filters.
Line DB Viewer
- Select an Element (e.g., Hg, Ne, Ar…).
- Use Min I to filter out weak lines.
- Only instrument range limits to the instrument wavelength span (default 340..1050 nm or user‑set).
- Only current plot range limits to the currently zoomed plot region.
- Select table rows to toggle corresponding flags on the spectrum plot.
- Clear Line‑DB flags removes flags created from the database.
Peak detection
- Process → Peak Detector… finds peaks and adds “Peak” flags.
- Process → Export Peaks CSV… exports the detected peak list.
Manual flags
- Left‑click inside the plot: adds a manual flag at that wavelength.
- Shift‑click (or middle click): pins the cursor only (no flag).
Spectrum comparison (LIVE/REF/CMP)
A reference channel helps you compare spectra over time or across different conditions.
LIVE and REF
- LIVE: continuously updated spectrum.
- REF: snapshot buffer. Press →REF to copy current LIVE into REF.
CMP (compare)
- CMP: overlays LIVE vs REF and highlights their difference.
- Normalize: normalizes LIVE and REF to their own peaks before comparing (useful when brightness changes).
- Δ exaggeration: visually boosts the difference area (display only).
Synthetic reference: Blackbody
Process → Load Blackbody into REF… generates a blackbody (Planck) spectrum at a chosen temperature (Kelvin) and stores it into REF, so you can use CMP to compare LIVE against an ideal reference.
Export & saving
- File → Export Spectral Data…: export the current spectrum (all points) to CSV.
- File → Export Response Curve…: export the response correction curve (if available) to CSV.
- Process → Export Peaks CSV…: export the peak list.
- File → Save pixmap…: save the plot as an image (PNG/JPG).
- File → Load Flags… / Save Flags…: load/save flags (markers) to XML.
- Process → Clear Flags: remove all flags (shortcut Ctrl+Shift+L).
- Process → Clear Output: clear the “Process output” log panel.
Context menus & interaction
Mouse on the plot
- Mouse wheel: zoom around the pointer position.
- Double‑click: reset zoom (full range).
- Left‑click: add a manual flag.
- Shift+click (or middle click): pin cursor without a flag.
- Hover over a flag: tooltip shows nm, value, bin and type.
Context menu (right‑click)
- Add manual flag here: create a manual flag at the clicked wavelength.
- Pin cursor here (no flag): pin the cursor.
- Remove selected flag: remove the selected flag.
- Cleanup actions: Clear all flags or by type (Peak / Manual / Calib / Line‑DB).
Keyboard
- Delete/Backspace: delete the selected flag.
- Esc: clear selection.
Remote control via local socket
The application exposes a local control interface (same PC) for integration with external tools. A client can connect to a stable service name and request the LIVE spectrum or subscribe to receive continuous updates.
SpectrometerLab.SpectrumAvailable commands
- PING: checks whether the service is reachable.
- GET_LIVE_SPECTRUM: returns the LIVE spectrum (calibrated: nm + amplitude).
- SUBSCRIBE_LIVE: enable/disable periodic spectrum events.
Tips & troubleshooting
- “No peaks found”: increase exposure or reduce smoothing; tighten ROI around the bright band.
- Saturated peaks: reduce exposure/gain; clipping makes calibration/response unstable.
- Spectrum reversed: enable Flip H.
- Visible smile (arched lines in the preview): run Learn Smile Correction and enable Smile Correction.
- Consistent comparisons: use →REF to capture a reference, then CMP with Normalize if brightness changes.
- Line identification: load an appropriate Line DB and use Min I to avoid overly dense lists.