Parameters

Station parameter aliases, virtual gates, and parameters that drive several instrument channels together. Importing qanary also enables arithmetic between QCoDeS Parameter objects; the derived parameter reads its operands lazily.

class qanary.parameters.ParameterMixin(param, name=None, label=None, param_type='gate')[source]

Bases: object

Alias an existing QCoDeS parameter for station metadata.

The returned object keeps the original parameter class and state while optionally replacing its short name and label.

Parameters:
  • param (Parameter) – Existing QCoDeS parameter.

  • name (str) – Optional short name override.

  • label (str) – Optional display-label override.

  • param_type (str) – Category stored in the parameter snapshot. Defaults to "gate".

class qanary.parameters.VirtualGate(gates, factors=None, offsets=None, rot_angle_deg=None, points=None, name=None, label=None, param_type='virtual_gate_linear', **kwargs)[source]

Bases: Parameter

Linear virtual coordinate composed from parameters on one instrument.

Create a virtual gate from coefficients, a rotation, or two points.

Setting virtual value v writes factor * v + offset to each underlying gate. Reading returns a tuple containing every physical gate value.

Parameters:
  • gates (list[Parameter]) – Underlying gate parameters. They must share one root instrument.

  • factors (list[float]) – Scale factor for each gate.

  • offsets (list[float]) – Offset for each gate.

  • rot_angle_deg (float | None) – For exactly two gates, replace factors with the unit vector at this counter-clockwise angle and set both offsets to zero.

  • points (list[tuple[float, float]]) – For exactly two gates, use the first point as the offset and the normalized direction to the second point as the factors. This takes precedence when supplied together with a rotation.

  • name (str | None) – QCoDeS parameter name. Generated from gate names when omitted.

  • label (str | None) – Display label. Generated from gate names when omitted.

  • param_type (str) – Snapshot category. Defaults to "virtual_gate_linear".

  • **kwargs – Additional keyword arguments passed to QCoDeS Parameter.

Raises:

ValueError – If coefficient lengths differ from the gate count, a two-dimensional definition does not receive exactly two gates, the two points coincide, or gates have different roots.

set_raw(value)[source]

Apply the configured linear transformation to every gate.

Parameters:

value (float)

get_raw()[source]

Return the current values of all underlying gates as a tuple.

Return type:

float

snapshot_base(update=False, params_to_skip_update=None)[source]

Extend the QCoDeS snapshot with the virtual-gate transformation.

class qanary.parameters.MultiChannelParameter(param, name=None, label=None, param_type='gates', **kwargs)[source]

Bases: Parameter

Expose several channels on one instrument as a single parameter.

Create a parameter that writes the same value to every channel.

Parameters:
  • param (Sequence[Parameter]) – One or more channels sharing a root instrument.

  • name (str) – Optional parameter name generated from channel names when omitted.

  • label (str) – Optional label generated from channel labels when omitted.

  • param_type (str) – Snapshot category. Defaults to "gates".

  • **kwargs – Additional keyword arguments passed to QCoDeS Parameter.

Raises:

ValueError – If no channels are supplied or their root instruments differ.

set_raw(value)[source]

Write value to every channel.

Parameters:

value (float)

get_raw()[source]

Return the common channel value, or None if values differ.

snapshot_base(update=False, params_to_skip_update=None)[source]

Extend the QCoDeS snapshot with channel identities and type.