Esempio n. 1
0
def test_floquet_get_calibrations_when_invalid_request_fails() -> None:

    parameters_ab = cirq_google.PhasedFSimCharacterization(
        theta=0.6, zeta=0.5, chi=0.4, gamma=0.3, phi=0.2
    )

    a, b = cirq.LineQubit.range(2)
    engine_simulator = PhasedFSimEngineSimulator.create_from_dictionary_sqrt_iswap(
        parameters={(a, b): parameters_ab}
    )

    with pytest.raises(ValueError):
        engine_simulator.get_calibrations(
            [
                FloquetPhasedFSimCalibrationRequest(
                    gate=cirq.FSimGate(np.pi / 4, 0.5),
                    pairs=((a, b),),
                    options=ALL_ANGLES_FLOQUET_PHASED_FSIM_CHARACTERIZATION,
                )
            ]
        )

    with pytest.raises(ValueError):
        engine_simulator.get_calibrations(
            [
                TestPhasedFSimCalibrationRequest(
                    gate=cirq.FSimGate(np.pi / 4, 0.5),
                    pairs=((a, b),),
                )
            ]
        )
Esempio n. 2
0
def _create_sqrt_iswap_request(
    pairs: Iterable[Tuple[cirq.Qid, cirq.Qid]],
    options: FloquetPhasedFSimCalibrationOptions = ALL_ANGLES_FLOQUET_PHASED_FSIM_CHARACTERIZATION,
) -> FloquetPhasedFSimCalibrationRequest:
    return FloquetPhasedFSimCalibrationRequest(
        gate=cirq.FSimGate(np.pi / 4, 0.0), pairs=tuple(pairs), options=options
    )