![]() |
Extracts a minimal set of characterization requests necessary to characterize given circuit.
cirq_google.calibration.prepare_characterization_for_moments(
circuit: cirq.Circuit,
options: PhasedFSimCalibrationOptions[RequestT],
*,
gates_translator: Callable[[cirq.Gate], Optional[PhaseCalibratedFSimGate]] = cirq_google.calibration.try_convert_syc_or_sqrt_iswap_to_fsim
,
merge_subsets: bool = True,
initial: Optional[Sequence[RequestT]] = None,
permit_mixed_moments: bool = False
) -> Tuple[CircuitWithCalibration, List[RequestT]]
This prepare method works on moments of the circuit and assumes that all the two-qubit gates to calibrate are not mixed with other gates in a moment. The method groups together moments of similar structure to minimize the number of characterizations requested.
The circuit can only be composed of single qubit operations, wait operations, measurement operations and operations supported by gates_translator.
See also prepare_characterization_for_circuits_moments that operates on a list of circuits.
Args | |
---|---|
circuit
|
Circuit to characterize. |
options
|
Options that are applied to each characterized gate within a moment. |
gates_translator
|
Function that translates a gate to a supported FSimGate which will undergo characterization. Defaults to sqrt_iswap_gates_translator. |
merge_subsets
|
If True then this method tries to merge moments into the other moments
listed previously if they can be characterized together (they have no conflicting
operations). Otherwise, only moments of exactly the same structure are characterized
together.
|
initial
|
The characterization requests obtained by a previous scan of another circuit; i.e., the requests field of the return value of prepare_characterization_for_moments invoked on another circuit. This might be used to find a minimal set of moments to characterize across many circuits. |
permit_mixed_moments
|
Whether to allow a mix of two-qubit gates with other irrelevant single-qubit gates. |
Returns | |
---|---|
circuit_with_calibration
|
The circuit and its mapping from moments to indices into the list of calibration requests (the second returned value). |
calibrations
|
A list of calibration requests for each characterized moment. |
Raises | |
---|---|
IncompatibleMomentError when circuit contains a moment with operations other than the operations matched by gates_translator, or it mixes a single qubit and two qubit gates. |