mjolnir.measurements.measures#
This module provides classes for measuring things.
Functions
|
Classes
|
Defines a gettable during a measurement. |
|
A set of |
- class mjolnir.measurements.measures.Measure(param, delegates=<factory>, live_plot=True)[source]#
Bases:
Generic[_T]Defines a gettable during a measurement.
This class represents a parameter to measure during a measurement executed by
handler.MeasurementHandler.measure(). Additional parameters that derive from the main parameter (throughDelegateParameter) may be measured by passing them as a sequence as delegates to the constructor. delegates are always gotten after the parameter, and only their parameter’s cache is queried to avoid unnecessary instrument communication. Hence, the delegates work on the same raw data that is returned from the get call to the main parameter.This can, for example, be used for storing processed data (i.e., like a procfn) together with the raw data.
In addition to the measurement, this class implements live plotting such that, when
plot_callbackis called, a plot is updated with the latest cached value.- Parameters:
param (qcodes.parameters.parameter_base.ParameterBase) – A gettable qcodes Parameter.
delegates (collections.abc.Sequence[qcodes.parameters.delegate_parameter.DelegateParameter]) – A sequence of gettable
DelegateParameters deriving from param.live_plot (bool) – Enable live plotting during measurements using
MeasurementHandler.
- delegates: Sequence[DelegateParameter]#
- initialize_plotting(sweeps, axs, dynamic_x_axis=False)[source]#
Set up live plotting for a measurement defined by sweeps.
Does nothing if
live_plotis False.- Parameters:
sweeps (SweepList) – The
SweepListdefining the measurement sweep.axs (npt.NDArray[Axes]) – The axes to plot in.
dynamic_x_axis (bool) – Whether the x-axis is dynamically updated to the current data range or has a static range of the setpoints. This is automatically set to True if any of the sweeps’ transforms are unequal to the identity.
- Return type:
Sequence[Artist]
Notes
Todo
Handle direct product setpoints (sweep & sweep).
Could add extra x-axis
Plot 2d if requested and sweeps is at least 2d.
Could add a 1d subplot.
Would need to check if not too slow.
Plot 2d for 2d ParameterWithSetpoints?
Plot all parameters of a single axis (only the first one is currently selected).
Could add additional axis spines.
Would be in conflict with current multiple line plots for ‘small’ ParameterWithSetpoints.
- param: ParameterBase#
- property plot_callback: FunctionChain#
- reset_plotting()[source]#
Reset plotting so that calling
plot_callbackraises aRuntimeError.
- property shape_delegates: list[tuple[int, ...]]#
The shape of the result that
get_delegates()returns.
- class mjolnir.measurements.measures.MeasureSet(params=())[source]#
-
A set of
Measures.- Parameters:
params (Iterable[Measure | ParameterBase])
- add(_MeasureSet__element)[source]#
Add an element to a set.
This has no effect if the element is already present.
- property delegates: list[DelegateParameter]#
- initialize_plotting(sweeps, dynamic_x_axis=False, plot_style=None)[source]#
Initialize plotting for all member
Measures for whichlive_plotis true.
- property params: list[ParameterBase]#
All parameters of member
Measures.
- reset_plotting()[source]#
Reset plotting so that calling :prop:`plot_callback` raises a
RuntimeError.
- property shapes_delegates: list[tuple[int, ...]]#
The shapes of the result that
get_delegates()returns.