diff --git a/cirq-core/cirq/experiments/z_phase_calibration.py b/cirq-core/cirq/experiments/z_phase_calibration.py index d16165297b8..058afac81b5 100644 --- a/cirq-core/cirq/experiments/z_phase_calibration.py +++ b/cirq-core/cirq/experiments/z_phase_calibration.py @@ -90,9 +90,9 @@ def z_phase_calibration_workflow( ) if options is None: - options = xeb_fitting.XEBPhasedFSimCharacterizationOptions(characterize_chi=False, characterize_gamma=False, characterize_zeta=False).with_defaults_from_gate( - two_qubit_gate - ) + options = xeb_fitting.XEBPhasedFSimCharacterizationOptions( + characterize_chi=False, characterize_gamma=False, characterize_zeta=False + ).with_defaults_from_gate(two_qubit_gate) p_circuits = [ xeb_fitting.parameterize_circuit(circuit, options, ops.GateFamily(two_qubit_gate)) @@ -164,9 +164,9 @@ def calibrate_z_phases( """ if options is None: - options = xeb_fitting.XEBPhasedFSimCharacterizationOptions(characterize_chi=False, characterize_gamma=False, characterize_zeta=False).with_defaults_from_gate( - two_qubit_gate - ) + options = xeb_fitting.XEBPhasedFSimCharacterizationOptions( + characterize_chi=False, characterize_gamma=False, characterize_zeta=False + ).with_defaults_from_gate(two_qubit_gate) result, _ = z_phase_calibration_workflow( sampler=sampler, @@ -187,7 +187,7 @@ def calibrate_z_phases( params['theta'] = params.get('theta', options.theta_default or 0) params['phi'] = params.get('phi', options.phi_default or 0) params['zeta'] = params.get('zeta', options.zeta_default or 0) - params['chi'] = params.get('eta', options.chi_default or 0) + params['chi'] = params.get('chi', options.chi_default or 0) params['gamma'] = params.get('gamma', options.gamma_default or 0) gates[pair] = ops.PhasedFSimGate(**params) return gates diff --git a/cirq-core/cirq/experiments/z_phase_calibration_test.py b/cirq-core/cirq/experiments/z_phase_calibration_test.py index 9458aa4dab7..581b65ee68a 100644 --- a/cirq-core/cirq/experiments/z_phase_calibration_test.py +++ b/cirq-core/cirq/experiments/z_phase_calibration_test.py @@ -17,7 +17,7 @@ import cirq -from cirq.experiments.z_phase_calibration import calibrate_z_phases +from cirq.experiments.z_phase_calibration import calibrate_z_phases, z_phase_calibration_workflow from cirq.experiments.xeb_fitting import XEBPhasedFSimCharacterizationOptions _ANGLES = ['theta', 'phi', 'chi', 'zeta', 'gamma'] @@ -137,3 +137,28 @@ def test_calibrate_z_phases_no_options(angles, error): # Either we reduced the error or the error is small enough. assert new_dist < original_dist or new_dist < 1e-6 + + +@pytest.mark.parametrize(['angles', 'error'], _create_tests(n=10, seed=32432432)) +def test_calibrate_z_phases_workflow_no_options(angles, error): + + original_gate = cirq.PhasedFSimGate(**{k: v for k, v in zip(_ANGLES, angles)}) + actual_gate = cirq.PhasedFSimGate(**{k: v + e for k, v, e in zip(_ANGLES, angles, error)}) + + sampler = _TestSimulator(original_gate, actual_gate, seed=0) + qubits = cirq.q(0, 0), cirq.q(0, 1) + result, _ = z_phase_calibration_workflow( + sampler, + qubits, + original_gate, + options=None, + n_repetitions=1, + n_combinations=1, + n_circuits=1, + cycle_depths=(1, 2), + ) + + for params in result.final_params.values(): + assert 'zeta' not in params + assert 'chi' not in params + assert 'gamma' not in params