From 43b57fe9428ab6afd1746fde559a99f7162eb7cf Mon Sep 17 00:00:00 2001 From: jordanh6 Date: Wed, 6 Sep 2023 21:21:05 -0700 Subject: [PATCH] fixed bug in BiRB Pauli sampling function --- pygsti/algorithms/randomcircuit.py | 4 +--- pygsti/protocols/rb.py | 10 +++------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/pygsti/algorithms/randomcircuit.py b/pygsti/algorithms/randomcircuit.py index 58da17718..a6a02b669 100644 --- a/pygsti/algorithms/randomcircuit.py +++ b/pygsti/algorithms/randomcircuit.py @@ -3161,10 +3161,8 @@ def _stabilizer_to_all_zs(stabilizer, qubit_labels, absolute_compilation): s_layer, p_layer = _symp.symplectic_kronecker(stab_layer) stab_circuit = _cir.Circuit([c], editable=True) stab_circuit.change_gate_library(absolute_compilation) - if stab_circuit.depth == 0: stab_circuit.insert_layer_inplace([_lbl.Label(())], 0) - #stab_circuit.insert_layer_inplace([_lbl.Label((idle_name), q) for q in qubit_labels], 0) stab_circuit.done_editing() return s_layer, p_layer, stab_circuit @@ -3348,7 +3346,7 @@ def _sample_stabilizer(pauli, sign, absolute_compilation, qubit_labels): compiled_layer = layer.copy(editable=True) compiled_layer.change_gate_library(absolute_compilation) if compiled_layer.depth == 0: - stab_circuit.insert_layer_inplace([_lbl.Label(())], 0) + compiled_layer.insert_layer_inplace([_lbl.Label(())], 0) #compiled_layer.insert_layer_inplace([_lbl.Label(idle_name, q) for q in qubit_labels], 0) return stab_state, stab_phase, s_prep, p_prep, compiled_layer diff --git a/pygsti/protocols/rb.py b/pygsti/protocols/rb.py index c7f06eb61..062bb24bb 100644 --- a/pygsti/protocols/rb.py +++ b/pygsti/protocols/rb.py @@ -844,8 +844,8 @@ def map_qubit_labels(self, mapper): ------- MirrorRBDesign """ + mapped_circuits_and_idealouts_by_depth = self._mapped_circuits_and_idealouts_by_depth(mapper) mapped_qubit_labels = self._mapped_qubit_labels(mapper) - return DirectRBDesign.from_existing_circuits(mapped_circuits_and_idealouts_by_depth, mapped_qubit_labels, self.circuit_type, self.sampler, @@ -980,12 +980,8 @@ def _init_foundation(self, depths, circuit_lists, measurements, signs, circuits_ self.addlocal = addlocal self.lsargs = lsargs - if add_default_protocol: - if randomizeout: - defaultfit = 'A-fixed' - else: - defaultfit = 'full' - self.add_default_protocol(RB(name='RB', defaultfit=defaultfit)) + defaultfit = 'A-fixed' + self.add_default_protocol(RB(name='RB', defaultfit=defaultfit)) self.auxfile_types['signs'] = 'json' # Makes sure that signs and measurements are saved seperately self.auxfile_types['measurements'] = 'json'