Goal
Add support for spectrometer-like instruments that return array-valued data (e.g., counts vs pixel/energy) to MeasureIt's sweep framework. This enables Sweep0D, Sweep1D, Sweep2D, etc. to follow ParameterWithSetpoints parameters alongside existing scalar parameters.
Background
QCoDeS already supports array-valued parameters via ParameterWithSetpoints (recommended) and ArrayParameter (legacy). The DataSaver.add_result() automatically unpacks array parameters with their setpoints. MeasureIt currently blocks these parameters because Arrays validator has is_numeric = False, and the plotter silently flattens arrays to a single element.
Implementation Plan
What changes
-
src/measureit/tools/util.py — Fix is_numeric_parameter() to accept Arrays validator and ParameterWithSetpoints/ArrayParameter types. Add is_array_parameter() helper.
-
src/measureit/_internal/plotter_thread.py — For array-valued parameters, plot np.sum(array) as the y-value (total signal intensity) with "(sum)" label. Full spectrum data is saved to the database via QCoDeS.
-
tests/conftest.py — Add MockSpectrometer class using ParameterWithSetpoints (Gaussian peak + configurable noise).
-
tests/unit/test_array_params.py — Comprehensive tests for array param support and backward compatibility.
What doesn't change
base_sweep.py data path — safe_get() → add_result() already works because QCoDeS DataSaver auto-unpacks ParameterWithSetpoints
_create_measurement() registration — QCoDeS register_parameter() auto-discovers internal setpoints via depends_on and merges with sweep setpoints
heatmap_thread.py — Receives pre-reduced scalar data from plotter, no changes needed
Future work
- Live heatmap visualization for array params in Sweep1D (x=sweep, y=pixel, color=counts)
- 3D visualization for Sweep2D with array params
- Configurable reduction function (sum, max, mean, custom)
- Real hardware spectrometer drivers (Andor, Ocean Optics, etc.)
Goal
Add support for spectrometer-like instruments that return array-valued data (e.g., counts vs pixel/energy) to MeasureIt's sweep framework. This enables
Sweep0D,Sweep1D,Sweep2D, etc. to followParameterWithSetpointsparameters alongside existing scalar parameters.Background
QCoDeS already supports array-valued parameters via
ParameterWithSetpoints(recommended) andArrayParameter(legacy). TheDataSaver.add_result()automatically unpacks array parameters with their setpoints. MeasureIt currently blocks these parameters becauseArraysvalidator hasis_numeric = False, and the plotter silently flattens arrays to a single element.Implementation Plan
What changes
src/measureit/tools/util.py— Fixis_numeric_parameter()to acceptArraysvalidator andParameterWithSetpoints/ArrayParametertypes. Addis_array_parameter()helper.src/measureit/_internal/plotter_thread.py— For array-valued parameters, plotnp.sum(array)as the y-value (total signal intensity) with "(sum)" label. Full spectrum data is saved to the database via QCoDeS.tests/conftest.py— AddMockSpectrometerclass usingParameterWithSetpoints(Gaussian peak + configurable noise).tests/unit/test_array_params.py— Comprehensive tests for array param support and backward compatibility.What doesn't change
base_sweep.pydata path —safe_get()→add_result()already works because QCoDeS DataSaver auto-unpacksParameterWithSetpoints_create_measurement()registration — QCoDeSregister_parameter()auto-discovers internal setpoints viadepends_onand merges with sweep setpointsheatmap_thread.py— Receives pre-reduced scalar data from plotter, no changes neededFuture work