MeasurementOutcomeTable

class MeasurementOutcomeTable(fields: dict[str, MeasurementRegisterField], name: str)[source][source]

Bases: QuaFieldTable

Local-only grouping of measurement output fields.

Tracked in ParameterPool._measurement_outcome_tables, not in the runtime OPNIC registry. Field names may match runtime struct fields or creg names; resolve handles via comp.outputs.get_parameter(name) vs your input ParameterTable.

Group wired measurement fields under a unique table name.

Parameters:
  • fields – Mapping from program output key to MeasurementRegisterField.

  • name – Human-readable table name (e.g. my_circuit_output).

property parameters: Sequence[MeasurementRegisterField]

All MeasurementRegisterField handles in this table.

property state_ints: dict[str, QuaVariable[int] | QuaLiteral[int] | QuaBinaryOperation[int] | QuaArrayCell[int] | QuaArrayLength[int] | QuaLibFunctionOutput[int] | QuaFunctionOutput[int] | QuaBroadcast[int] | _QuaGlobalVarOperation[int]]

{output_key: packed_int_var} for every field.

Must be accessed inside with program():. Equivalent to {name: self.get_parameter(name).state_int for name in self.table}.

Type:

Bulk accessor

property streams: dict[str, str | ResultStreamSource]

{output_key: stream} for every field.

Must be accessed inside with program():. Equivalent to {name: self.get_parameter(name).stream for name in self.table}.

Type:

Bulk accessor

declare(pause_program=False, declare_stream=True) QuaVariable | QuaArrayVariable | Sequence[QuaVariable | QuaArrayVariable][source][source]

Return the wired measurement QUA variable(s) — nothing new is declared.

Measurement variables are compiler-owned, so this declares nothing; it exists only so a MeasurementOutcomeTable can stand in for a runtime ParameterTable. Must be called inside with program(): (it reads each field’s var). The pause_program and declare_stream arguments are accepted for signature compatibility with ParameterTable.declare() and are ignored.

rewire(qc: QuantumCircuit, compilation_result: CompilationResult, *, parent: QuaCircuitCompilation | None = None) None[source][source]

Refresh wiring from a new compilation result (same table object).

Re-binds each field’s var from compilation_result.result_program and invalidates cached state_int / stream handles when size or compilation identity changes.

Parameters:
  • qc – Source circuit whose cregs and loose clbits define output keys.

  • compilation_result – New qm-qasm result to wire from.

  • parent – If given, updates parent._fields to match this table.

classmethod from_compilation(qc: QuantumCircuit, compilation_result: CompilationResult, *, parent: QuaCircuitCompilation | None = None) MeasurementOutcomeTable[source][source]

Build a measurement output table from a compiled circuit.

Creates one MeasurementRegisterField per classical register and per loose clbit (_bit0, _bit1, …), wires each from compilation_result.result_program, and registers the table in _measurement_outcome_tables.

Parameters:
  • qc – Circuit whose measurement outcomes should be exposed.

  • compilation_result – qm-qasm result with result_program[key] entries.

  • parent – Optional QuaCircuitCompilation that owns the fields.

Returns:

A wired MeasurementOutcomeTable (not registered in the runtime OPNIC pool). Every field’s state_int is available lazily.