MeasurementOutcomeTable¶
- class MeasurementOutcomeTable(fields: dict[str, MeasurementRegisterField], name: str)[source][source]¶
Bases:
QuaFieldTableLocal-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 viacomp.outputs.get_parameter(name)vs your inputParameterTable.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
MeasurementRegisterFieldhandles 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
MeasurementOutcomeTablecan stand in for a runtimeParameterTable. Must be called insidewith program():(it reads each field’svar). Thepause_programanddeclare_streamarguments are accepted for signature compatibility withParameterTable.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
varfromcompilation_result.result_programand invalidates cachedstate_int/streamhandles 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._fieldsto 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
MeasurementRegisterFieldper classical register and per loose clbit (_bit0,_bit1, …), wires each fromcompilation_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
QuaCircuitCompilationthat owns the fields.
- Returns:
A wired
MeasurementOutcomeTable(not registered in the runtime OPNIC pool). Every field’sstate_intis available lazily.