Program.calibrate(instruction, previously_calibrated_instructions=None)[source]

Expand an instruction into its calibrated definition.

If a calibration definition matches the provided instruction, then the definition body is returned with appropriate substitutions made for parameters and qubit arguments. If no calibration definition matches, then the original instruction is returned. Calibrations are performed recursively, so that if a calibrated instruction produces an instruction that has a corresponding calibration, it will be expanded, and so on. If a cycle is encountered, a CalibrationError is raised.

  • instruction (AbstractInstruction) – An instruction.

  • previously_calibrated_instructions (Optional[Set[AbstractInstruction]]) – A set of instructions that are the results of calibration expansions in the direct ancestry of instruction. Used to catch cyclic calibration expansions.

Return type



A list of instructions, with the active calibrations expanded.