Skip to content

Commit

Permalink
Use if instead of case
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-mills-cqc committed Nov 5, 2023
1 parent dea2188 commit 952871b
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions qermit/mock_backend/noise_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,27 @@ def post_select(self, qubit_list):

def string_to_pauli(pauli_string):
qubit = Qubit(name=pauli_string[0][0], index=pauli_string[0][1][0])
match pauli_string[1]:
case 'I':
pauli = Pauli.I
case 'X':
pauli = Pauli.X
case 'Y':
pauli = Pauli.Y
case 'Z':
pauli = Pauli.Z
case _:
raise Exception("How did you get here?")
if pauli_string[1] == 'I':
pauli = Pauli.I
elif pauli_string[1] == 'X':
pauli = Pauli.X
elif pauli_string[1] == 'Y':
pauli = Pauli.Y
elif pauli_string[1] == 'Z':
pauli = Pauli.Z
else:
raise Exception("How did you get here?")
# match pauli_string[1]:
# case 'I':
# pauli = Pauli.I
# case 'X':
# pauli = Pauli.X
# case 'Y':
# pauli = Pauli.Y
# case 'Z':
# pauli = Pauli.Z
# case _:
# raise Exception("How did you get here?")
return qubit, pauli

def reduce_pauli_error(pauli_error):
Expand Down

0 comments on commit 952871b

Please sign in to comment.