Skip to content

Add drivers for spectrometers #3

@barlowmj

Description

@barlowmj

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

  1. src/measureit/tools/util.py — Fix is_numeric_parameter() to accept Arrays validator and ParameterWithSetpoints/ArrayParameter types. Add is_array_parameter() helper.

  2. 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.

  3. tests/conftest.py — Add MockSpectrometer class using ParameterWithSetpoints (Gaussian peak + configurable noise).

  4. tests/unit/test_array_params.py — Comprehensive tests for array param support and backward compatibility.

What doesn't change

  • base_sweep.py data pathsafe_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.)

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions