MeasurementRegisterField

class MeasurementRegisterField(name: str, length: int, *, parent: Any | None = None)[source][source]

Bases: object

One classical register (or loose bit) wired from a qm-qasm compilation result.

Measurement fields live in a separate namespace from runtime Parameter objects registered in ParameterPool. The same string name (e.g. matching a creg and an input struct field) may refer to both a runtime knob and a measurement output; they are distinct Python objects with distinct QUA variables.

Create a measurement field handle before wiring from a compilation result.

Mirrors the Parameter shape convention: a multi-/single-bit classical register is an array (length = register width), while a loose clbit is a scalar (length == 0).

Parameters:
  • name – Output key in result_program (creg name, _bitN, or other compiler output key).

  • length – Number of elements — 0 for a scalar output (loose clbit), otherwise the classical register width. Drives is_array.

  • parent – Optional owning QuaCircuitCompilation (stored as weakref).

property is_measurement_output: bool

True — sentinel used to reject attachment to runtime ParameterTables.

property is_declared: bool

Whether _wire_from_result() has bound a compiler-owned QUA variable.

property is_array: bool

True if this field holds a QUA array (length > 0), False for a scalar.

Same convention as is_array; part of the shared TableFieldProtocol.

property length: int

0 for a scalar output (loose clbit), otherwise the classical register width.

Type:

Number of elements, Parameter convention

property var

Compiler-owned QUA bool scalar or array for this measurement output.

Must be accessed inside with program():. Use get_parameter() for the Python handle.

property state_int: QuaVariable[int] | QuaLiteral[int] | QuaBinaryOperation[int] | QuaArrayCell[int] | QuaArrayLength[int] | QuaLibFunctionOutput[int] | QuaFunctionOutput[int] | QuaBroadcast[int] | _QuaGlobalVarOperation[int]

Lazy-packed int QUA variable (LSB = bit index 0).

Must be accessed inside with program():. Declared (and cached) on first access; nothing is materialized unless you read it. Prefer bulk access via state_ints when wiring multiple registers.

property stream

Output stream for save(..., stream) / stream_processing() on the host.

Declared lazily on first access inside with program():.