Skip to content

Commit cf27bb9

Browse files
relax the bounds in curve fitting and change the way we exclude gates in strict gatesets
1 parent f0ebcd2 commit cf27bb9

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

cirq-core/cirq/experiments/qubit_characterizations.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def _fit_exponential(self) -> tuple[np.ndarray, np.ndarray]:
142142
xdata=self._num_cfds_seq,
143143
ydata=self._gnd_state_probs,
144144
p0=[0.5, 0.5, 1.0 - 1e-3],
145-
bounds=([0, 0.25, 0], [0.5, 0.75, 1]),
145+
bounds=([-1, -1, 0], [1, 1, 1]),
146146
)
147147

148148

@@ -367,9 +367,15 @@ class RBParameters:
367367
def gateset(self) -> list[list[ops.SingleQubitCliffordGate]]:
368368
clifford_group = _single_qubit_cliffords()
369369
sequences = clifford_group.c1_in_xy if self.use_xy_basis else clifford_group.c1_in_xz
370+
sequences = _canonize_clifford_sequences(sequences)
370371
if self.strict_basis:
371-
sequences = [seq for seq in sequences if len(seq) == 2]
372-
return _canonize_clifford_sequences(sequences)
372+
if self.use_xy_basis:
373+
excluded_gates = ops.Gateset(ops.I, ops.Z, ops.Z**0.5, ops.Z**-0.5)
374+
else:
375+
excluded_gates = ops.Gateset(ops.I, ops.Y, ops.Y**0.5, ops.Y**-0.5)
376+
377+
sequences = [[g] for (g,) in sequences if g not in excluded_gates]
378+
return sequences
373379

374380

375381
@deprecated(deadline='v2.0', fix='please use single_qubit_rb instead')

cirq-core/cirq/experiments/qubit_characterizations_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ def test_single_qubit_cliffords_gateset(num_cliffords, use_xy_basis, strict_basi
242242
c1_in_xy = cirq.experiments.qubit_characterizations.RBParameters(
243243
use_xy_basis=use_xy_basis, strict_basis=strict_basis
244244
).gateset()
245+
if strict_basis:
246+
assert len(c1_in_xy) == 20
247+
else:
248+
assert len(c1_in_xy) == 24
245249
c = cirq.experiments.qubit_characterizations._create_parallel_rb_circuit(
246250
qubits, num_cliffords, c1_in_xy
247251
)

0 commit comments

Comments
 (0)