QMInstructionProperties

class QMInstructionProperties(duration=None, error=None, qua_pulse_macro=None, quam_macro=None, fidelity_dict=None, *args, **kwargs)[source][source]

Bases: InstructionProperties

Qiskit instruction properties enriched with a QUA pulse macro.

qua_pulse_macro accepts two forms:

  • A QuamMacro instance – a structured QuAM component whose attributes (duration, fidelity, pulse, …) are declared following the QuAM documentation. When this form is used, duration and error are automatically inferred from the macro’s attributes unless explicitly provided.

  • A plain callable – a bare QUA macro function with no QuAM attributes. In this case duration and error must be supplied explicitly if they are needed.

The two forms are transparently unified through the qua_pulse_macro and quam_macro properties.

Two-qubit QuAM macros often store fidelity as a mapping of benchmark names rather than a single float. That mapping is exposed as fidelity_dict and is not converted into a scalar error (the Rust InstructionProperties base still only stores duration and error). properties is a display mapping used by qiskit.transpiler.Target.__str__() on Qiskit versions that print extra properties; each fidelity_dict entry is unrolled as its own extra-property key.

Create a new QMInstructionProperties.

Parameters:
  • duration – Gate duration in seconds. Inferred from qua_pulse_macro when a QuamMacro is provided and this is left as None.

  • error – Gate error rate. Inferred as 1 - fidelity from a QuamMacro when fidelity is a scalar and this is left as None. Mapping fidelities do not set error.

  • qua_pulse_macro – Either a QuamMacro (structured QuAM component with declarative attributes) or a plain callable (bare QUA macro function).

  • quam_macro – Explicit QuamMacro input. When both quam_macro and qua_pulse_macro are supplied, quam_macro takes priority and qua_pulse_macro is ignored.

  • fidelity_dict – Explicit multi-benchmark fidelity map. Used only when there is no macro, or the macro’s fidelity is not a mapping. A mapping on the live macro always wins.

property qua_pulse_macro: Callable | None

The QUA macro as a callable.

If the underlying object is a QuamMacro, its .apply method is returned so that callers always receive a uniform callable interface. For a plain callable, it is returned as-is.

property quam_macro: QuamMacro | None

The underlying QuamMacro, or None.

Returns the original QuamMacro instance when one was provided, giving access to its full attribute set (duration, fidelity, pulse, etc.). Returns None when the macro was supplied as a plain callable.

property fidelity_dict: dict | None

Benchmark-name mapping from the live macro, or an explicit constructor value.

Returns None when neither a mapping fidelity on the macro nor an explicit fidelity_dict was provided. An empty mapping (typical of an uncalibrated two-qubit gate) is returned as {}.

property properties: dict | None

Display mapping for qiskit.transpiler.Target.__str__().

Includes a compact quam_macro / qua_pulse_macro string, then each non-empty fidelity_dict entry as its own key (so print(target) lists benchmarks such as rb and xeb rather than a nested dict). Returns None when there is nothing to print, so the Target omits the extra-properties block.