def __init__(
        self,
        target: cirq.Gate,
        calibration_map: dict[tuple[cirq.Qid, cirq.Qid], cirq.PhasedFSimGate],
    ):
        """Create a CalibrationTransformer.

        The transformer adds 3 ZPowGates around each calibrated gate to cancel the
        effect of z-phases.

        Args:
            target: The target gate. Any gate matching this
                will be replaced based on the content of `calibration_map`.
            calibration_map:
                A map mapping qubit pairs to calibrated gates. This is the output of
                calling `calibrate_z_phases`.
        """
        self.target = target
        if isinstance(target, ops.PhasedFSimGate):
            self.target_as_fsim = target
        elif (gate := ops.PhasedFSimGate.from_matrix(protocols.unitary(target))) is not None:
            self.target_as_fsim = gate
        else:
            raise ValueError(f"{target} is not equivalent to a PhasedFSimGate")
        self.calibration_map = calibration_map
Create a CalibrationTransformer.

        The transformer adds 3 ZPowGates around each calibrated gate to cancel the
        effect of z-phases.

        Args:
            target: The target gate. Any gate matching this
                will be replaced based on the content of `calibration_map`.
            calibration_map:
                A map mapping qubit pairs to calibrated gates. This is the output of
                calling `calibrate_z_phases`.
        
cirq-core/cirq/experiments/z_phase_calibration.py